UBUNTU SERVER 18.04 LTS with 2 GE NICs
eno1: 172.22.1.1/20
eno2: 10.11.1.34/30
netplan yaml:
network:
version: 2
renderer: networkd
ethernets:
eno1:
addresses: [ 172.22.1.1/20 ]
gateway4: 172.22.0.1
nameservers:
addresses:
- "172.22.0.53"
routing-policy:
- to: 172.22.224.0/19
table: 211
priority: 10
- to: 192.168.201.0/24
table: 200
priority: 20
routes:
- to: 0.0.0.0/0
via: 172.22.0.254
table: 211
- to: 0.0.0.0/0
via: 172.22.0.1
table: 200
eno2:
addresses: [ 10.11.1.34/30 ]
routing-policy:
- from: 10.11.1.34
table: 222
priority: 8
- to: 10.128.0.0/16
table: 222
priority: 5
routes:
- to: 0.0.0.0/0
via: 10.11.1.33
table: 222
When I apply the configuration, restart the networking or use netplan apply
, only one of these routing-policies works:
When I use netplan apply
:
eno1
:- First time, only the first routing-policy works.
- Second time, only the second routing-policy works.
- Third time, only the first routing-policy works.
eno2
- Every time, only the second routing-policy works.
I wrote the yaml file as the netplan.io examples told.
I'm not sure it will work.
Here my suggestion of
netplan yaml
:The below worked for me on a system with two network cards, each using a different gateway, interface and IP:
It is useful to run the following command to check for changes and see possible errors: