Setting Static Local IP Address

I haven’t had to do this on linux for a very long time, and I’m having a tough time of it.

Can someone tell me how I can define a local static IP address (so that I can run a web server off of the same IP, rather than letting my router DHCP it)?

I’ve tried doing the YaST->Network Devices->Network Settings->Traditional Method with ifup->Set NIC to desired IP->Set Default Gateway to router address method, and afterwards I can’t even get into my router anymore (not even responding to ping).

Newb terms, please, it’s been about 10 years.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

That should work fine. It seems likely that a setting in Yast was
specified incorrectly. Get the networking information from the following
and tell us how you were testing access to your router by including
commands and their output:

ip addr
ip route
cat /etc/resolv.conf
ping -c 3 google.com
ping -c 3 74.125.39.147

Good luck.

On 02/18/2010 01:16 AM, tsuujin wrote:
>
> I haven’t had to do this on linux for a very long time, and I’m having a
> tough time of it.
>
> Can someone tell me how I can define a local static IP address (so that
> I can run a web server off of the same IP, rather than letting my router
> DHCP it)?
>
> I’ve tried doing the YaST->Network Devices->Network
> Settings->Traditional Method with ifup->Set NIC to desired IP->Set
> Default Gateway to router address method, and afterwards I can’t even
> get into my router anymore (not even responding to ping).
>
> Newb terms, please, it’s been about 10 years.
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.12 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJLfPmqAAoJEF+XTK08PnB5XG4QAK9vViOGibktY9NlOtCbP5V3
FKSzBzmT/EeuuWqcSKQBtkF5Df+Qtow6CAnTy75mVAbCEV5N/VszVPcDs99xlIMp
Dhieivy+ucoaq3PbjllYpzMWVbEqj8du1JZ+JQL8wEgnjY15gD8PdTvXF7apVmIg
VTYpd6ryk/gJyxHlpSChryFl+HYuaEozHUTBS3SgWYzSPFIX3+pBVMZrLwwBElLz
ubAwCIFDQKIIiZpJnIbonsQlk0yWbj1xiIzriKPNGCeq2zBDZxoEk9/Rhcl+p6nZ
I1iEgA0E33ibiM9l28vhUs9NarSkuDA86vf1c9iHrW1E1n0FaEi5ftLyo31Y2cip
/AqouR32lvaG9RLntRo07lGeTNYu2AJgzTHKXaI3zIA1j8WpYuRuQK6p7sezLLoJ
QeFRDtm87byOiDwavTTKY2OMtZldqQ17DTFcnyIPe7y7s3pmmBVxWMBYAkHqk3ll
t3aTNoL265dd6+5iTgHp3ju0Gl69eK7qC9twRp6JCQraZ3iTEVxyGkz/AVzjz707
o/xDa5JVQmXwwqnpQDoJTEZzg39Sg2QuwV9kQJfwXdDfQ7UWA21hoRxiAHvs2IVT
mPxh+7S+znbOvWlPoDgxBnSSO/h2RsoQR33+bUMV59Isyn+gmgJEG854yUcPRiml
QKGhdytY0NDdi8QW/KN3
=ALBi
-----END PGP SIGNATURE-----

tsuujin@akujin:~> ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 brd 127.255.255.255 scope host lo
inet 127.0.0.2/8 brd 127.255.255.255 scope host secondary lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
link/ether 00:1f:c6:81:e1:cc brd ff:ff:ff:ff:ff:ff
inet 192.168.1.200/24 brd 192.168.1.255 scope global eth0
3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
link/ether 00:1f:c6:81:e1:cb brd ff:ff:ff:ff:ff:ff
tsuujin@akujin:~> ip route
192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.200
169.254.0.0/16 dev eth0 scope link
127.0.0.0/8 dev lo scope link
default via 192.168.1.1 dev eth0
tsuujin@akujin:~> cat /etc/resolv.conf

/etc/resolv.conf file autogenerated by netconfig!

Before you change this file manually, consider to define the

static DNS configuration using the following variables in the

/etc/sysconfig/network/config file:

NETCONFIG_DNS_STATIC_SEARCHLIST

NETCONFIG_DNS_STATIC_SERVERS

NETCONFIG_DNS_FORWARDER

or disable DNS configuration updates via netconfig by setting:

NETCONFIG_DNS_POLICY=’’

See also the netconfig(8) manual page and other documentation.

Note: Manual change of this file disables netconfig too, but

may get lost when this file contains comments or empty lines

only, the netconfig settings are same with settings in this

file and in case of a “netconfig update -f” call.

Please remove (at least) this line when you modify the file!

search akujin.com
tsuujin@akujin:~> ping -c 3 google.com
ping: unknown host google.com
tsuujin@akujin:~> ping -c 3 74.125.39.147
PING 74.125.39.147 (74.125.39.147) 56(84) bytes of data.
From 192.168.1.200: icmp_seq=1 Destination Host Unreachable
From 192.168.1.200 icmp_seq=1 Destination Host Unreachable
From 192.168.1.200 icmp_seq=2 Destination Host Unreachable
From 192.168.1.200 icmp_seq=3 Destination Host Unreachable

