I spent the whole morning trying to solve this.
I have two IP addresses available on the same interface (different gateways), let’s say 100.100.100.100 and 200.200.200.200.
My YAML is:
network:
version: 2
renderer: networkd
ethernets:
eth0:
match:
macaddress: u.u.u.u
addresses:
- 100.100.100.100/32
- 200.200.200.200/32
#gateway6: fe80::1
routes:
- to: 0.0.0.0/0
via: 100.100.100.1
on-link: true
nameservers:
search: ( invalid )
addresses:
- x.x.x.x
- y.y.y.y
I tought that, to let this server surf the net with 200.200.200.200, it would be easy as changing the “via” line to:
via: 200.200.200.1
This doesn’t work. I launch netplan apply and nothing changes, I always surf the web with 100.100.100.100 (as stated by curl icanhazip.com and also in ifconfig).
What am I missing?