0

I have 2 interfaces on an ubuntu 18.04 LTS system. The primary f0 is for all the internet facing traffic and also vpn traffic. The f1 is for internal traffic.

My netplan is as follows:

  ethernets:
    enp0s20f0:
      addresses: [10.10.20.148/28]
      gateway4: 10.10.20.158
      nameservers:
        addresses: [8.8.8.8,4.2.2.2]
    enp0s20f1:
      addresses: [10.10.20.132/28]
      routes:
        - to: 10.10.10.0/24
        via: 10.10.20.142
      nameservers:
        addresses: [10.10.x.x,10.10.x.x]

When I apply this netplan it kills my VPN and will not add the route. However I can execute the following and am able to connect to the internal network. I have tried adding metrics to no avail. What am I not doing here?

route add -net 10.10.10.0/24 gw 10.10.20.142 dev enp0s20f1
  • Status please... – heynnema Feb 15 at 1:19
0

Your .yaml should look like this... keep indentation, spacing, and no tabs...

network:
  version: 2
  renderer: networkd
  ethernets:
    enp0s20f0:
      addresses: [10.10.20.148/28]
      gateway4: 10.10.20.158
      nameservers:
        addresses: [8.8.8.8, 4.2.2.2]
    enp0s20f1:
      addresses: [10.10.20.132/28]
      routes:
        - to: 10.10.10.0/24
          via: 10.10.20.142
      nameservers:
        addresses: [10.10.x.x, 10.10.x.x]

sudo netplan --debug generate

sudo netplan apply

reboot

  • Did not work, network locked up and route was not added. But again I was able to add it manually. – AdamR Feb 16 at 2:05
  • @AdamR Comment out one ethernet adapter and see if you can get the other one to work first by itself. Then reverse the process. ie: comment from enp0s20f1 to the end of the file. Then you'll know where the trouble is. – heynnema Feb 16 at 4:10
  • Both static ip's work fine. It is when I add the route to the second one that causes the problem. But I can add this manually with no issues "route add -net 10.10.10.0/24 gw 10.10.20.142 dev enp0s20f1"my – AdamR Feb 17 at 14:00
  • @AdamR Did you do the spacing exactly as I show in my .yaml? Install yamllint (sudo apt-get update and sudo apt-get install yamllint) then yamllint /etc/netplan/*.yaml to double-check your file. Also, show me the output of sudo netplan --debug generate. – heynnema Feb 17 at 14:08
  • @AdamR Also see the routing examples at netplan.io/examples – heynnema Feb 17 at 14:14

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.