— 74.125.39.147 ping statistics —
3 packets transmitted, 0 received, +4 errors, 100% packet loss, time 1999ms
, pipe 3
tsuujin@akujin:~>

Here’s an old but still quite relevant pictorial howto setup the gateway IP, fixed IP and the name servers, all of which you probably need when you go to a fixed IP: HowTo Configure a network card in Suse/openSUSE 10, 11 for LAN and Internet Access.

Look for the heading “Setup for Fixed IP Addressing. Manually set everything. Pics 1, 2, 6, 7, 8 and 9” and follow Pics 1,2,6,7,8 and 9

Might help

To start with, neither interface is up. Use Swerdna’s walk-through. Then, if you want to run servers, you have to make sure that the required ports are opened in the firewall (both Swerdna and HowtoForge - Linux Howtos and Tutorials have excellent walkthroughs for this as well).

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

  • From your output, which was perfect by the way:

2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast
state DOWN qlen 1000

NO-CARRIER and ‘state DOWN’ are probably not helping you. Sure your LAN
cable is secure? Not using a crossover cable on accident instead of a
straight-through cable, are you? I imagine if you set your system to use
the Network Manager (the other option besides ‘Traditional’) this will
probably not work still.

The other setting is you do not have a DNS server. As ‘root’ modify your
/etc/resolv.conf by adding (for testing) the following lines, though this
will not help with resolving google.com until you get your physical
network working as mentioned above:

sudo vi /etc/resolv.conf

add:

nameserver 192.168.1.1
nameserver 208.67.220.220
nameserver 208.67.222.222

I’m guessing on that first IP address since it’s your gateway and most
home routers are also DNS providers.

Good luck.

On 02/18/2010 07:26 PM, tsuujin wrote:
>
> tsuujin@akujin:~> ip addr
> 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
> link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
> inet 127.0.0.1/8 brd 127.255.255.255 scope host lo
> inet 127.0.0.2/8 brd 127.255.255.255 scope host secondary lo
> inet6 ::1/128 scope host
> valid_lft forever preferred_lft forever
> 2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast
> state DOWN qlen 1000
>
> link/ether 00:1f:c6:81:e1:cc brd ff:ff:ff:ff:ff:ff
>
> inet 192.168.1.200/24 brd 192.168.1.255 scope global eth0
>
> 3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast state DOWN
> qlen 1000
> link/ether 00:1f:c6:81:e1:cb brd ff:ff:ff:ff:ff:ff
>
> tsuujin@akujin:~> ip route
>
> 192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.200
>
> 169.254.0.0/16 dev eth0 scope link
>
> 127.0.0.0/8 dev lo scope link
> default via 192.168.1.1 dev eth0
> tsuujin@akujin:~> cat /etc/resolv.conf
> ### /etc/resolv.conf file autogenerated by netconfig!
> #
> # Before you change this file manually, consider to define the
> # static DNS configuration using the following variables in the
> # /etc/sysconfig/network/config file:
> # NETCONFIG_DNS_STATIC_SEARCHLIST
> # NETCONFIG_DNS_STATIC_SERVERS
> # NETCONFIG_DNS_FORWARDER
> # or disable DNS configuration updates via netconfig by setting:
> # NETCONFIG_DNS_POLICY=’’
> #
> # See also the netconfig(8) manual page and other documentation.
> #
> # Note: Manual change of this file disables netconfig too, but
> # may get lost when this file contains comments or empty lines
> # only, the netconfig settings are same with settings in this
> # file and in case of a “netconfig update -f” call.
> #
> ### Please remove (at least) this line when you modify the file!
> search akujin.com
> tsuujin@akujin:~> ping -c 3 google.com
> ping: unknown host google.com
> tsuujin@akujin:~> ping -c 3 74.125.39.147
> PING 74.125.39.147 (74.125.39.147) 56(84) bytes of data.
> From 192.168.1.200: icmp_seq=1 Destination Host Unreachable
> From 192.168.1.200 icmp_seq=1 Destination Host Unreachable
> From 192.168.1.200 icmp_seq=2 Destination Host Unreachable
> From 192.168.1.200 icmp_seq=3 Destination Host Unreachable
>
> — 74.125.39.147 ping statistics —
> 3 packets transmitted, 0 received, +4 errors, 100% packet loss, time
> 1999ms
> , pipe 3
> tsuujin@akujin:~>
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.12 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJLfkHIAAoJEF+XTK08PnB5cKwP/jKC5abYHGDFGLHROGPP3I9n
LU45YBNyLv5ZZzsQbL5rOc3Eb0H3+n+PejF45wscs/DnBY9zNa1eeDd88qFlB/VS
2q+QcuYYMOKLcfocVYUzALkbpfdnXkaB8kBYTh3ONQWpgSq8X79M3rYsQ5hd67FU
Oi3QDKsjH9sPf8PgjcfHfzo2VxlvsMi8zwtaORdeCRDB8vjDE0DecKTnsKmVFeNM
qHBSYudifIt+AwGnc+TyFQl8avgE/03NdCVJp2IA0fuH1QOLkppU9BT034zujzdF
3ETl4hm6CXzbFjwgLnHu9ke0bFHVAVDJ4tqoW4Td+od+7H/i/qFgL8AvjBRr86Sx
hjCJBSNgTDXgHLf/dsvzawh8yh441Wh3Klvbl87TujYwStkIL2/PRxpodmg3Up36
ly9DjxaSTFFerHjm8nNOfJiG3ghwdSvouJqB9wQlaFD5C9zMO78g4ru9QZXLWhiD
l2xfZ4XiRrzX3XTWxxlmoO2GF+kVQJk5Dj6Bj4cquR3dfZNkeYF944vrKXwq8s7L
7HX2YffX5vH2PKB/LPZyPtgZQsko2IreqP/LqYNp87QN5e8VjKn/prirghoDIwY6
4igvb/Pk9ZEdWcdjG/3RjZrHurEzbBnfgC+X6CFpn+LscdKG2Ez5nc/WF5hZ5r2L
rITIsCp3ZYUGeSE7jiRV
=27ju
-----END PGP SIGNATURE-----

