Set network interface metric to a fixed value

I have a fixed IP camera which is configured on static IP and connecting using Ethernet (enp3s0). WiFi is disabled (from the GUI). Cellular is switched on and it is also on static IP (static IP is not configured on the device but configured by sim provider).

The challenge that i have is that internet traffic tries to get routed from the wired connection/camera first and it gets no where and I have no internet connection.

Unless, I use ifmetric to set the wwan0 metric to 0 and then i can connect to internet using cellular and camera locally on the IP it is set to.

Problem is that ifmetric is not permanent and I have tried using below in the /etc/network/interface but cellular totally stopped working.

auto wwan0 iface wwan0 inet dhcp metric 0

I do not want to set static routes as I may be using a different sim or IP camera may end up using different IP.

What i would like to achieve is, setting the wwan0 interface metric to a lower value permanently as in the snapshot below (route -n output).

Tried using nm-connection-editor but it did not work as well

2 Answers

Use nm-connection-editor... see image below...

enter image description here

2

To adjust interfaces' metric:

#nmcli c
... output to identify the connection ...
#nmcli c edit wlan0-1 ===| nmcli interactive connection editor |=== Editing existing '802-11-wireless' connection: 'wlan0-1' Type 'help' or '?' for available commands. Type 'print' to show all the connection properties. Type 'describe [<setting>.<prop>]' for detailed property description. You may edit the following settings: connection, 802-11-wireless (wifi), 802-11-wireless-security (wifi-sec), 802-1x, ethtool, match, ipv4, ipv6, tc, proxy nmcli> set ipv4.route-metric 10 nmcli> save nmcli> quit
#systemctl restart NetworkManager

In /etc/wpa_supplicant/wpa_supplicant.conf the new Wifi configurations will be reflected!

To hide the clear text password in the above file, replace the 'wlan0-1' section with the generated output:

wpa_passphrase "wlan0-1" "mypassword"

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like