You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.8 KiB

+++
title = "Changing network metrics on linux with NetworkManagers CLI"
aliases = [
'/posts/2022-11-24-changing-network-metrics-on-linux',
'/posts/2022/32-changing-network-metrics-on-linux/'
]
summary = """Because I use two network interfaces with more subnets/routes on one of them.
But I use the other interface for internet because of speed..."""
date = "2022-11-24T20:15:44+02:00"
lastmod = '2024-09-28T23:48:06+0000'
categories = ["computerstuff"]
tags = ["linux","networking", "networkmanager"]
+++
Check for connection names.
```console
$ nmcli connection
NAME UUID TYPE DEVICE >
MagentaNET 923ab10b-be81-4668-9aab-************ wifi wlx00259ce03>
DreiNET b2bcc61c-19df-41f0-9790-************ wifi wlo1 >
Kabelgebundene Verbindung 1 c75abc26-19eb-3fec-81b1-************ ethernet --
```
Start editing the affected connection:
{{< highlight console "hl_lines=12-14" >}}
$ nmcli connection edit MagentaNET
===| nmcli interaktive Verbindungsbearbeitung |===
Bestehende Verbindung »802-11-wireless« wird bearbeitet: »MagentaNET«
Tippen Sie »help« oder »?«, um verfügbare Befehle anzuzeigen.
Geben Sie »print« ein, um alle Verbindungseigenschaften anzuzeigen.
Tippen Sie »describe [<Einstellung>.<Eigenschaft>]« für eine detaillierte Eigenschaftenbeschreibung.
Sie können die folgenden Einstellungen bearbeiten: connection, 802-11-wireless (wifi), 802-11-wireless-security (wifi-sec), 802-1x, ethtool, match, ipv4, ipv6, hostname, tc, proxy
nmcli> set ipv4.route-metric 599
nmcli> save
nmcli> quit
{{< /highlight >}}
```console
$ sudo systemctl restart NetworkManager
```
Check routing table with
```console
$ ip route
```
Source: <https://dev.to/emamirazavi/how-to-set-metric-in-networkmanager-system-4525>