It seems like this is quite a common problem with Ubuntu, from the other threads I've seen, but I have been unable to find a solution that fixed my issue. I am running a fresh Ubuntu 18 installation plugged in at my office (I work at a local university) and it regularly disconnects. The machine is plugged into an ethernet port via CAT6 in the wall, which runs to a local network switch rack. The machine also has a wifi card that is currently connected to the university's wifi network. Our network admin has noted they haven't seen anything strange on their side. I didn't install any specific ethernet drivers, the network interface worked out of the box. This is a Dell Inspiron 3880 desktop.
The building is around 3-7 years old, so it could potentially be a cabling issue, but I am suspecting it is not. I am unfortunately quite new to Ubunbtu (and network debugging), but am not really sure what next to try. I have access to a Windows machine networked in the same room and it does drop the landline connection but only every few days, making me suspect it is an Ubuntu setting that I am missing. I'm not really sure what is anonymous information, so if I blanked out anything critically important to debug, please let me know.
It seems to disconnect every 5-20 minutes, then will come back after a few minutes. Interestingly, it seems like my ethernet and wifi frequently disconnect at the same time. These timeouts then lead to my SSH to disconnect.
jfslin@pc001:~$ journalctl -u NetworkManager | grep 'timed out'
Dec 15 08:03:49 pc001 NetworkManager[966]: <info> [1608037429.4490] connectivity: (enp1s0) timed out
Dec 15 08:23:49 pc001 NetworkManager[966]: <info> [1608038629.4494] connectivity: (wlp2s0) timed out
Dec 15 08:38:49 pc001 NetworkManager[966]: <info> [1608039529.4497] connectivity: (enp1s0) timed out
Dec 15 08:53:49 pc001 NetworkManager[966]: <info> [1608040429.4493] connectivity: (wlp2s0) timed out
Dec 15 08:53:49 pc001 NetworkManager[966]: <info> [1608040429.4497] connectivity: (enp1s0) timed out
Dec 15 09:03:49 pc001 NetworkManager[966]: <info> [1608041029.4498] connectivity: (enp1s0) timed out
Dec 15 09:08:49 pc001 NetworkManager[966]: <info> [1608041329.4490] connectivity: (wlp2s0) timed out
Dec 15 09:08:49 pc001 NetworkManager[966]: <info> [1608041329.4497] connectivity: (enp1s0) timed out
Dec 15 09:13:49 pc001 NetworkManager[966]: <info> [1608041629.4496] connectivity: (enp1s0) timed out
Dec 15 09:23:49 pc001 NetworkManager[966]: <info> [1608042229.4491] connectivity: (wlp2s0) timed out
Dec 15 09:23:49 pc001 NetworkManager[966]: <info> [1608042229.4497] connectivity: (enp1s0) timed out
Dec 15 09:28:49 pc001 NetworkManager[966]: <info> [1608042529.4493] connectivity: (enp1s0) timed out
Dec 15 09:33:49 pc001 NetworkManager[966]: <info> [1608042829.4490] connectivity: (wlp2s0) timed out
Dec 15 09:33:49 pc001 NetworkManager[966]: <info> [1608042829.4499] connectivity: (enp1s0) timed out
Dec 15 09:38:49 pc001 NetworkManager[966]: <info> [1608043129.4493] connectivity: (wlp2s0) timed out
Dec 15 09:38:49 pc001 NetworkManager[966]: <info> [1608043129.4493] connectivity: (enp1s0) timed out
Dec 15 09:48:49 pc001 NetworkManager[966]: <info> [1608043729.4497] connectivity: (wlp2s0) timed out
Dec 15 09:53:49 pc001 NetworkManager[966]: <info> [1608044029.4490] connectivity: (wlp2s0) timed out
Dec 15 09:53:49 pc001 NetworkManager[966]: <info> [1608044029.4491] connectivity: (enp1s0) timed out
Dec 15 10:03:49 pc001 NetworkManager[966]: <info> [1608044629.4494] connectivity: (enp1s0) timed out
Dec 15 10:08:49 pc001 NetworkManager[966]: <info> [1608044929.4492] connectivity: (wlp2s0) timed out
Dec 15 10:08:49 pc001 NetworkManager[966]: <info> [1608044929.4504] connectivity: (enp1s0) timed out
Dec 15 10:23:49 pc001 NetworkManager[966]: <info> [1608045829.4489] connectivity: (enp1s0) timed out
Dec 15 10:28:49 pc001 NetworkManager[966]: <info> [1608046129.4491] connectivity: (enp1s0) timed out
Dec 15 10:33:49 pc001 NetworkManager[966]: <info> [1608046429.4490] connectivity: (wlp2s0) timed out
I am assigned a static IP by our network admin, which DHCP correctly obtains. I have tried switching from DHCP to static IP, but the behaviour presists. It is currently back on DHCP, as recommended by my admin.
jfslin@pc001:~$ ifconfig
enp1s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet [wired ip] netmask 255.255.255.0 broadcast [wired gateway ip]
ether [wired mac] txqueuelen 1000 (Ethernet)
RX packets 837084 bytes 174008495 (174.0 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 83911 bytes 37182161 (37.1 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
loop txqueuelen 1000 (Local Loopback)
RX packets 2964483 bytes 15855066293 (15.8 GB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2964483 bytes 15855066293 (15.8 GB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlp2s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet [wifi ip] netmask 255.255.128.0 broadcast [wifi gateway ip]
ether [wifi mac] txqueuelen 1000 (Ethernet)
RX packets 11453 bytes 3674081 (3.6 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 13309 bytes 2171764 (2.1 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
jfslin@pc001:~$ ip -c a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether [wired mac] brd ff:ff:ff:ff:ff:ff
inet [wired ip]/24 brd [wired gateway ip] scope global dynamic noprefixroute enp1s0
valid_lft 134294sec preferred_lft 134294sec
3: wlp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether [wifi mac] brd ff:ff:ff:ff:ff:ff
inet [wifi ip]/17 brd [wifi gateway ip] scope global dynamic noprefixroute wlp2s0
valid_lft 19484sec preferred_lft 19484sec
A common theme I read was that IPv6 might be the problem, so I have it disabled via GRUB after noticing that the turning it off from the Network Wired Settings from the GUI didn't do anything. I only have Ubuntu on this machine. I alos pulled the dhcp6 entires from dhclient.config
jfslin@pc001:~$ more /etc/default/grub
GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash ipv6.disable=1"
GRUB_CMDLINE_LINUX="ipv6.disable=1"
jfslin@pc001:~$ more /etc/dhcp/dhclient.conf
option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
send host-name = gethostname();
request subnet-mask, broadcast-address, time-offset, routers,
domain-name, domain-name-servers, domain-search, host-name,
netbios-name-servers, netbios-scope, interface-mtu,
rfc3442-classless-static-routes, ntp-servers;
timeout 300;
A few other settings that are commonly requested:
jfslin@pc001:~$ sudo lshw -C network
*-network
description: Ethernet interface
product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
vendor: Realtek Semiconductor Co., Ltd.
physical id: 0
bus info: pci@0000:01:00.0
logical name: enp1s0
version: 15
serial: [wired mac]
size: 1Gbit/s
capacity: 1Gbit/s
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress msix bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
configuration: autonegotiation=on broadcast=yes driver=r8169 duplex=full firmware=rtl8168h-2_0.0.2 02/26/15 ip=[wired ip] latency=0 link=yes multicast=yes port=MII speed=1Gbit/s
resources: irq:16 ioport:3000(size=256) memory:d1104000-d1104fff memory:d1100000-d1103fff
*-network
description: Wireless interface
product: Wireless 3165
vendor: Intel Corporation
physical id: 0
bus info: pci@0000:02:00.0
logical name: wlp2s0
version: 79
serial: [wifi mac]
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless
configuration: broadcast=yes driver=iwlwifi driverversion=5.4.0-56-generic firmware=29.1044073957.0 ip=[wifi ip] latency=0 link=yes multicast=yes wireless=IEEE 802.11
resources: irq:129 memory:d1000000-d1001fff
jfslin@pc001:~$ dpkg -l *dnsmasq*
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-=========================================-=========================-=========================-=======================================================================================
un dnsmasq <none> <none> (no description available)
ii dnsmasq-base 2.79-1 amd64 Small caching DNS proxy and DHCP/TFTP server
un dnsmasq-base-lua <none> <none> (no description available)
jfslin@pc001:~$ ls -al /etc/resolv.conf
lrwxrwxrwx 1 root root 39 Nov 30 15:01 /etc/resolv.conf -> ../run/systemd/resolve/stub-resolv.conf
jfslin@pc001:~$ lspci -nnk | grep 0200 -A2
01:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller [10ec:8168] (rev 15)
Subsystem: Dell RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller [1028:09b6]
Kernel driver in use: r8169
jfslin@pc001:~$ dmesg | grep r8169
[no content]
jfslin@pc001:~$ systemctl status NetworkManager.service --no-pager -l
● NetworkManager.service - Network Manager
Loaded: loaded (/lib/systemd/system/NetworkManager.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2020-12-15 10:50:40 EST; 16min ago
Docs: man:NetworkManager(8)
Main PID: 2543 (NetworkManager)
Tasks: 6 (limit: 4915)
CGroup: /system.slice/NetworkManager.service
├─2543 /usr/sbin/NetworkManager --no-daemon
├─2567 /sbin/dhclient -d -q -sf /usr/lib/NetworkManager/nm-dhcp-helper -pf /run/dhclient-enp1s0.pid -lf /var/lib/NetworkManager/dhclient-a9da0b86-eff3-30c4-acd5-dd333e4b87c4-enp1s0.lease -cf /var/lib/NetworkManager/dhclient-enp1s0.conf enp1s0
└─2691 /sbin/dhclient -d -q -sf /usr/lib/NetworkManager/nm-dhcp-helper -pf /run/dhclient-wlp2s0.pid -lf /var/lib/NetworkManager/dhclient-dc91afb3-030f-4cd3-9363-7b24d499b3e1-wlp2s0.lease -cf /var/lib/NetworkManager/dhclient-wlp2s0.conf wlp2s0
Dec 15 10:50:44 pc001 NetworkManager[2543]: <info> [1608047444.9669] dhcp (wlp2s0): domain search '[uni].ca.'
Dec 15 10:50:44 pc001 NetworkManager[2543]: <info> [1608047444.9669] dhcp (wlp2s0): domain search '[sub1.uni].ca.'
Dec 15 10:50:44 pc001 NetworkManager[2543]: <info> [1608047444.9669] dhcp (wlp2s0): domain search '[sub2.uni].ca.'
Dec 15 10:50:44 pc001 NetworkManager[2543]: <info> [1608047444.9669] dhcp4 (wlp2s0): state changed unknown -> bound
Dec 15 10:50:44 pc001 NetworkManager[2543]: <info> [1608047444.9706] device (wlp2s0): state change: ip-config -> ip-check (reason 'none', sys-iface-state: 'managed')
Dec 15 10:50:44 pc001 NetworkManager[2543]: <info> [1608047444.9723] device (wlp2s0): state change: ip-check -> secondaries (reason 'none', sys-iface-state: 'managed')
Dec 15 10:50:44 pc001 dhclient[2691]: bound to [wifi ip] -- renewal in 10196 seconds.
Dec 15 10:50:44 pc001 NetworkManager[2543]: <info> [1608047444.9729] device (wlp2s0): state change: secondaries -> activated (reason 'none', sys-iface-state: 'managed')
Dec 15 10:50:44 pc001 NetworkManager[2543]: <info> [1608047444.9808] device (wlp2s0): Activation: successful, device activated.
Dec 15 10:50:44 pc001 NetworkManager[2543]: <info> [1608047444.9826] manager: startup complete
jfslin@pc001:~$ cat /etc/resolv.conf
nameserver 127.0.0.53
options edns0
search [uni].ca [sub1.uni].ca [sub2.uni].ca
I saw that someone had an issue where their IP was taken by another machine when the computer is down. Pinging my static IP when I lose connection does not resolve, suggesting this is not the problem. (https://unix.stackexchange.com/questions/211931/intermittent-network-disconnection-ubuntu-troubleshooting)
Summary of things I've tried:
- Set a static IP instead of DHCP -> didn't seem to help. Currently on DHCP
- Disable IPv6, as noted WiFi randomly disconnected on Ubuntu 18.04 LTS
- Disable the wifi -> didn't seem to help. Currently on
- Disable the Bluetooth -> didn't seem to help. Currently off
- Tried a different port and cable -> though, if it is a building problem, there's a limited amount of things I can do about this
- /etc/NetworkManager/NetworkManager.conf, managed=false -> managed=true, as noted "Wired Network Disconnected" even when connected- no ethernet connection possible
- Computer is set to never automatically suspend, so I don't think it's the issue described here: Ubuntu 18.04 - Ethernet disconnected after suspend
Thank you.
EDIT1:
I found these entries in journalctl. Maybe it's a UFW firewall problem, dropping me from CONNECT_GLOBAL (internet) to CONNECT_SITE (local network connection only?)
Dec 16 08:25:16 pc001 NetworkManager[990]: <info> [1608125116.8809] connectivity: (enp1s0) timed out
Dec 16 08:25:16 pc001 NetworkManager[990]: <info> [1608125116.8810] manager: NetworkManager state is now CONNECTED_SITE
Dec 16 08:25:16 pc001 dbus-daemon[977]: [system] Activating via systemd: service name='org.freedesktop.nm_dispatcher' unit='dbus-org.freedesktop.nm-dispatcher.service' requested by ':1.14' (uid=0 pid=990 comm="/usr/sbin/NetworkMan
Dec 16 08:25:16 pc001 whoopsie[1706]: [08:25:16] offline
Dec 16 08:25:16 pc001 systemd[1]: Starting Network Manager Script Dispatcher Service...
Dec 16 08:25:16 pc001 dbus-daemon[977]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
Dec 16 08:25:16 pc001 systemd[1]: Started Network Manager Script Dispatcher Service.
Dec 16 08:25:16 pc001 nm-dispatcher[25655]: req:1 'connectivity-change': new request (1 scripts)
Dec 16 08:25:16 pc001 nm-dispatcher[25655]: req:1 'connectivity-change': start running ordered scripts...
Dec 16 08:25:53 pc001 kernel: [UFW BLOCK] IN=enp1s0 OUT= MAC=[some mac] SRC=[gateway ip] DST=224.0.0.1 LEN=32 TOS=0x00 PREC=0xC0 TTL=1 ID=24289 PROTO=2
Dec 16 08:26:53 pc001 kernel: [UFW BLOCK] IN=enp1s0 OUT= MAC=[some mac] SRC=[gateway ip] DST=224.0.0.1 LEN=32 TOS=0x00 PREC=0xC0 TTL=1 ID=24527 PROTO=2
Dec 16 08:27:53 pc001 kernel: [UFW BLOCK] IN=enp1s0 OUT= MAC=[some mac] SRC=[gateway ip] DST=224.0.0.1 LEN=32 TOS=0x00 PREC=0xC0 TTL=1 ID=24852 PROTO=2
Dec 16 08:28:53 pc001 kernel: [UFW BLOCK] IN=enp1s0 OUT= MAC=[some mac] SRC=[gateway ip] DST=224.0.0.1 LEN=32 TOS=0x00 PREC=0xC0 TTL=1 ID=25091 PROTO=2
Dec 16 08:29:51 pc001 NetworkManager[990]: <info> [1608125391.2623] manager: NetworkManager state is now CONNECTED_GLOBAL
Dec 16 08:29:51 pc001 dbus-daemon[977]: [system] Activating via systemd: service name='org.freedesktop.nm_dispatcher' unit='dbus-org.freedesktop.nm-dispatcher.service' requested by ':1.14' (uid=0 pid=990 comm="/usr/sbin/NetworkMan
Dec 16 08:29:51 pc001 systemd[1]: Starting Network Manager Script Dispatcher Service...
Dec 16 08:29:51 pc001 whoopsie[1706]: [08:29:51] The default IPv4 route is: /org/freedesktop/NetworkManager/ActiveConnection/1
Dec 16 08:29:51 pc001 whoopsie[1706]: [08:29:51] Not a paid data plan: /org/freedesktop/NetworkManager/ActiveConnection/1
Dec 16 08:29:51 pc001 whoopsie[1706]: [08:29:51] Found usable connection: /org/freedesktop/NetworkManager/ActiveConnection/1
Dec 16 08:29:51 pc001 dbus-daemon[977]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
Dec 16 08:29:51 pc001 systemd[1]: Started Network Manager Script Dispatcher Service.
Dec 16 08:29:51 pc001 nm-dispatcher[30766]: req:1 'connectivity-change': new request (1 scripts)
Dec 16 08:29:51 pc001 nm-dispatcher[30766]: req:1 'connectivity-change': start running ordered scripts...
[...snip some long log message aboug gdm3...]
Dec 16 08:29:52 pc001 whoopsie[1706]: [08:29:52] online
Dec 16 08:29:53 pc001 kernel: [UFW BLOCK] IN=enp1s0 OUT= MAC=[some mac] SRC=[gateway ip] DST=224.0.0.1 LEN=32 TOS=0x00 PREC=0xC0 TTL=1 ID=25365 PROTO=2
Dec 16 08:30:53 pc001 kernel: [UFW BLOCK] IN=enp1s0 OUT= MAC=[some mac] SRC=[gateway ip] DST=224.0.0.1 LEN=32 TOS=0x00 PREC=0xC0 TTL=1 ID=26415 PROTO=2
Dec 16 08:31:53 pc001 kernel: [UFW BLOCK] IN=enp1s0 OUT= MAC=[some mac] SRC=[gateway ip] DST=224.0.0.1 LEN=32 TOS=0x00 PREC=0xC0 TTL=1 ID=26829 PROTO=2
Dec 16 08:32:53 pc001 kernel: [UFW BLOCK] IN=enp1s0 OUT= MAC=[some mac] SRC=[gateway ip] DST=224.0.0.1 LEN=32 TOS=0x00 PREC=0xC0 TTL=1 ID=27101 PROTO=2
Dec 16 08:33:53 pc001 kernel: [UFW BLOCK] IN=enp1s0 OUT= MAC=[some mac] SRC=[gateway ip] DST=224.0.0.1 LEN=32 TOS=0x00 PREC=0xC0 TTL=1 ID=27381 PROTO=2
Dec 16 08:34:53 pc001 kernel: [UFW BLOCK] IN=enp1s0 OUT= MAC=[some mac] SRC=[gateway ip] DST=224.0.0.1 LEN=32 TOS=0x00 PREC=0xC0 TTL=1 ID=27660 PROTO=2
Dec 16 08:35:16 pc001 NetworkManager[990]: <info> [1608125716.9100] connectivity: (enp1s0) timed out
Dec 16 08:35:16 hcrmiserv001 NetworkManager[990]: <info> [1608125716.9101] manager: NetworkManager state is now CONNECTED_SITE
jfslin@pc001:~$ sudo ufw status verbose
Status: active
Logging: on (low)
Default: deny (incoming), allow (outgoing), disabled (routed)
New profiles: skip
To Action From
22/tcp ALLOW IN Anywhere
80/tcp ALLOW IN Anywhere
443/tcp ALLOW IN Anywhere