5

How come restarting networking does not restart eth0 successfully on my server? None of my CentOS virtual machines have this problem.

root@living:~# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:50:56:91:00:01
          inet addr:192.168.1.110  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::250:56ff:fe91:1/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:9354 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4835 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1052796 (1.0 MiB)  TX bytes:1129902 (1.0 MiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:287 errors:0 dropped:0 overruns:0 frame:0
          TX packets:287 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:23280 (22.7 KiB)  TX bytes:23280 (22.7 KiB)
root@living:~# service networking restart
Running /etc/init.d/networking restart is deprecated because it may not enable again some interfaces ... (warning).
Reconfiguring network interfaces...
[PuTTY disconnects]
root@living:~# ifconfig
lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:287 errors:0 dropped:0 overruns:0 frame:0
          TX packets:287 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:23280 (22.7 KiB)  TX bytes:23280 (22.7 KiB)
3
  • Do you use Debian 6.0?
    – M'vy
    May 20, 2011 at 22:48
  • Can you add in the content of /etc/network/interfaces. The problem is likely in there. May 20, 2011 at 22:50
  • Yes, I use Debian 6.0, but the issue was solved. The issue was I had auto-hotswapping eth0 in my interfaces, replacing it by auto eth0 solved it.
    – ujjain
    May 26, 2011 at 12:10

2 Answers 2

5
root@machine:~# cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
iface eth0 inet static
 address 192.168.1.110
 gateway 192.168.1.1
 netmask 255.255.255.0
 network 192.168.1.0
 broadcast 192.168.1.255

The solution was replacing allow-hotplug by auto. Thanks! :)

2
  • 1
    If this is the answer you needed, please accept your answer as the correct one.
    – Flimzy
    Jun 17, 2011 at 6:33
  • 1
    I had the same problem and changing from allow-hotplug to auto worked for me as well. Does anyone know why? The strange thing is that after restarting the computer it works, but not after restarting only the network service.
    – Jonatan
    Oct 28, 2013 at 9:05
2

I suspect your problem is that when networking is shut down (to restart), sshd is noticing and closing the connection. When sshd closes the connection, the pseudo-tty SIGHUPs the shell, along with the programs that were running in it. This includes init.d/networking which is dying before it can start the connection back up again.

Try running screen first (so that the shell is not interrupted) or at least nohup service networking restart so that the script won't receive SIGHUP and terminate.

3
  • I have tried that, but it does not come back either....
    – ujjain
    May 25, 2011 at 20:39
  • @chronoz then I guess the message it gave saying that it may not bring some interfaces back again was right. Post your interfaces file like SmallClanger asked so we can figure out why. Looking at the script, it looks like all interfaces but loopback are stopped, but only auto interfaces will be brought back up (just like at boot).
    – DerfK
    May 25, 2011 at 22:54
  • It was solved. The issue was I had auto-hotswapping eth0 in my interfaces, replacing it by auto eth0 solved it.
    – ujjain
    May 26, 2011 at 12:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .