Wednesday, June 9, 2010

One problem I faced is that even after setting IP statically with ifconfig it was getting reverted to its original IP after network restart.

 The command I used were -

ifconfig eth0 down 

to bring the default ethernet link down.

/etc/init.d/networking stop

for stopping the network daemon.

ifconfig eth0 192.168.xx.xx netmask 255.255.255.0 broadcast 192.168.xx.xx

to set the IP of my machine to 192.168.xx.xx statically.

ifconfig eth0 down

to bring up the ethernet interface.

ifconfig

to show what is my new IP. And it shows the IP correctly. But when I restart
the network with the command.

/etc/init.d/networking start

It reverts back to the original IP. I finally realized what is happening. This is because the IP is set by the NetworkManager which pulls the IP information from the file /etc/network/interfaces. So as long as this file contains the old IP  NetworkManager would keep changing the IP to the old one.

So, I manually edited the file -


# original file
auto lo
iface lo inet loopback


auto eth0
iface eth0 inet static
address 192.168.xx.xx
netmask 255.255.255.0
gateway 192.168.xx.xx



-------------------------------------------


# edited file
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

 

Let us explain the terms -  

auto eth0 asks the NetworkManager to automatically label all the network cards it finds as eh0, eth1 and so on.  iface eth0 inet static sets the eth0 IP as static. The rest are self-explanatory. iface eth0 inet dhcp sets the computer to use DHCP.
 
 For more information on this, see this website -
http://bitbud.wordpress.com/2007/11/12/network-interface-examples/

No comments:

OK GOOGLE on Samsung Galaxy S7 doesn’t work

To make Ok Google detection work on Galaxy S7 (Galaxy series phones) we need to perform a couple of steps. 1. As long as Samsung S vo...