0

I've followed the information to add a route with netplan, but when I check the route is changed.

What I have:

network:
version: 2
renderer: NetworkManager
ethernets:
  enp35s0
    routes:
      - to: 239.0.0.0/8
        via: 10.199.199.7

When I check route I get this

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
224.0.0.0       0.0.0.0         240.0.0.0       U     101    0        0 enp35s0

If I use the route command it works properly, but netplan doesn't seem to do what I need. Any idea what Im missing?

  • Your .yaml file is incomplete, and it indicates that you wish to use NetworkManager, not netplan. Is this a desktop or server installation? What is your intent? – heynnema Apr 29 at 20:41
  • This is a desktop. I think I found what the issue is. Everything I looked at regarding Ubuntu said I should be using netplan to manage adding a route, but nothing seemed to be working, and it kept crashing. Everything I looked at regarding NetworkManager didn't mention adding routes, and nothing mentioned that there is a GUI available. I've added the route using the GUI after wrecking the network again, and found where it adds it in NetworkManager. There are too many different versions of network management "help" that are completely wrong. – sturmey Apr 29 at 20:50
  • How did Carlos's answer become the accepted answer? As far as I can see, his .yaml file is totally wrong. Please advise, as inquiring minds want to know. Thanks! – heynnema Apr 30 at 17:40
  • Please see my answer. – heynnema May 1 at 13:41
0

Since you have a desktop installation, you should be using NetworkManager, and the NetworkManager GUI to configure your machine.

Your /etc/netplan/*.yaml file should look like this...

network:
  version: 2
  renderer: NetworkManager

sudo netplan --debug generate

sudo netplan apply

reboot

Set your route here...

enter image description here

| improve this answer | |
0

The correct solution is

  ethernets:
    enp3s0:
        addresses: []
        dhcp4: true
        gateway4: 10.185.0.1
        nameservers:
          addresses: [10.185.x.x, y.y.y.y]
        routes:
        - to: 10.185.0.0/0
          via: 10.185.0.1
          metric: 100
          table: 101
        routing-policy:
          - from: 10.185.0.

This is using only netplan

| improve this answer | |
  • This is an incomplete and incorrect .yaml file. Where is "network/version/renderer"? How did you come up with the 10.185.x.xxx addresses? OP's ethernet interface appears to be enp35s0, not enp3s0... but we'd have to check that in either case. You can't use gateway4 and routes at the same time. OP wants NetworkManager any way. – heynnema Apr 29 at 22:06
-1

What finally worked was this: It is a desktop install, and has NetworkManager installed. found a spot to add the route in the GUI. discovered it added a line in /etc/NetworkManager/system-connections/'Wired connection 2'

route1=239.0.0.0/8,10.199.199.7,1

Thanks to u/heynnema for the hint.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.