Network Unreachable - Ethernet
In Ubuntu 18.04 and later, ifup/down, implemented by /etc/network/interfaces
, is replaced by netplan
. Therefore, please revert the faulty entries. From the terminal:
sudo nano /etc/network/interfaces
Take out all the entries except:
auto lo
iface lo inet loopback
Save (Ctrl+o followed by Enter) and exit (Ctrl+x) the text editor.
Next, let's clean up your netplan file:
sudo nano /etc/netplan/01-netcfg.yaml
Change the file to read:
network:
version: 2
renderer: networkd
ethernets:
enp3s0:
addresses:
- 192.168.1.101/24
gateway4: 192.168.1.1
nameservers:
addresses: [192.168.1.1, 8.8.8.8]
Netplan is very specific about indentation and spacing. Please proofread carefully twice. Follow with:
sudo netplan generate
sudo netplan apply
After these changes, reboot and let us see:
ip addr show
ping -c3 www.ubuntu.com
Related videos on Youtube
ExecutionByFork
Updated on September 18, 2022Comments
-
ExecutionByFork over 1 year
I'm trying to get my new Ubuntu Server install connected to the internet, but Im running into an issue. I cant even ping the router that the server is directly plugged into via Ethernet. I've tried looking at a number of forums and setting the OS to use DHCP, setting static IPs, etc. And now I am here. Hoping that someone can point out where my problem lies.
This is a fresh install of Ubuntu Server version 18.04.3
Command outputs (note, typing this on a phone):
$ ifconfig enp3s0: flags=4163<UP, BROADCAST, RUNNING, MULTICAST> mtu 1500 inet6 <IPv6address1> prefix 64 scopeid 0x0 inet6 <IPv6address2> prefix 64 scopeid 0x20 ether <macHere> ...
point is, ethernet iface is up, but no IPv4 listed. Only other interface is
lo
.$ cat /etc/network/interfaces auto lo iface lo inet loopback auto enp3s0 iface enp3s0 inet static #Ive tried dhcp here in place of static, without the following lines address 192.168.1.101 netmask 255.255.255.0 network 192.168.1.0 broadcast 192.168.1.255 gateway 192.168.1.1
Router gateway is 192.168.1.1, I've double checked
$ cat /etc/hosts 127.0.0.1 localhost 127.0.1.1 <hostname> ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters
/etc/resolv.conf
is managed bysystemd-resolved
so I would prefer not to manually edit this$ cat /etc/resolv.conf nameserver 127.0.0.53 #??? Don't understand why this is options edns0
$ systemd-resolve --status ... Link 2 (enp3s0) Current Scopes: none LLMNR setting: yes MulticastDNS setting: no DNSSEC setting: no DNSSEC supported: no
ip route show
andip route list
do not print anything to stdoutPlease let me know what I can do to fix this issue. I can edit this post with more output if needed
EDIT: While the potential duplicate question is similar, it does not provide a solution on how to connect to the internet with the tools available on the system (aka netplan). That question is asking how to switch back to
etc/network/interfaces
, and the currently accepted answer is toapt install ifupdown
(which is a brilliant idea considering networking is unavailable).-
Thomas over 4 yearsPossible duplicate of Ubuntu 18.04: switch back to /etc/network/interfaces
-
chili555 over 4 yearsRather than encourage poor ExecutionByFork to revert to ifup/down, I recommend that we instead tell him/her the new way: netplan!
-
-
ExecutionByFork over 4 yearsWorked like a charm. Thank you. I have to say I much prefer the old method than netplan, and I had never even heard of the tool until now. But I suppose it's never a bad thing to learn something new