Routing disappears

I have a ThinkPad X1 Carbon Gen 1 with which I access the Internet either via a USB tether from a phone or a USB-RJ45 adapter connected to my LAN.

When using the RJ45 adapter it gets it's IP address from my dnsmasq dhcp server.

Am I correct in thinking that it creates a default route at the same time as providing an IP address?

What I'm finding is the routing sometimes disappears, sometimes after a few minutes, sometimes after much longer, and is only restored when I run route add default 192.168.1.1. I don't see this problem on other hosts on my LAN.

What could cause this?
 
A few minutes ago:-


Code:
ue0: link state changed to DOWN
ue0: link state changed to UP
ue0: link state changed to DOWN
ue0: 3 link states coalesced
ue0: link state changed to UP
root@X1:~ $ ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
ping: sendto: No route to host
ping: sendto: No route to host

What does this mean?

ue0: 3 link states coalesced
 
This means that your interface goes up/down at the same time (interface flap rapidly). It may be caused by bad cable, adapter reset ,driver issue or the other end (switch port). After this you lost all DHCP routes so you need to renew the DHCP least or use static ip and route.
Do you have another USB->ethernet adapter?
Can you try with another shorter Ethernet cable?
 
The same problem occured with two other adapters.

I'm re-arranging my furniture to try a shorter cable. The one I was using was 3m.

Is there any way to monitor the state of the interface so that an alert is created when the interface goes down?

I'll use an older system which does have a builtin RJ45 port and connect it to the long cable and see if that system experiences the same problem.
 
Am I correct in thinking that it creates a default route at the same time as providing an IP address?
That's typically how you configure the range on the DHCP server, yes. But it's not required though, so it might be missing. And the client can also be configured to ignore the 'routers' option. But this has to be explicitly configured, by default dhclient(8) will accept the IP, netmask, routers and DNS.

I'm re-arranging my furniture to try a shorter cable. The one I was using was 3m.
Cat 5e ethernet cable can be up to 100 meter long for 1Gb/s without issues. Assuming the cable itself isn't damaged. That damage may or may not be visible though, people sometimes yank on the cable and pull apart one (or more) of the 8 wires inside the cable. Gigabit ethernet needs all 4 pairs in the cable to function properly. Cables get yanked, pulled, twisted and whatnot, which could damage any one of the wires inside the cable.
 
I'm using the long cable to connect to a ThinkPad X61 and the connection is steady, so I don't think the cable has a significant effect, although it might have some.

The laptop where the problem occurs is now connected by a much shorter cable although the problem has re-occured but not as frequently.

dmesg has a lot of messages saying 2/3/4 link states coalesced. I guess this occurs around the time the link changes to down.
 
I'm suspecting that there's an issue with the USB adapter. You can try to force it to 100Mbps to see if that helps.
I have these three adapters and was wondering if they needed specific drivers...

Code:
Bus /dev/usb Device /dev/ugen1.6: ID 17ef:7205 Lenovo Thinkpad LAN
Bus /dev/usb Device /dev/ugen1.7: ID 0bda:8152 Realtek Semiconductor Corp. RTL8152 Fast Ethernet Adapter
Bus /dev/usb Device /dev/ugen1.7: ID 0bda:8153 Realtek Semiconductor Corp. RTL8153 Gigabit Ethernet Adapter

The problem seems to have diminished since I started using a shorter cable. but I was wondering if there was a way to monitor the interface going down and triggering some sort of action.
 
I was wondering if there was a way to monitor the interface going down and triggering some sort of action.
It's logged in /var/log/messages. But you can also create some devd.conf(5) actions that trigger on the interface going up and/or down. I've used this to monitor a CARP interface switching from MASTER to BACKUP or vise versa.
 
Am I correct in thinking that it creates a default route at the same time as providing an IP address?
You can check exactly what information your dnsmasq server is providing to the laptop using

Code:
nmap --script broadcast-dhcp-discover -e ue0

There'd normally be a Router: line in the output (which takes a few seconds to be delivered in my homelab).
 
It's logged in /var/log/messages. But you can also create some devd.conf(5) actions that trigger on the interface going up and/or down. I've used this to monitor a CARP interface switching from MASTER to BACKUP or vise versa.
Do you mean something like this:-
Code:
       #
       # This will catch link down events on the interfaces fxp0 and ath0
       #
       notify 0    {
           match "system"               "IFNET";
           match "subsystem"           "(ue0)";
           match "type"               "LINK_DOWN";
           action "logger $subsystem is DOWN";
       };
 
Subsystem would probably be "ue0" in your case, but yes, that's the idea.
I actually have "ue0" in the code snippet. I didn't change the comments.

To actually use the snippet, should I just add it to the end of /etc/devd.conf and run service devd restart?

Also in the action line I thought of adding 'dhclient ue0' to restore connectivity.
 
Back
Top