I'm running an application, where I need to use the LAN interface as a communication input with a device, using a socket server open on the IP for that interface, make the handling of this data and then send it to another server through the wireless interface. Searching a little, I tried to use the metrics configuration of the interfaces, inside the /etc/network/interfaces file as follows:

auto eth0
iface eth0 inet static
        metric 200

iface wlan0 inet static
        metric 100

However, when the LAN interface is connected to the device, traffic is interrupted on the wireless interface and using the route -n command I realize that the metrics made no difference, where eth0 is with metric 202 and wireless interface with metric 303.

I performed these tests using a Raspberry PI4 as Ubuntu LTS Server 20:04:01 Arm64 and also the Raspberry Pi OS (32-bit) with desktop, both had the same problem.


I haven't used Ubuntu so far, so I cannot say anything about it. But with the Raspberry Pi OS, you also used, you should not use /etc/network/interfaces anymore, because it is deprecated on RaspiOS as noted in the interfaces file. It seems you only want to configure a simple router. I prefer to use systemd-networkd. You will find some examples to Use systemd-networkd for general networking. Just follow the sections ♦ Create interface file for a wired connection and ♦ Create interface file for a WiFi connection.

There you will not find additional options like ip-forward and NAT for a complete router. I cannot see from the question that you need it. If you need additional options just tell me.

Not the answer you're looking for? Browse other questions tagged or ask your own question.