Ubuntu: Network (LAN) stops working randomly - reconnecting helps



Question:

I randomly have the problem on my 15.04 that the Internet connection via LAN stops working. This often happens directly after boot, but sometimes also just in the middle of a surfing session without any special actions.

My applications (Firefox, Skype, ...) report no network access, and both ping google.com and ping 8.8.8.8 also give up, as well as pinging my router (ping 192.168.0.1).

What I do if this connection loss is happening is that I click on the network indicator and select "Disconnect", wait a second and reconnect the same connection. After this procedure everything seems fine again.
Today it also went away by itself after some minutes, but some more connection breaks followed.

How can I troubleshoot this problem? What do I have to observe when it occurs next time to give you the important information? How will I finally be able to prevent such connection losses or can I at least have a workaround that automatically detects and solves it?


Update 1:

$ sudo lshw -C network    *-network                        description: Ethernet interface         product: 82573L Gigabit Ethernet Controller         vendor: Intel Corporation         physical id: 0         bus info: pci@0000:02:00.0         logical name: eth0         version: 00         serial: 00:17:31:a1:f5:fa         size: 100Mbit/s         capacity: 1Gbit/s         width: 32 bits         clock: 33MHz         capabilities: pm msi pciexpress bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation         configuration: autonegotiation=on broadcast=yes driver=e1000e driverversion=2.3.2-k duplex=full firmware=0.5-7 ip=192.168.0.107 latency=0 link=yes multicast=yes port=twisted pair speed=100Mbit/s         resources: irq:24 memory:cfee0000-cfefffff ioport:c800(size=32)  

Update 2:

Content of /var/log/syslog around the time of the last connection failure:

Jul 12 16:14:23 MaxData-Desktop-Ubuntu kernel: [ 5298.718729] [UFW BLOCK] IN=eth0 OUT= MAC=01:00:5e:00:00:01:24:65:11:25:b0:0c:08:00 SRC=192.168.0.1 DST=224.0.0.1 LEN=36 TOS=0x00 PREC=0xC0 TTL=1 ID=0 DF PROTO=2   Jul 12 16:15:07 MaxData-Desktop-Ubuntu whoopsie[670]: [16:15:07] Cannot reach: https://daisy.ubuntu.com  Jul 12 16:15:07 MaxData-Desktop-Ubuntu whoopsie[670]: [16:15:07] offline  Jul 12 16:15:27 MaxData-Desktop-Ubuntu whoopsie[670]: [16:15:27] Cannot reach: https://daisy.ubuntu.com  Jul 12 16:15:47 MaxData-Desktop-Ubuntu whoopsie[670]: [16:15:47] Cannot reach: https://daisy.ubuntu.com  Jul 12 16:16:07 MaxData-Desktop-Ubuntu whoopsie[670]: [16:16:07] Cannot reach: https://daisy.ubuntu.com  Jul 12 16:16:28 MaxData-Desktop-Ubuntu kernel: [ 5423.720176] [UFW BLOCK] IN=eth0 OUT= MAC=01:00:5e:00:00:01:24:65:11:25:b0:0c:08:00 SRC=192.168.0.1 DST=224.0.0.1 LEN=36 TOS=0x00 PREC=0xC0 TTL=1 ID=0 DF PROTO=2   Jul 12 16:16:30 MaxData-Desktop-Ubuntu whoopsie[670]: [16:16:30] Cannot reach: https://daisy.ubuntu.com  Jul 12 16:16:50 MaxData-Desktop-Ubuntu whoopsie[670]: [16:16:50] Cannot reach: https://daisy.ubuntu.com  Jul 12 16:17:01 MaxData-Desktop-Ubuntu CRON[9122]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)  Jul 12 16:17:10 MaxData-Desktop-Ubuntu whoopsie[670]: [16:17:10] Cannot reach: https://daisy.ubuntu.com  Jul 12 16:18:33 MaxData-Desktop-Ubuntu kernel: [ 5548.718565] [UFW BLOCK] IN=eth0 OUT= MAC=01:00:5e:00:00:01:24:65:11:25:b0:0c:08:00 SRC=192.168.0.1 DST=224.0.0.1 LEN=36 TOS=0x00 PREC=0xC0 TTL=1 ID=0 DF PROTO=2   Jul 12 16:20:38 MaxData-Desktop-Ubuntu kernel: [ 5673.717889] [UFW BLOCK] IN=eth0 OUT= MAC=01:00:5e:00:00:01:24:65:11:25:b0:0c:08:00 SRC=192.168.0.1 DST=224.0.0.1 LEN=36 TOS=0x00 PREC=0xC0 TTL=1 ID=0 DF PROTO=2   Jul 12 15:12:48 MaxData-Desktop-Ubuntu gnome-session[6329]: message repeated 2 times: [ debconf: DbDriver "passwords" warning: could not open /var/cache/debconf/passwords.dat: Keine Berechtigung]  Jul 12 16:21:53 MaxData-Desktop-Ubuntu gnome-session[6329]: (process:9144): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed  Jul 12 16:22:23 MaxData-Desktop-Ubuntu whoopsie[670]: [16:22:23] online  Jul 12 16:22:23 MaxData-Desktop-Ubuntu kernel: [ 5778.310686] [UFW BLOCK] IN=eth0 OUT= MAC=00:17:31:a1:f5:fa:24:65:11:25:b0:0c:08:00 SRC=198.252.206.25 DST=192.168.0.107 LEN=110 TOS=0x00 PREC=0x00 TTL=50 ID=50591 DF PROTO=TCP SPT=443 DPT=54409 WINDOW=33 RES=0x00 ACK PSH URGP=0   

