When I add a route using nmcli, the route as reported by ip route show is incorrect: nmcli connection modify eth2 +ipv4.routes "" dev eth2 proto static src

This route does not work.

However if I use ip route add the ip route show is correct and the route works:

ip route add dev eth2 src dev eth2  scope link  src

I can't seem to find the correct way to add the route using nmcli and have it show up correctly. Any ideas, or is there something I'm missing?

  • can you be more specific about why you know the reported route is incorrect? proto static sounds reasonable to me, it looks the same as my default route (using networkmanager+DHCP4 on Fedora 24). – sourcejedi Dec 5 '16 at 16:18
  • I have a virtual machine assigned the address. When the route is added by NetworkManager via nmcli resulting in a route with proto static ntp time sync fails. When the route is added by ip route add resulting in a route with scope link ntp time sync succeeds. To be honest its confusing the heck out of me because I know the proto static route SHOULD work. – pacmanwa Dec 5 '16 at 16:58
  • Are you sure NM isn't changing something else about the routing table? – Bratchley Dec 5 '16 at 18:07
  • Hmm, maybe it works differently because default route has a target IP as well. Anyway perhaps you could look at the result of ip route get in each case unix.stackexchange.com/a/192065/29483 – sourcejedi Dec 5 '16 at 18:12
  • The route has a src but NM doesn't support that. Hence it looks like the route is not added by NM. Also, nmcli con modify modifies a connection profile. Did you activate the connection afterwards for the change to take effect? – thaller Dec 5 '16 at 23:21

Perhaps your problems are related to the setup of the VM? In a simpler case, where I have another router on my network, nmcli works as expected. In my case, the network is, default route is, and there is another router at which connects to another network

nmcli c modify eth0 +ipv4.routes ""
nmcli c up eth0

This produces expected result in ip route:

default via dev eth0  proto static  metric 100 dev eth0  proto kernel  scope link  src  metric 100 via dev eth0  proto static  metric 100 

and in nmcli c show eth0:

IP4.ROUTE[1]:                           dst =, nh =, mt = 100

This is on fedora 24.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.