通过路由转发,实现从一个固定IP访问到另一个固定IP
配置命令
nmcli con mod eth0 +ipv4.routes "10.254.254.11 192.168.7.61" nmcli con mod eth0 +ipv4.routes "10.254.254.12 192.168.7.62" nmcli con mod eth0 +ipv4.routes "10.254.254.13 192.168.7.63"
实际生效区域
# cat /etc/sysconfig/network-scripts/route-eth0 ADDRESS0=10.254.254.11 NETMASK0=255.255.255.255 GATEWAY0=192.168.7.61 ADDRESS1=10.254.254.12 NETMASK1=255.255.255.255 GATEWAY1=192.168.7.62 ADDRESS2=10.254.254.13 NETMASK2=255.255.255.255 GATEWAY2=192.168.7.63
重新加载配置文件
nmcli networking off;nmcli networking on #或 nmcli connection reload nmcli connection down eth0; nmcli connection up eth0
#注意:远程时需要在一行命令里同时down与up网卡,否则网卡下线即断网。
此时查看发现
# route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 192.168.7.1 0.0.0.0 UG 100 0 0 eth0 10.254.254.11 192.168.7.61 255.255.255.255 UGH 100 0 0 eth0 10.254.254.12 192.168.7.62 255.255.255.255 UGH 100 0 0 eth0 10.254.254.13 192.168.7.63 255.255.255.255 UGH 100 0 0 eth0 192.168.7.0 0.0.0.0 255.255.255.0 U 100 0 0 eth0
标签:nmcli,0.0,192.168,255.255,10.254,本地,转发,路由,eth0 From: https://www.cnblogs.com/santia-god/p/17426151.html