2

sorry if this is trivial ... but I do not seem to be able to get netplan to set the proper route to the default gateway. I have to manually set it using 'sudo route add default gw [...]' to enable the server to reach the internet.

This is my current netplan configuration (in /etc/netplan/00-installer-config.yaml):


network:
  version: 2
  renderer: networkd  
  ethernets:
    eno1:
      dhcp4: no
    eno2:
      dhcp4: no
    enp33s0f0:
      dhcp4: no
    enp33s0f1:
      dhcp4: no
    ens1f0:
      addresses:
        - [xxx].[yy].[zz].124/29
      routes:
        - to: default
          via: [xxx].[yy].[zz].121
      nameservers:
        addresses: [redacted]
      dhcp4: no
      dhcp6: no
    ens1f1:
      dhcp4: no


This sets the IP-number correctly, and I can connect from a neighboring server. However, 'route -n' only shows this:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
[xxx].[yy].[zz].120   0.0.0.0         255.255.255.248 U     0      0        0 ens1f0

... meaning there is no route to the actual gateway. I have to manually set it using the 'route' command, like so:

sudo route add default gw [xxx].[yy].[zz].121 ens1f0

... then everything is fine, including DNS; but this does not survive reboot. Any idea what I am doing wrong? I have tried using the 'on-link: true' setting, but that did not work either.

Thank you very much for any help / insights !

CvM_curious
  • 21
  • 1
  • 2

2 Answers2

0

I just tested your exact configuration file on a fully patched ubuntu 22.04 server and only adjusted the interface name and IP addresses and this is working perfectly.

Perhaps a silly question but did you do a: "netplan apply" after your configuration changes?

proxx
  • 121
  • 6
  • Dear proxx, yes I did. Before "netplan apply", this is what "ip route" reports (it includes the route that I had to add manually): default via [xxx].[yy].[zz].121 dev ens1f0 [xxx].[yy].[zz].120/29 dev ens1f0 proto kernel scope link src [xxx].[yy].[zz].124 after running "sudo netplan apply", the first line is removed: [xxx].[yy].[zz].120/29 dev ens1f0 proto kernel scope link src [xxx].[yy].[zz].124 – CvM_curious Dec 16 '22 at 14:17
  • YAML uses true or false instead of no/yes. Really the only thing looking funny, also a wild trailing space but that should not cause issues. yamllint complained about it and its right! – proxx Dec 16 '22 at 15:02
  • one more observation: whenever I run "netplan apply", about two seconds later I see a bunch of lines like this in the syslog. Could this be an issue ? Dec 16 14:20:41 sirius ModemManager[2362]: [base-manager] couldn't check support for device '/sys/devices/pci0000:20/0000:20:03.1/0000:21:00.0': not supported by any plugin Dec 16 14:20:41 [xxx] ModemManager[2362]: [base-manager] couldn't check support for device '/sys/devices/pci0000:20/0000:20:03.1/0000:21:00.1': not supported by any plugin – CvM_curious Dec 16 '22 at 15:51
  • That is suspicious but you are not using a modem right? Did you try setting the values to true/false ? – proxx Dec 16 '22 at 16:06
  • no, I'm not using a modem ... standard ethernet port/cabling. Also, I have now set the values to true/false, and removed the trailing spaces. Still no avail ... alas, for now I've just created a crontab entry for root: @reboot sudo route add default gw ... that does what I need. Still weird: the netplan mechanisms clearly is trying to do something: it manipulates the iptables and kicks out my manual route. Just cannot figure out why it would not implement the gateway as instructed ... sigh. – CvM_curious Dec 16 '22 at 17:43
  • Too bad! Hopefully someone else here can come up with a possible reason. Have a nice day! – proxx Dec 16 '22 at 18:02
  • Guys, I have the exact same problem! – Cyrus Raoufi Jan 18 '23 at 21:43
0

don't have enough points to comment. I had the same problem, thinking some netplan or ubuntu system issue, turned out that I had a typo on gateway being 192.68.1.1 instead of 192.168.1.1 in Yaml definition. Didn't find out until I checked /run/systemd/network/10-netplan-ens8.network

XKEY
  • 1