if you are trying to attache the new network interface for your Ubuntu 18.04 EC2 instance, this post might help you to figure out.
Summary
because of Netplan is new network manager in Ubuntu 18.04, things became different as before, and Netplan looks not supported asymmetric routing for now, that is required you to set static ip address & routes for both interfaces.
Solutions
follow above situation
we have to set a default route by on-link
option
/etc/netplan/50-primary.yaml
network:
version: 2
renderer: networkd
ethernets:
eth0:
addresses:
- 192.168.0.5/24
dhcp4: no
routes:
- to: 0.0.0.0/0
via: 192.168.0.1 # gateway address
on-link: true
- to: 0.0.0.0/0
via: 192.168.0.1 # gateway address
table: 900
- to: 192.168.0.5
via: 0.0.0.0
scope: link
table: 900
routing-policy:
- from: 192.168.0.5
table: 900
eth1:
addresses:
- 192.168.1.5/24
dhcp4: no
routes:
- to: 0.0.0.0/0
via: 192.168.1.1 # gateway address
on-link: true
- to: 0.0.0.0/0
via: 192.168.1.1 # gateway address
table: 999
- to: 192.168.1.5
via: 0.0.0.0
scope: link
table: 999
routing-policy:
- from: 192.168.1.5
table: 999
Netplan Commands
to let configurations take effect execute netplan --debug apply
or you can use netplan try
, it will setup your configuration with rolling back mechanisms, it will rolling back your last configurations in 120 seconds