assign auto static ip on ubuntu 10.04

Posted by ronakin on Server Fault See other posts from Server Fault or by ronakin
Published on 2011-03-08T13:54:24Z Indexed on 2011/03/09 16:12 UTC
Read the original article Hit count: 294

I'm trying to set auto static ip. I've set the content of /etc/network/interfaces to be:

auto lo

auto eth0
iface eth0 inet static
address 192.168.1.2
netmask 255.255.255.0
gateway 192.168.1.1.

and /etc/resolv.conf to be:

nameserver 192.168.1.1.

It seems that the ip address have set successfully. However, when I plug out the lan cable and then plug it back, the ip address is not set. How can I make it automatically set the static ip when the lan cable is connected?

© Server Fault or respective owner

Related posts about ubuntu

Related posts about ubuntu-10.04