I've recently upgraded from 18.04 to 20.04 (on a server, no GUI), and since then the server is not able to connect to the internet, pinging the router and other devices in the lan still works.After checking ip route there's no gateway listed.
After running sudo ip route add default via 192.168.0.1
I do have internet connectivity to download packages, however that doesn't persist across reboots or other sessions.
my /etc/netplan/01-netcfg.yaml
looks like this
network:
version: 2
renderer: networkd
ethernets:
eth0:
dhcp4: no
dhcp6: no
addresses:
- 192.168.0.158/24
- "2a02:1810:8474:9600:21e:6ff:fe30:cf4b/64"
- "fe80::21e:6ff:fe30:cf4b/64"
gateway4: 192.168.0.1
nameservers:
addresses:
- 1.1.1.1
- 1.0.0.1
- "2606:4700:4700::1111"
- "2606:4700:4700::1001"
running ip addr
results in this:
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: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:1e:06:30:cf:4b brd ff:ff:ff:ff:ff:ff
inet 192.168.0.158/24 brd 192.168.0.255 scope global eth0
valid_lft forever preferred_lft forever
and ip route
results in this
192.168.0.0/24 dev eth0 proto kernel scope link src 192.168.0.158
no "default via {ip}" there, only after running sudo ip route add default via 192.168.0.1
and then it's only there for the current session or until I reboot.
Anyone know how to fix this so my internet connection stays across reboots?
I've checked on google but nothing seems to work, everyone seems to recommend just setting dhcp4 to "true" and removing everything below that, but I need a static IP.
netplan apply
does not show anything?