on mu Ubuntu 22.04 server I have two internal NIC and one external connected to the Internet.
I have defined the interfaces with Netplan as follows :
network:
ethernets:
eno1:
dhcp4: true
dhcp4-overrides:
route-metric: 100
enp2s0:
addresses:
- 172.16.1.1/24
nameservers:
addresses:
- 127.0.0.53
- 8.8.8.8
search:
- wombats.org
routes:
- to: default
via: 192.168.0.254
- to: 172.16.1.0/24
via: 172.16.1.1
metric: 200
table: 101
routing-policy:
- from: 172.16.1.0/24
table: 101
wlp8s0:
dhcp4: no
addresses:
- 172.16.2.1/24
routes:
- to: 172.16.2.0/24
via: 172.16.2.1
metric: 20
table: 102
routing-policy:
- from: 172.16.2.0/24
table: 102
version: 2
A computer connected to enp2s0 is routed perfectly to the internet and internally. When the same computer is connected through wlp8s0 it cannot even reach the network managed by enp2s0 (172.16.1.1/24).
Here are the two routing tables :
connected through enp2s0 :
ip r
default via 172.16.1.1 dev enxf8e43b9d4867 proto dhcp metric 100
169.254.0.0/16 dev enxf8e43b9d4867 scope link metric 1000
172.16.1.0/24 dev enxf8e43b9d4867 proto kernel scope link src 172.16.1.3 metric 100
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1 linkdown
connected through wlp8s0:
ip r
default via 172.16.2.1 dev wlp0s20f3 proto dhcp metric 20600
169.254.0.0/16 dev wlp0s20f3 scope link metric 1000
172.16.2.0/24 dev wlp0s20f3 proto kernel scope link src 172.16.2.4 metric 600
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1 linkdown
The notable difference is the metric of the default route in both configurations. This does not come from the DHCP server as both subnets are configured identically. I have tried to disable ufw and tried to add iptables. But all that has not changed the result.
I do not understand why I cannot route the traffic of the wlp8s0 ! Does the fact that one NIC is a cable and the other a wifi explain the difference ? It should not as they get served IPs in the same way.
Thanks for your help.
Jan