Changing NetworkManager route metrics

If you use NetworkManager with more than one interface, you probably want to control the metric of their routes. Here’s one way you can do it.

Background

I got a PCI Express WiFi card (wlan0) and a USB WiFi dongle (wlan1). On my system, NetworkManager will activate both at the same time. Then it gives metric 600 to the first one to be activated, and 601 to the second one.

What I wanted was to say: hey, NetworkManager, use metric 500 for wlan1 and 600 for wlan0. It doesn’t look like this is supported, though. Also, DuckDuckGo and Google didn’t help me much.

Digging through the nm-settings(5) man page, though, I found the route-metric option.  It’s not ideal because it’s applied to a connection, not to a device.  But it works fine for my use case as each WiFi interface is connected to a different WiFi network.

Step 1: Find out which are your connections

Use the nmcli helper to list your connections:

$ nmcli connection
NAME       UUID                                  TYPE             DEVICE
Network 1  f0ed603c-f3c3-4acb-b54b-bb857bd9c5b5  802-11-wireless  wlan0       
Network 2  2b4b7240-36bd-407a-a3aa-169abb0ce6c4  802-11-wireless  wlan1

As you can see here, each interface is using a different connection.

Step 2: Set the connection’s default route metric

For example, to set the wlan1 interface’s default route metric to 500, just change its connection:

$ nmcli connection modify uuid 2b4b7240-36bd-407a-a3aa-169abb0ce6c4 ipv4.route-metric 500
$ nmcli connection modify uuid 2b4b7240-36bd-407a-a3aa-169abb0ce6c4 ipv6.route-metric 500
$ nmcli connection show   uuid 2b4b7240-36bd-407a-a3aa-169abb0ce6c4 | grep route-metric
ipv4.route-metric:                      500
ipv6.route-metric:                      500

Step 3: Check that your routing table is correct

NetworkManager should automatically change the route’s metric:

$ ip route
default via 192.168.25.1 dev wlan1  proto static  metric 500 
default via 192.168.0.1 dev wlan0  proto static  metric 600 
192.168.0.0/24 dev wlan0  proto kernel  scope link  src 192.168.0.111  metric 600 
192.168.25.0/24 dev wlan1  proto kernel  scope link  src 192.168.25.69  metric 500

If it didn’t, try restarting NetworkManager.

