Re: How to set ipv4 default route



On Wed, 2014-07-16 at 17:12 -0600, Pete Zaitcev wrote:
On Wed, 16 Jul 2014 16:48:24 -0600
Pete Zaitcev <zaitcev redhat com> wrote:

[root localhost ~]# nmcli c mod eth0 ipv4.routes 'default 192.168.129.17'
Error: failed to modify ipv4.routes: invalid IPv4 route 'default'.

Still, NetworkManager.conf(5) contains this tantalizing hint:

           Remember that NetworkManager controls the default
           route, so because the interface is ignored, NetworkManager may
           assign the default route to some other interface.

I know, my shame is going to remain in the list archive forever.
The right way to do it is obvious:

 nmcli c mod eth0 ipv4.addresses '191.168.129.23/28 192.168.129.17'
 nmcli c mod eth0 ipv6.addresses 'fd2d:acfb:74cc:3::7/64 fd2d:acfb:74cc:3::1'

NM automatically sets the default route based on two things:

(1) interface priority - all interfaces have a priority and if two
interfaces are active, and *not* prevented from getting the default
route (see #2), the one with the highest priority wins.  Right now,
that's a static ordering but we're exploring how to make that dynamic.

(2) the "never-default" option: you can prevent connections (and thus
their interface when that connection is active) from ever getting the
default route by setting this option.  With nmcli:

nmcli c mod eth0 ipv4.never-default true
nmcli c mod eth0 ipv6.never-default true

would prevent connection "eth0" from ever receiving the IPv4 or IPv6
default route.  This would allow some other connection/interface to
receive the default route, when active.

Does that help?

Dan



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