Can establish connection, but still get "connect: Network is unreachable"
Based on your ifconfig
output, it looks like the connection is established at the OSI link layer, but that the interface is not assigned an IP address.
There are several possible explanations for that - for example:
- your network does not use DHCP (implying that any other devices are configured with static IP addresses)
- your network is configured to use DHCP, but the DHCP server is not providing an address to this device (perhaps due to a MAC based whitelist or blacklist)
- a firewall is preventing DHCP from working (either disallowing DHCP discovery packets to exit the client, or disallowing DHCP responses from reaching it)
The verbose output from sudo dhclient -v
confirms that your client is at least initiating a DHCP discovery phase - however it terminates abruptly with the mysterious error
Unable to set up timer: out of range
Googling this specific error leads us to the following bug report isc-dhcp-client: Error 'Unable to set up timer: out of range' when system time too far in future, which suggests the problem is that the DHCP client gets confused when the system's hardware clock is out of whack with the DHCP server's.
Correcting the clock offset should fix the issue.
Related videos on Youtube
saladbowl
Updated on September 18, 2022Comments
-
saladbowl over 1 year
I have an Asus E402NA laptop. I installed Ubuntu 16.04 on it. At the end of the installation the installer crashed, but I am still able to boot and start up Ubuntu (not sure if this is helpful information, but that is not the problem I am concerned with right now).
I can see wifi networks, I can connect (and it detects if I use an incorrect password). I see a connection when it gets established. However, when I try to go online, I cannot reach any sites and I cannot ping anything:
$ ping 192.168.0.1 connect: Network is unreachable $ ping 8.8.8.8 connect: Network is unreachable
I tried connecting using ethernet, but the effect is the same. It tells me a connection has been established, but I get the same results for any ping attempts. The same happens when I boot to a live usb, so I don't think it has anything to do with the installation. I tried to run Debian 9.5.0 live usb and the same thing happened when I connected via ethernet. Similarly for running Ubuntu 16.04 live usb.
Here are the outputs of a few commands I ran on the installed Ubuntu 16.04: I ran netstat while connected to a wifi network.
$ netstat -natp Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 1336/cupsd tcp6 0 0 ::1:631 :::* LISTEN 1336/cupsd $ ifconfig -a enp1s0f2 Link encap:Ethernet HWaddr 60:45:cb:bf:bd:2e UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:6836 errors:0 dropped:0 overruns:0 frame:0 TX packets:6836 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:507456 (507.4 KB) TX bytes:507456 (507.4 KB) wlp2s0 Link encap:Ethernet HWaddr f0:03:8c:8f:5d:15 UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) $ route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface $ cat /etc/resolv.conf # Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8) # DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN $ cat /etc/network/interfaces # interfaces(5) file used by ifup(8) and ifdown(8) auto lo iface lo inet loopback
Edit: When running
sudo dhclient -v
:$ sudo dhclient -v Internet Systems Consortium DHCP Client 4.3.3 Copyright 2004-2015 Internet Systems Consortium. All rights reserved. For info, please visit https://www.isc.org/software/dhcp/ Listening on LPF/wlp2s0/f0:03:8c:8f:5d:15 Sending on LPF/wlp2s0/f0:03:8c:8f:5d:15 Listening on LPF/enp1s0f2/60:45:cb:bf:bd:2e Sending on LPF/enp1s0f2/60:45:cb:bf:bd:2e Sending on Socket/fallback DHCPDISCOVER on wlp2s0 to 255.255.255.255 port 67 interval 3 (xid=0x995990e) Unable to set up timer: out of range If you think you have received this message due to a bug rather than a configuration issue please read the section on submitting bugs on either our web page at www.isc.org or in the README file before submitting a bug. These pages explain the proper process and the information we find helpful for debugging.. exiting.
-
steeldriver almost 6 yearsIt looks like the connection is established at the link layer, but the interface has not got an IP address - perhaps it's expecting a DHCP provided one and isn't getting it (does your router enforce a MAC address whitelist, for example?)
-
saladbowl almost 6 yearsHow can I check my router's enforcement of MAC address whitelist? Just to clarify, there are other computers and devices connected to the network and they have no such issues.
-
steeldriver almost 6 yearsWhat happens if you run
sudo dhclient -v
? -
saladbowl almost 6 yearsSee edit at the end of my question. I am not sure what that means.
-
steeldriver almost 6 yearsSo it definitely looks like a DHCP issue - can I ask whether there is anything odd about your system / hardware clock? Does the
date
command give a sensible date / time? Reason I ask is: isc-dhcp-client: Error 'Unable to set up timer: out of range' when system time too far in future -
saladbowl almost 6 yearsYou seem to have hit the nail on the head! Thank you so much! The date was ~10-10-2116. So I ran the following:
hwclock --set --date="2018-07-29 15:45:00" --utc
anddate +%Y%m%d -s "20180729"
. After restarting, I can connect to the internet! Can you post your answer so I can resolve the issue and give you the credit?
-