[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, Apr 4, 2009 at 5:21 PM, Sven Joachim <svenjoac@gmx.de> wrote:
> On 2009-04-04 13:28 +0200, Foss User wrote:
>> 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
>  ^^^^^^^^^^^^^
> This is your problem, you probably want to change that to "auto".
>> 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:
> The reason is that "/etc/init.d/networking restart" boils down to
> "ifdown -a --exclude=lo; ifup -a --exclude=lo" and "ifup -a" only brings
> up interfaces that are marked "auto" in /etc/network/interfaces.
> Running "ifup eth0" will bring the interface up again and change your IP
> address.
> Sven

So, should I add the following line:

auto eth0

before this line:

allow-hotplug eth0


What is the use of allow-hotplug eth0? Can I remove the allow-hotplug line?

Reply to: