My problem is quite similar to this question. My vagrant machine sets default route metric incorrectly.
The following is netplan configuration.
network:
version: 2
ethernets:
enp0s3:
dhcp4: true
match:
macaddress: 02:70:4e:c8:68:e9
enp0s8:
dhcp4: false
addresses: [192.168.33.10/24]
gateway4: 192.168.33.1
routes:
- to: 192.168.33.0/24
via: 192.168.33.1
metric: 0
And route table.
# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.33.1 0.0.0.0 UG 0 0 0 enp0s8
0.0.0.0 10.0.2.2 0.0.0.0 UG 100 0 0 enp0s3
10.0.2.0 0.0.0.0 255.255.255.0 U 0 0 0 enp0s3
10.0.2.2 0.0.0.0 255.255.255.255 UH 100 0 0 enp0s3
192.168.33.0 0.0.0.0 255.255.255.0 U 0 0 0 enp0s8
192.168.33.0 192.168.33.1 255.255.255.0 UG 0 0 0 enp0s8
enp0s3
is NAT interface and internet connection should use this. sudo route del default enp0s8
resolves this problem, but adding routes to yaml couldn't solve the problem and has the limit of fixed gateway.
What configuration should I use to reorder metrics automatically?