I don’t know what’s going on here. But the preferred way to define “permanently” static DNS is in /etc/sysconfig/network/config:

NETCONFIG_DNS_STATIC_SERVERS=“192.168.1.1 208.67.220.220 208.67.222.222”

Editing /etc/resolv.conf is fine for testing though.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Yes, and I think that is what Yast does by default when adding nameservers
in the network configuration. I should have mentioned that (Yast) method
instead of manually hacking /etc/resolv.conf so good point there.

Good luck.

On 02/19/2010 01:26 AM, please try again wrote:
>
> ab@novell.com;2123457 Wrote:
>>
>> The other setting is you do not have a DNS server. As ‘root’ modify
>> your /etc/resolv.conf by adding (for testing) the following lines,
>> though this will not help with resolving google.com until you get your
>> physical network working as mentioned above:
>>
>> sudo vi /etc/resolv.conf
>>
>> add:
>> nameserver 192.168.1.1
>> nameserver 208.67.220.220
>> nameserver 208.67.222.222
>>
>>
>
> I don’t know what’s going on here. But the preferred way to define
> “permanently” static DNS is in /etc/sysconfig/network/config:
>
> NETCONFIG_DNS_STATIC_SERVERS=“192.168.1.1 208.67.220.220
> 208.67.222.222”
>
> Editing /etc/resolv.conf is fine for testing though.
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.12 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJLfk8lAAoJEF+XTK08PnB5NOgQAMzbCqD5JJGuVhEzO243JUnE
pmLFA3++fcP62bLIB5nrFyRhvNGjj+aoHiL/BelrWzUeVtEHMyrtNotXdz3Oa5kY
EFEZ6Xm1KlK4sdDrr2QCxCv1jdoqmL9DPwxPAsaPh/E/blgbpR3p+oay0W6e60AK
Li/qR5AO3ciBwmYXa7/4FtfcDQ3nQkaUuV1rtUHGPoRvXIylOccWbv+Ki65AU/sZ
eh81atQjaaVvtxzoXCWChIEO7OUojGJMVdFAnUCHONKO3RxBv5LEQDVj85KHb67d
++T3gSNZEPys9ivtOV6o2Paqs4quzgdMRUCTaeNmgcWtULvQY+gBlfTNeA3b0Cac
O7QVyIkhqnFtPvEM2MwxtQxJ36AtQs1NBiB7H8YsqFnOMywlVJ2x5S48fHXoQcqL
ZiWbG/26V2DyOI5sLP9WN0pQadOUVXuWG35SvYT2GYePWfB7oiqt85Njnl9o5OqD
mqJI44Z61d24Xn8jnm4o0AIxNEbbdwLurFqJDoF0aR7AMbfoGd6TKkmkoSKpAZjR
vt3xa9ux7x7r4JwfxmfPb96OvnJPk7NaiPnfDvKd/MewYr9RpAvsmN+9eD22hK7G
3wi2udb9U3PXbV8BCpu/HMG0tyanRtqXEuEuHeG4IFxnzySKLp+DWTMGLlN713UP
CPTaNwDtrgiVe2uNQgbK
=6e3g
-----END PGP SIGNATURE-----

Sorry for the delay in posts, I’ve been away from my computer.

The physical network is fine (I’m using the same network equipment to access the internet right now successfully), so I don’t think that would be the issue here.

I’ll try your other suggestions shortly.