Before and after this snippet are more [UFW BLOCK] lines, but they don't seem suspicious to me. I have similar lines in dmesg, but nothing more.


Solution:1

First, identify the driver for your network device with the command:

lshw -C network  

Look for driver=.

Next, check the log for clues as to why the device disconnects. I suggest you look at both the driver and what Network Manager is doing:

cat /var/log/syslog | grep -e some_driver -e etwork | tail -n 20  

Ideally, run this just as the internet connection has dropped.

Then I suggest you search this site and Google for your driver name and "disconnects" for possible solutions. You might also edit your question to add additional details and we'll be happy to assist.

If you wish to post your syslog result, as it will be lengthy, post it here and give us the link: http://paste.ubuntu.com

You have confirmed the infamous e1000e. There are several things you might try. The probable solution that seems to work often, but not always, is to disable gigabit speeds. You can try temporarily with:

sudo ethtool --change eth0 speed 100 autoneg off  

If this is helpful, we will drop the parameters into rc.local to make them persistent.


Solution:2

For whatever reason, these issues became rarer in recent time.

Besides that, whenever it occurs, I run the following command to disconnect and reconnect:

nmcli con down "CONNECTION NAME" && nmcli con up "CONNECTION NAME"  

To speed typing up, I've created an alias for it, by appending the following line to my ~/.bashrc file:

alias reconnect='nmcli con down "CONNECTION NAME" && nmcli con up "CONNECTION NAME"'  


Solution:3

What you describe seems like dhcp lease issue. When you connect to the router, dhcp gives you ip for some particular amount of time ( that's what's called lease ), and then that gets renewed.

For example, here's what I have in my syslog:

$ grep 'renew' /var/log/syslog Jun 30 20:38:01 anaconda dhclient: bound to 192.168.43.209 -- renewal in 1342 seconds.

My assumption,then, is that you still have the IP, so your machine is reported as connected, but in fact the lease hasn't been renewed or has glitched/failed.

What I suggest is try switching the dhcp client that you're using. NetworkManager comes with dhclient by default, if I am not wrong. You can try to install dhcpcd (for other options check apt-cache search dhcp). Why I suggest this one is because man NetworkManager.conf says that's the supported one (along with the default one ,dhclient).

Then in /etc/NetworkManager/NetworkManager.conf you're gonna need this line dhcp=dhcpd , bellow [main]. For example,

[main]  plugins=ifupdown,keyfile,ofono  dns=dnsmasq  dhcp=dhcpcd    [ifupdown]  managed=false  

I've had the issue like that where network icon says connected but in fact it's stopped working, but I've realized what's going on only recently, because I'm slowly learning about networking. I won't say that's 100% bulletproof solution, but that's what i can suggest. At least I haven't experienced this issue much after playing around with my dhcp client settings.

Also, try disabling ipv6, disable the n-channel wifi (if your card supports it), and power management as suggested in this article: http://itsfoss.com/speed-up-slow-wifi-connection-ubuntu/ These hacks mostly work for speed, but they won't hurt


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »