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?