LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 03-01-2012, 07:49 AM   #1
Proboscide99
LQ Newbie
 
Registered: Apr 2010
Posts: 5

Rep: Reputation: 0
eth0 and routing not restored when the interface goes down / up


Hi everybody!

I recently came across a strange problem on my debian wheezy (testing) with kernel 3.2.0-1-686-pae running on an Asus eeebox B202 (atom).

The eth0 interface is connected to an internet gateway (192.168.0.1) and is configured at boot time with static IP 192.168.0.42 by the following /etc/network/interfaces file:

auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
iface eth0 inet static
address 192.168.0.42
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
dns-nameservers 192.168.0.1

I'm not using any connection manager, despite WICD is installed (but does not manage eth0).

Everything is fine after any boot, but if I unplug / plug again the ethernet cable, then both the eth0 settings and route settings are gone.

The same happens if I simply issue 'ifconfig eth0 down' and then 'ifconfig eth0 up': I can't even ping the router.

I have to manually specify the eth0 IP by issuing 'ifconfig eth0 192.168.0.42' then I'm able to ping the router, but not the internet (i.e. ping 173.194.35.24, which is google, returns a 'connect: Network is unreachable' error).

Reason: the routing is no longer configured, in fact if I issue the command 'route', I receive a blank response.

I found that this command restores routing functionality:
ip route add dev eth0 to default src 192.168.0.42 via 192.168.0.1

After this command, everything is fine (until the next temporary eth0 disconnect event).

I see that my /etc/network/interfaces does not contain any 'up...' statement, and I've also tried some without results, but the point is that the same comfiguration used to work until now. I can't tell exactly WHEN the problem arised, but it should be in the last 10 days at most.

May someone give me any hint about where to look in the config files to track down the problem?

Thanks in advance and Best Regards!
Alessandro, Italy
 
Old 03-01-2012, 06:25 PM   #2
aus9
LQ 5k Club
 
Registered: Oct 2003
Location: Western Australia
Distribution: Icewm
Posts: 5,842

Rep: Reputation: Disabled
firstly run the command ---as you not root
Code:
groups
check plugdev is one of the responses for cable issues



2) consider making a backup of this file then edit the original and reboot
/etc/dhcp/dhclient.conf

suggested changes

lease {
interface "eth0";
fixed-address 192.168.0.42;
# medium "link0 link1";
# option host-name "andare.swiftmedia.com";
option subnet-mask 255.255.255.0;
# option broadcast-address 192.168.0.255;
# option routers 192.33.137.250;
option domain-name-servers 192.168.0.1;
# renew 2 2000/1/12 00:00:01;
# rebind 2 2000/1/12 00:00:01;
# expire 2 2000/1/12 00:00:01;
}
 
Old 03-01-2012, 06:28 PM   #3
aus9
LQ 5k Club
 
Registered: Oct 2003
Location: Western Australia
Distribution: Icewm
Posts: 5,842

Rep: Reputation: Disabled
I have trouble with this site....remove the # from line option broadcast-address 192.168.0.255;
 
Old 03-03-2012, 10:26 AM   #4
Proboscide99
LQ Newbie
 
Registered: Apr 2010
Posts: 5

Original Poster
Rep: Reputation: 0
Hello and thanks for your reply. "plugdev" is listed in the output of the 'group' command, issued as non-root.

I made the changes you suggested to the /etc/dhcp/dhclient.conf file, as follows:

lease {
interface "eth0";
fixed-address 192.168.0.42;
# medium "link0 link1";
# option host-name "andare.swiftmedia.com";
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.0.255;
# option routers 192.33.137.250;
option domain-name-servers 192.168.0.1;
# renew 2 2000/1/12 00:00:01;
# rebind 2 2000/1/12 00:00:01;
# expire 2 2000/1/12 00:00:01;
}

then rebooted the machine, but after unplugging / plugging back the eth0 cable, I get no routing and no eth0 IP configuration. I still need to issue
ifconfig eth0 192.168.0.42 followed by
ip route add dev eth0 to default src 192.168.0.42 via 192.168.0.1

I've also made another test: I added a line to the /etc/network/interfaces file:
up /etc/network/my_route_setup
and the 'my_route_setup' file's content is as follows:

#!/bin/sh -e
#
echo zap > testfile
ifconfig eth0 192.168.0.42
ip route add dev eth0 to default src 192.168.0.42 via 192.168.0.1

