Trying to configure an Ubuntu 18.04 machine with two IP addresses on different subnets on one ethernet port, each with a gateway so port forwarding works from different routers.
This was based on the Netplan documentation. The two IPs work, but no inbound or outbound internet access.
network:
version: 2
renderer: networkd
ethernets:
enp6s0:
nameservers:
addresses: [8.8.8.8, 8.8.4.4]
addresses:
- 192.168.13.200/24
- 192.168.1.100/24
routes:
- to: 0.0.0.0/0
via: 192.168.13.1
metric: 200
- to: 0.0.0.0/0
via: 192.168.1.1
metric: 300
enp8s0:
addresses: [192.168.2.100/24]
dhcp4: false
dhcp6: false
This next attempt was based on another answer, but when I try this I get an error: "ERROR: enp6s0: NetworkManager does not support non-default routing tables"
network:
version: 2
renderer: networkd
ethernets:
enp8s0:
addresses: [192.168.2.100/24]
dhcp4: false
dhcp6: false
enp6s0:
dhcp4: no
dhcp6: no
addresses:
- 192.168.1.100/24
- 192.168.13.200/24
nameservers:
addresses: [8.8.8.8, 8.8.4.4]
routes:
- to: 0.0.0.0/0
via: 192.168.1.1
metric: 150
- to: 0.0.0.0/0
via: 192.168.13.1
metric: 150
table: 102
routing-policy:
- from: 192.168.13.0/24
table: 102
- to: 192.168.13.0/24
table: 102
enp7s0:
dhcp4: yes