[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: /etc/init.d/networking restart does not change IP address. I have to reboot. Help.

On Sat, 04 Apr 2009 16:58:50 +0530, Foss User posted:

> Trying to change the IP address in /etc/network/interfaces and then
> /etc/init.d/networking restart does not really change my IP. I am having
> to do a reboot to really change the IP. Could someone please help me in
> understanding why restarting networking doesn't do it?
> lenny-template:~# ifconfig
> eth0      Link encap:Ethernet  HWaddr 00:0c:29:e9:63:c4
>           inet addr:  Bcast:  Mask:
>           inet6 addr: fe80::20c:29ff:fee9:63c4/64 Scope:Link UP BROADCAST
>           RUNNING MULTICAST  MTU:1500  Metric:1 RX packets:255 errors:0
>           dropped:0 overruns:0 frame:0 TX packets:48 errors:0 dropped:0
>           overruns:0 carrier:0 collisions:0 txqueuelen:1000
>           RX bytes:22731 (22.1 KiB)  TX bytes:6835 (6.6 KiB) Interrupt:18
>           Base address:0x2080
> lo        Link encap:Local Loopback
>           inet addr:  Mask:
>           inet6 addr: ::1/128 Scope:Host
>           UP LOOPBACK RUNNING  MTU:16436  Metric:1 RX packets:8 errors:0
>           dropped:0 overruns:0 frame:0 TX packets:8 errors:0 dropped:0
>           overruns:0 carrier:0 collisions:0 txqueuelen:0
>           RX bytes:560 (560.0 B)  TX bytes:560 (560.0 B)
> lenny-template:~# cat /etc/network/interfaces # The loopback network
> interface
> auto lo
> iface lo inet loopback
> # The primary network interface
> allow-hotplug eth0
> iface eth0 inet static
>         address
>         netmask
>         network
>         broadcast
>         gateway
>         # dns-* options are implemented by the resolvconf package, if
>         installed dns-nameservers
> Then I edit only the 'address' line of 'iface eth0 inet static' to:
> address
> and issue the command: /etc/init.d/networking restart.
> After that when I run ipconfig command, I see only iface lo in the output.
> If I run ipconfig -a command, then I see iface eth0 too but its ip address
> is still the old one:
> Please help.

Do you have "network-manager" installed? If it is trying to control your
network interfaces for you, it will ignore that stanza with the static
address in your interfaces file (and presumeably, try to use the old
address it knows). 

You could uninstall network-manager and regain the "old" behaviour, your
edits to the interfaces file would work as expected. Network Manager is
mostly meant to be used in the "roaming" situation.

You could leave network-manager working and modify the interfaces file to
auto eth0
iface eth0 inet dhcp
and let your router hand out a static address to the interface by MAC
address (router documentation will discuss this).

Reply to: