Re: How to set network connection priority



On Fri, 2019-07-26 at 21:52 +0530, Mohammed Sadiq wrote:
Hi,

Is it possible to set IP routing (and DNS) priority when multiple
network is present?  Say like, “Connection A” to have lower priority
over every other connection, and “Connection B” having more priority
than “Connection A”, but less priority than every other connection.
So if there is ever a connection other than ‘A’ or ‘B’, that
connection
will be used for IP (and DNS) routing, otherwise “Connection B” will
be
used, and otherwise, “Connection A.”

The ipv4 setting for each connection has a "dns-priority" property that
you can use to set a given connection's DNS servers as lower priority.
It also has a "route-metric" property that will do the same for routes
(but has a different scale based on kernel routing metrics).

man nm-settings

has a lot of info about these values.

nmcli con mod "my connection name" ipv4.dns-priority X

By default every connection gets the same priority (0). The larger the
number, the less-preferred the connection. So in your example, you
could set:

nmcli con mod "Connection A" ipv4.dns-priority 10 ipv4.route-metric 1050
nmcli con mod "Connection B" ipv4.dns-priority 5 ipv4.route-metric 1040

And that may do what you want.

Dan

I'm wring a C code (that will hopefully be into gnome-control-
center),
so I would be okay with solutions that are possible via code only, or
just configuration changes for NMSetting.


Thanks,
Mohammed Sadiq
_______________________________________________
networkmanager-list mailing list
networkmanager-list gnome org
https://mail.gnome.org/mailman/listinfo/networkmanager-list



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]