16 thoughts on “Changing NetworkManager route metrics”

  1. Nice summary & good (if hidden) tip!

    In one of my use cases, on a Raspberry Pi 2 running a Debian (jessie) based distro on armhf architecture, NetworkManager 0.9.10.0-7 does not offer the route-metrics option. So YMMV if using older NM versions.

    Thanks again,

    Adam.

  2. Thanks from me, too. This lets me setup my network routing rules the way I really need them much easier 🙂

    1. How can I make these changes persistent? Do you have an example boot script or systemd service?

      1. The changes are persistent. They get applied to the applicable connection profile in /etc/NetworkManager/system-connections/

  3. This has been irritating me for months: My lab network connection was always getting a lower routing metric than the corporate connection, so my ritual on every logon has been disconnecting the two connections and then reconnecting them in the order I want them in. Now I can concentrate on drinking my coffee. Thanks!

  4. The best in class, Depoxito come up with the money for you
    high-end experience that focus on the look and atmosphere of
    legal VIP standarts, we have enough money you the best glamorous
    to high-level experience of VIPs expect in any summit end casino, grand rouse casino royale present
    you the other studio design element including the grand blackjack, offering our VIP Customer the best experience
    of a Salon privee table.
    New style table also feature across the room following grand roulette upgraded on our
    provider playtechs mini prestige roulette which delivering more engaging and richer
    playing experience. The new experience contains a total of seven tables including five blackjack tables, one roulette table and
    one baccarat table. Grand flesh and blood casino royale has been high hand-engineered to fit the needs of our customer to using it, and contains unique elements that is specially designed to
    maximize the impact value we got from our customers and diversify it to the existing network.

    Soon, Depoxito will manufacture an better reality technology upon bring to life casino for our VIP
    member, these most ahead of its time technology ever seen in stir casino
    including this bigger reality. Which permit players to experience products on an entire further level which is never seen before literally leaping out of the game and
    taking the blackjack, baccarat, roulette and further game into the summative entire level.

    Depoxito VIP Baccarat, we offer you the categorically exclusive stimulate VIP Baccarat that is played later than occurring to 7 players at the thesame table and our severely trained lovely conscious baccarat dealer.

    And of course our VIP fanatic will environment as if they were essentially sitting at one of the summit
    casino baccarat table. This immersive gaming experience creates a hugely
    looking for excitement circulate that our VIP
    players will locate hard to surpass.
    Here is the list of flesh and blood casino game that depoxito provide, we meet the expense of the widest
    range of bring to life casino games on the broadcast including : blackjack unlimited, blackjack prestige,
    roulette, baccarat, poker, hi-lo, sic bo, and grand breathing casino royale such as Grand
    Baccarat, Grand Blackjack and Grand Roulette for our VIP member.
    And of course as a fanatic of Depoxito you can enjoy every the games that we manage to pay
    for to you, all you compulsion to complete is just visit our site depoxito and register it by yourself takes up
    to 3 minutes and next youre customary to action any
    game that you want.
    Be our VIP, visceral our VIP aficionado of course established
    you the best give support to you can acquire from
    us all you need to be a VIP enthusiast is unquestionably easy.

    every you infatuation is just keep playing upon our site,
    addition and work afterward a VIP following the amount that our company had written, keep playing and our customer support will gate you
    that you are promoted to become a VIP zealot on our site.

  5. Option Link l69
    L69 is among the official sites that offer the latest alternative link reliable online betting sites.
    L69 provides more than one alternative link from each betting
    site, and all of us here have become the most comprehensive alternative link providers and the L69
    web site contains a responsive display of which makes it easy for you to access
    our site coming from the display of your own device or laptop.

    And what you should know is of which we here only have 1 official link, l69.

    me and if there are other websites that provide information or call our own website is not our own official site.

    Ball wagering and casino gambling are usually varieties of
    games that are incredibly favored by the folks
    of Indonesia. Why l69? Because we’ve been here for even more than five a number of have become the trust of the men and women of Indonesia as a
    spot to perform soccer gambling and also on-line casino gambling.
    Itself has additionally obtained a license through the Asian and Western governments last season to come to be an online gambling
    gambling provider site in Asian countries and Europe. By offering many different types of wagering bets that may be played upon one ID,
    it makes the members feel happy playing in your bookie.

    Advantages of Alternative Links l69
    But unfortunately lately there are many members
    who knowledge problems and problems when entering
    into their Bola tangkas game because the Sbobet site is frequently blocked
    and lots of older sites have been obstructed by the Indonesian authorities rather than a few usually are also affected in what is
    called the Newsletter Project. The Indonesian government lately is
    struggling to get rid of links or paths to get into sites that smell of pornography, gambling and right now there are a great many other content that will is deemed
    inappropriate.

  6. Sbobet is a trusted gambling site that operates to foster every fans of online gambling in the world.
    Founded in 2010, it didn’t give a positive response
    long for Sbobet to become the biggest online site in Asia and taking
    into account it comes to the amount of betting child maintenance that rotates all week, Sbobet is
    after that one of the biggest sites in the world.

    Sbobet is no question popular, especially in the midst of Asian bettors, the defense is that the site has
    been awarded as the best gambling operator for two years in a row.
    It offers a variant of football betting following unconditionally
    low margins afterward compared to additional sites in its
    class.

  7. Not only as the best Asian gambling operator in the 2009 and 2010
    versions of eGaming review Magazine, but the online
    gambling site Sbobet has after that become the 11th most ranked company in the “50 knack Company” list in 2011 which
    is the list of the most influential companies in the eGaming industry.
    This is proof that Sbobet is not an online gambling site.

    For starters, Sbobet is the best online bookie to
    acquit yourself Asian Handicap because here you can choose both
    the type of bet and the odds you want. Compared to competitors such as Dafabet and 188Bet,
    Sbobet has the most unbelievable in-play betting assistance taking into account
    alive video streaming features for several tournaments and well-liked matches in the middle of faithful
    customers.

  8. One of the most Trusted Soccer Gambling Real estate agent in Indonesia Serving Listings
    of Gambling and On line casino Gambling
    Userbola is the Most Trusted and Recognized SBOBET Agent in Philippines.
    We serve bets of which provide soccer gambling online games, online gambling games,
    online casino gambling agents, poker in addition to online lottery.

    We will wholeheartedly always be ready to help what you may need and help you if there are difficulties in producing SBOBET Online Betting Accounts, MAXBET Agents or formerly known as IBCBET, Serba4d or perhaps KLIK4D lottery.

    Brand new 20% Member Bonus with typically the Best and
    a lot Trustworthy Sports Gambling Broker
    Userbola is the Best SGD777 Bandar and the Largest Football Bandar in Indonesia, always providing 24-hour online service with the need to stop in the process of registering,
    lodging, withdrawing and responding to your every complaint.

    Regarding more information, please go directly to livechat plus chat
    directly with the friendly CS

    Register regarding Sbobet at this time!

    Complete Selection for Reliable Sports Wagering and Casino Brokers
    For you fans of wagering soccer matches both foreign and domestic, reliable football gambling provides various matches from
    around the globe. Not really just that, basketball, tennis in addition to eSports tournaments
    will also be here.

    Especially for connoisseurs associated with Casino Providers, we have probably the most complete range regarding video games starting from Baccarat, Poker, Keno, Slot machine game and several more.

    Userbola is 1 of the trusted football betting sites that works
    as an agent of the tour’s major soccer betting shops like
    SBOBET, Ibcbet in addition to Mahabet Sport. You may definitely get
    a pleasant experience while betting because of the interesting features made available from this
    site. Userbola has an expert support when you make downpayment
    transaction until pulling out money.
    Before you can enter the football gambling game on Userbola you must register first and become a user.
    The technique is very effortless, all you have to be able to do is click about the list and enter the registration form webpage and you will move
    directly to our primary website.

  9. I’ve read a few good stuff here. Definitely price bookmarking for revisiting.
    I wonder how so much attempt you set to create this type
    of fantastic informative website.

  10. In an age of increasingly quick technology and growing popularity of online gambling, no less than 100 agency sites are born all day offering the best gambling products for gambling game lovers re the world.

    Including in Indonesia, various types of gambling games are presented through many certified agent sites.

    One site that has emerged recently is Depoxito. Although it
    is new, it turns out that Depoxito already has some of the best features prepared
    to make its customers delightful including professional bolster and international
    okay game quality.

    Tips for Choosing a new Gambling Site
    Some players think that a other site means no experience.
    This information may be true, but on high hours are not all to be the best and most trusted online
    gambling site. There are at least 5 important criteria that
    must be possessed by a further online gambling site to deserve
    to be called a site next a good reputation.

    For that, we will present some important tips for those of you who
    will pick a other online gambling agent site to avoid cyber crime.

    before deciding to choose a site, make certain the site has
    the bearing in mind four criteria.

Leave a Reply to Dean Cancel reply

Your email address will not be published. Required fields are marked *