When I add 2 interfaces (eth0 LAN, eth1 WAN) with static IPs (or maybe also with DHCP), Ubuntu 18.04 Server is adding 2 default gateways. Thats not the goal.
How can I define only 1 default gateway?
File: /etc/netplan/01-netcfg.yaml
network:
version: 2
renderer: networkd
ethernets:
eth0:
addresses:
- 172.16.1.22/16
gateway4: 172.16.0.1
nameservers:
search: [mydomain.internal]
addresses: [172.16.1.2, 172.16.1.1]
eth1:
addresses:
- 172.19.3.235/24
gateway4: 172.19.3.1
nameservers:
addresses: [195.50.xxx.xxx,195.50.xxx.xxx]
ip route shows:
user@server:~$ ip route default via 172.19.3.1 dev eth1 proto static default via 172.16.0.1 dev eth0 proto static 172.16.0.0/16 dev eth0 proto kernel scope link src 172.16.1.22 172.19.3.0/24 dev eth1 proto kernel scope link src 172.19.3.134
2 default GWs......
In my case, the default GW from eth1 is the one and only I need.