It looks like a problem with routing. Please attach here a list of command responses:
ip route
ip neigh
The first displays the routing table entries, the second shows the neighbors in the local network.
Perhaps a line with the following content is missing from the routing list (by ip route
):
default via 192.168.0.1 dev wlp36s0 proto dhcp metric 100
This is just an example. Your machine must have information about the address of the router through which to communicate out from LAN into the Internet. It is the so-called default gateway.
EDIT 1
Your other attached listings showed several problems.
Further analysis
Please enclose here the settings of your interfaces. They are in files in the directory /etc/NetworkManager/system-connections/
. Summary listing is possible by command below (it is necessary to confirm the continuation to the next file with the space bar):
sudo more /etc/NetworkManager/system-connections/*
I believe that there is an error in your network in the form of a collision of two identical IP addresses, MAC addresses, two DHCP servers or something similar, which is manifested by alternating states when communication works and when it does not.
You should to perform the three diagnostic commands repeatedly to get a response in a state where the connection is working and then in a state where it does not work.
ip addr
ip route
ip neigh
By comparing the results and finding differences, we could move forward in finding the cause of the defect. At the same time in another terminal window on Ubuntu, you can have a ping e.g. on 8.8.8.8 to see if the connection out works or not.
Please also check the DHCP server settings on your router. Just check if there is a record for the MAC address of your Ubuntu and if there is a static IP address reservation for the given Ubuntu MAC eventually. The MAC address can be found using the ip addr
command on an Ubuntu PC (search for link/ether clause).
Default gateway problem
You have not one, but three default gateways. This is wrong. Only in special circumstances is a different number used.
The item with the lowest metric number prevails when there are multiple routes for the same network. It is the Ethernet. Its metric is 100. But it looks your enp37s0 Ethernet interface is set up incorrectly by DHCP server, it should not have two default gateways (routes).
One gateway disappears when you turn off the Wi-Fi network interface.
It would be interesting to see the details of DHCP communication between the DHCP server and your Ubuntu. You can capture packets by using the tcpdump command. Details will be provided on request.
Two interfaces in the same time
I see that your Ubuntu PC has two interfaces that are connected to the same network 192.168.0.0/23 in the same time:
- Ethernet
enp37s0
- Wi-Fi
wlp36s0
This is not a good situation at all for diagnosing a problem. Please do tests with only one interface until the problem is resolved.
Question: Atypical netmask
Why do you use a netmask with a length of 23 bits, i.e. 255.255.254.0 instead of usual 24 bits? Is this intentional or inadvertent? I don't suppose you have, for example, 300 computers at home to use big network. It's entirely up to you, but the same mask must be set really on all devices. Then everything will work properly. Difference will cause a problem.
EDIT 2
Please try to configure the IP address and default route of the Ubuntu PC manually. When the setup works, we start analyzing DHCP. Do not worry, changes in manual settings using CLI remain only in RAM, after restarting the PC all changes disappears.
Status before changing, deleting old settings, status after change
ip addr
ip route
sudo ip route del default via 192.168.0.1 dev enp37s0
sudo ip route del 192.168.0.0/23 dev enp37s0 proto kernel scope link src 192.168.0.61
sudo ip addr del 192.168.0.61/23 dev enp37s0
ip addr
ip route
Verify old route and old IP address are not present.
New settings, status after change
sudo ip addr add 192.168.0.61/23 dev enp37s0 brd 192.168.1.255
sudo ip route add default via 192.168.0.1 dev enp37s0
ip add
ip route
ping -c 3 192.168.0.1
ping -c 3 1.1.1.1
Does the new setting work? Is the status stable or will communication to the Internet be interrupted again after some time?
EDIT 3
It's time to analyze network packets. The following tcpdump
command captures the three types of communication needed for parsing:
Diagnosis #1
in a state with a malfunctioning connection to the Internet.
Turn off the W-Fi interface if it is on. Open two terminal windows on Ubutnu PC.
Terminal 1:
Create a subdirectory to record captured packets in your home directory, and start the capture. A bad.pcap
file is created for a state in which the connection to the Internet does not work.
mkdir ~/capture
sudo tcpdump -i enp37s0 "icmp or udp port 67 or udp port 68 or arp" -s 0 -w ~/capture/bad.pcap
Terminal 2:
Save the network status info:
cd ~/capture
ip add >> bad.txt
ip rou >> bad.txt
ip nei >> bad.txt
Verify connectivity and save the results to the same file state1.txt
:
ping -c 3 192.168.0.1 | tee -a bad.txt
ping -c 3 1.1.1.1 | tee -a bad.txt
Release and renew dynamic IP address of the PC.
sudo dhclient -r enp37s0
sudo dhclient enp37s0
Verify connectivity again:
ping -c 3 192.168.0.1 | tee -a bad.txt
ping -c 3 1.1.1.1 | tee -a bad.txt
Go back to the first terminal window.
Terminal 1:
Stop the tcpdump
command using Ctrl C
.
Copy and save the bad.pcap
and bad.txt
files from your computer.
Diagnosis #2
in a state with a functional connection to the Internet.
Use ip addr
to find out the name of the Ethernet interface, if it has changed, correct it in the following commands.
Terminal 1:
A good.pcap
file is created for a state in which the connection to the Internet works, for instance after the Ubuntu is booted from Live USB Flash disk.
mkdir ~/capture
sudo tcpdump -i enp37s0 "icmp or udp port 67 or udp port 68 or arp" -s 0 -w ~/capture/good.pcap
Terminal 2:
Save the network status info:
cd ~/capture
ip add >> good.txt
ip rou >> good.txt
ip nei >> good.txt
Verify connectivity and save the results to the same file good.txt
:
ping -c 3 192.168.0.1 | tee -a good.txt
ping -c 3 1.1.1.1 | tee -a good.txt
Release and renew dynamic IP address of the PC.
sudo dhclient -r enp37s0
sudo dhclient enp37s0
Verify connectivity again:
ping -c 3 192.168.0.1 | tee -a good.txt
ping -c 3 1.1.1.1 | tee -a good.txt
Go back to the first terminal window.
Terminal 1:
Stop the tcpdump
command using Ctrl C
.
Copy and save the good.pcap
and good.txt
files from your computer before you shut down the PC.
Final steps
Save all 4 files to a ZIP archive and make it available for detailed analysis. You can open and view the .pcap
files using the Wireshark application.
It is necessary to check not only the L3 layer, but also the L2 for any discrepancy in MAC addresses. Analysis of ARP and perhaps DHCP packets could tell us something. It is also need to pay attention to all kinds of ICMP messages, not just the echo request and the echo reply.
If you don't want to submit your diagnostic data publicly, email it to me.