Well, this is what I discovered: the script IS executed at boottime, in fact I found the "testfile", while is NEVER executed in any other circumstance (cable plugging or ifconfig down/up command sequence).

I think that the problem may come from this: the /etc/network/interfaces would be enough to configure the whole thing, but it is not "triggered".

Am I perhaps missing something here?

/etc/network/if-up.d# ls -lt
total 16
lrwxrwxrwx 1 root root 32 Jan 4 20:18 wpasupplicant -> ../../wpa_supplicant/ifupdown.sh
-rwxr-xr-x 1 root root 4525 Dec 28 22:48 mountnfs
-rwxr-xr-x 1 root root 641 Oct 10 2010 samba
-rwxr-xr-x 1 root root 431 Nov 22 2009 avahi-daemon

Thanks a lot and Best Regards
Alessandro
 
Old 03-03-2012, 05:32 PM   #5
aus9
LQ 5k Club
 
Registered: Oct 2003
Location: Western Australia
Distribution: Icewm
Posts: 5,842

Rep: Reputation: Disabled
not sure why you need wpasupp....I thought you used ethernet cable

ok lets try and debug it

use root powers to edit this file /etc/dhcp/dhclient-enter-hooks.d/debug
RUN="yes"

note the file name to read..../tmp/dhclient-script.debug

ditto do the same to /etc/dhcp/dhclient-exit-hooks.d/debug for cable pull.

post your logs pls

your output in etc/network needs to be fuller pls..to eliminate issues I will show mine if it helps

Code:
not OP example


