I have a network interface for which I would like to configure routes.
# ip address show br_10G_V888
6: br_10G_V888: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 78:ac:44:09:9d:82 brd ff:ff:ff:ff:ff:ff
inet 172.21.1.48/24 brd 172.21.1.255 scope global noprefixroute br_10G_V888
valid_lft forever preferred_lft forever
I am able to set the rules using ip
:
# ip route add default via 172.21.1.1 dev br_10G_V888 table dmz
# ip rule add from 172.21.1.0/24 lookup dmz
# ip route show table dmz
default via 172.21.1.1 dev br_10G_V888
# ip rule
0: from all lookup local
32765: from 172.21.1.0/24 lookup dmz
32766: from all lookup main
32767: from all lookup default
I would like to make these changes persistent using nmcli
. However, I am unable to recreate the configuration.
# nmcli connection modify br_10G_V888 \
ipv4.routes '0.0.0.0/0 172.21.1.1 table=1' \
ipv4.routing-rules 'priority 32765 from 172.21.1.0/24 table 1'
# nmcli connection up br_10G_V888
# ip route show table dmz
default via 172.21.1.1 dev br_10G_V888 proto static
172.21.1.1 dev br_10G_V888 proto static scope link
# ip rule
0: from all lookup local
32765: from 172.21.1.0/24 lookup dmz
32766: from all lookup main
32767: from all lookup default
Any feedback would be greatly appreciated. Thank you!
nmcli
in your second example,ip route show table dmz
shows the default route via172.21.1.1
that you created, andip rule
shows the lookup rule with priority 32765. What's missing?proto static
on the first line and a new line with172.21.1.1 dev br_10G_V888 proto static scope link
. Are these configurations the same?proto dhcp
) or set implicitly by the kernel (proto kernel
) or via some other routing protocol (proto zebra
, etc)