我有一个网络接口,我想为其配置路由。
# 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
我可以使用以下方式设置规则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
我想使用nmcli
. 但是,我无法重新创建配置。
# 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
任何反馈将不胜感激。谢谢你!