ls -al /etc/network
total 40
drwxr-xr-x   7 root root  4096 Jul 14  2011 .
drwxr-xr-x 108 root root 12288 Feb 25 17:48 ..
drwxr-xr-x   2 root root  4096 Jan 20 18:45 if-down.d
drwxr-xr-x   2 root root  4096 Feb 25 17:47 if-post-down.d
drwxr-xr-x   2 root root  4096 Oct 10 20:05 if-pre-up.d
drwxr-xr-x   2 root root  4096 Feb 25 17:47 if-up.d
-rw-r--r--   1 root root   245 Oct  9 12:42 interfaces
drwxr-xr-x   2 root root  4096 Mar  4 07:07 run

 ls -al /etc/network/*up*
/etc/network/if-pre-up.d:
total 8
drwxr-xr-x 2 root root 4096 Oct 10 20:05 .
drwxr-xr-x 7 root root 4096 Jul 14  2011 ..

/etc/network/if-up.d:
total 28
drwxr-xr-x 2 root root 4096 Feb 25 17:47 .
drwxr-xr-x 7 root root 4096 Jul 14  2011 ..
-rwxr-xr-x 1 root root  525 Dec  1 02:05 000resolvconf
-rwxr-xr-x 1 root root 4525 Dec 29 05:48 mountnfs
-rwxr-xr-x 1 root root 1089 Sep 16  2008 ntpdate
-rwxr-xr-x 1 root root  849 Aug 24  2010 openssh-server

ls -al /etc/network/run
total 12
drwxr-xr-x 2 root root 4096 Mar  4 07:07 .
drwxr-xr-x 7 root root 4096 Jul 14  2011 ..
-rw-r--r-- 1 root root   16 Mar  4 07:07 ifstate
 
Old 03-04-2012, 03:27 AM   #6
Proboscide99
LQ Newbie
 
Registered: Apr 2010
Posts: 5

Original Poster
Rep: Reputation: 0
Hello!

Please note that I reversed all previous changes, let me know if I was wrong doin that. Then I applied the new changes and here is the output:

/tmp/dhclient-script.debug
Sun Mar 4 10:07:58 CET 2012: entering dhclient-enter-hooks.d, dumping variables.
reason='RELEASE'
interface='eth0'
old_ip_address='192.168.0.200'
old_host_name='Host-001'
old_network_number='192.168.0.0'
old_subnet_mask='255.255.255.0'
old_broadcast_address='192.168.0.255'
old_routers='192.168.0.1'
old_domain_name='homenet.telecomitalia.it'
old_domain_name_servers='192.168.0.1'
--------------------------
Sun Mar 4 10:07:59 CET 2012: entering dhclient-exit-hooks.d, dumping variables.
reason='RELEASE'
interface='eth0'
old_ip_address='192.168.0.200'
old_host_name='Host-001'
old_network_number='192.168.0.0'
old_subnet_mask='255.255.255.0'
old_broadcast_address='192.168.0.255'
old_routers='192.168.0.1'
old_domain_name='homenet.telecomitalia.it'
old_domain_name_servers='192.168.0.1'
--------------------------
Sun Mar 4 10:07:59 CET 2012: entering dhclient-enter-hooks.d, dumping variables.
reason='RELEASE'
interface='eth0'
old_ip_address='192.168.0.200'
old_host_name='Host-001'
old_network_number='192.168.0.0'
old_subnet_mask='255.255.255.0'
old_broadcast_address='192.168.0.255'
old_routers='192.168.0.1'
old_domain_name='homenet.telecomitalia.it'
old_domain_name_servers='192.168.0.1'
--------------------------
Sun Mar 4 10:07:59 CET 2012: entering dhclient-exit-hooks.d, dumping variables.
reason='RELEASE'
interface='eth0'
old_ip_address='192.168.0.200'
old_host_name='Host-001'
old_network_number='192.168.0.0'
old_subnet_mask='255.255.255.0'
old_broadcast_address='192.168.0.255'
old_routers='192.168.0.1'
old_domain_name='homenet.telecomitalia.it'
old_domain_name_servers='192.168.0.1'
--------------------------

ls -al /etc/network
total 44
drwxr-xr-x 7 root root 4096 Mar 4 10:19 .
drwxr-xr-x 145 root root 12288 Feb 28 22:59 ..
drwxr-xr-x 2 root root 4096 Jan 29 00:25 if-down.d
drwxr-xr-x 2 root root 4096 Jan 29 00:25 if-post-down.d
drwxr-xr-x 2 root root 4096 Jan 29 00:25 if-pre-up.d
drwxr-xr-x 2 root root 4096 Feb 12 20:57 if-up.d
-rw-r--r-- 1 root root 527 Mar 3 16:42 interfaces
-rw-r--r-- 1 root root 527 Jul 7 2011 interfaces.bak-0
drwxr-xr-x 2 root root 4096 Mar 4 10:06 run

ls -al /etc/network/*up*
/etc/network/if-pre-up.d:
total 12
drwxr-xr-x 2 root root 4096 Jan 29 00:25 .
drwxr-xr-x 7 root root 4096 Mar 4 10:19 ..
-rwxr-xr-x 1 root root 3839 Nov 14 11:08 wireless-tools
lrwxrwxrwx 1 root root 32 Jan 4 20:18 wpasupplicant -> ../../wpa_supplicant/ifupdown.sh

/etc/network/if-up.d:
total 24
drwxr-xr-x 2 root root 4096 Feb 12 20:57 .
drwxr-xr-x 7 root root 4096 Mar 4 10:19 ..
-rwxr-xr-x 1 root root 431 Nov 22 2009 avahi-daemon
-rwxr-xr-x 1 root root 4525 Dec 28 22:48 mountnfs
-rwxr-xr-x 1 root root 641 Oct 10 2010 samba
lrwxrwxrwx 1 root root 32 Jan 4 20:18 wpasupplicant -> ../../wpa_supplicant/ifupdown.sh

ls -al /etc/network/run
total 12
drwxr-xr-x 2 root root 4096 Mar 4 10:06 .
drwxr-xr-x 7 root root 4096 Mar 4 10:19 ..
-rw-r--r-- 1 root root 16 Mar 4 10:06 ifstate

Notes: the .200 address is probably what the dhcp server in the gateway would like to assign to the eeebox;

wpa-supplicant is there because this machine used to be a wlan0 <-> eth0 bridge, this is also the reason for wicd to exist. wicd managed the wlan0 interface alone, while eth0 was (and still is) configured by config files. The bridge is configured by:
iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
and dnsmasq, ipmasq were installed.

Nowadays I no longer need the wlan0 stuffs but I would prefer to keep them; do you think this may have to do with the problem?

Thanks a lot and Best Regards!
Alessandro
 
Old 03-04-2012, 12:58 PM   #7
Proboscide99
LQ Newbie
 
Registered: Apr 2010
Posts: 5

Original Poster
Rep: Reputation: 0
Hi again, I've carried out further testing using a previous system backup.

Backup taken on 12-feb (3 weeks ago)
kernel version 3.1.0-1-686-pae

Cable unplugging: NO PROBLEM. (!!!)

ifconfig eth0 down and then up: still able to ping the router, unable to ping the internet (google IP, so not a DNS problem).

In this case, the output of the 'route' command misses one entry:

before ifconfig down/up:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default alicegate.homen 0.0.0.0 UG 0 0 0 eth0
localnet * 255.255.255.0 U 0 0 0 eth0

after ifconfig down/up:

Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
localnet * 255.255.255.0 U 0 0 0 eth0

Other info: placing 'yes' in the 'RUN' parameter in both dhclient-enter/exit files DOES NOT PRODUCE ANY /tmp/dhclient-script.debug file.


Then, another try with current configuration (just to be sure):

kernel version 3.2.0-1-686-pae

Cable unplugging: unable to ping anything.

Output of 'route command': completely EMPTY (opposed as the other case).

eth0 no longer has it's IP address.

The /tmp/dhclient-script.debug appears, as this morning when I first tried.

Now we know that I have a 3-weeks-old backup that does not show the problem. In the meanwhile I just performed a system update to newer kernel and packages. No other packages were installed in the meantime if not included in the 'dist-upgrade'.

I can't tell about the ifconfig down/up problem: it probably was there since a lot of time, I don't use it often. But this is not a real problem. The real problem is when the cable is unplugged.

Thanks a lot and Best Regards.
Alessandro
 
Old 03-07-2012, 05:29 PM   #8
aus9
LQ 5k Club
 
Registered: Oct 2003
Location: Western Australia
Distribution: Icewm
Posts: 5,842

Rep: Reputation: Disabled
ok I am not sure whats going on so lets try from a different angle...I run sid so some of my files are under /run and I assume you have no /run folder?

ok so when you have the net....run

Code:
su
ifconfig
and look at your line that has ....eth0 Link encap:Ethernet HWaddr your-string

now look for a file called
/etc/udev/rules.d/70-persistent-net.rules

if you don't have one create one and put "your string" and keep the quotes

-------

# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.

# PCI device 0x10ec:0x8139 (8139too)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="xx:xx:xx:xx:xx:xx", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
------------------------------------------

8139too is my kernel module BTW

If you have the file make sure you have a match pls
 
Old 03-08-2012, 06:53 AM   #9
Proboscide99
LQ Newbie
 
Registered: Apr 2010
Posts: 5

Original Poster
Rep: Reputation: 0
Hello!

For some reason I don't know, I do have a /run folder. It's content is as follows:

ls /run
acpid.pid crond.pid gdm3.pid motd rpcbind.sock udev
acpid.socket crond.reboot initctl mount rpc.statd.pid udev-configure-printer
atd.pid cups initramfs ntpd.pid rsyslogd.pid udisks
avahi-daemon dbus kerneloops.pid pm-utils samba utmp
console dnsmasq lock rpcbind sendsigs.omit.d wicd
ConsoleKit exim4 minissdpd.pid rpcbind.lock shm
console-kit-daemon.pid gdm3 minissdpd.sock rpcbind.pid sm-notify.pid


I also have an /etc/udev/rules.d/70-persistent-net.rules file and it already contains a row with the MAC address of the eth0 device:

cat /etc/udev/rules.d/70-persistent-net.rules
# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.

# PCI device 0x10ec:0x8168 (r8169)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:22:15:d2:37:97", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x1814:0x0781 (rt2800pci)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:22:43:13:3a:25", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan0"

The output of ifconfig for eth0 is:

ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:22:15:d2:37:97

Don't forget I discovered that I have a three weeks old backup where the eth0 problem is not present, in case you think it might help comparing some files.

It would just take less than one hour to backup / restore old / restore current.

Ciao and Thanks a Lot!
Alessandro
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
beginning interface eth0 : device eth0 has different MAC address to expected.FAILED petrofrontier Linux - Software 2 02-28-2011 11:09 AM
[SOLVED] invalid eth0:1 interface and strange pan0 interface w1k0 Linux - Networking 8 10-16-2010 09:54 AM
ERROR: The interface does not exist (UBUNTU) interface eth0 not configured anshulbhatt Linux - Networking 2 11-20-2008 12:23 PM
Bringing up interface eth0 Delaying eth0 initialization. [ FA bansal_ashok Linux - Networking 4 05-27-2005 10:09 AM
Bringing up interface eth0: determining ip information for eth0... failed ralphethomas Linux - Networking 0 01-24-2004 05:33 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 05:31 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration