Windows配置多网卡路由
route print
显示如下内容:
上图中,10.25.11.1是内网网关,192.168.43.11是外网网关
需要将其修改为10.*和192.168.*使用内网网关,其他网址使用外网网关
route delete 0.0.0.0
route delete 0.0.0.0
route delete 192.168.0.0
route delete 10.25.11.0
route delete 10.25.0.0
route delete 10.26.0.0
route delete 10.0.0.0
ARP -a
route -p add 0.0.0.0 mask 0.0.0.0 192.168.43.155 if 0x2
route -p add 10.0.0.0 mask 255.0.0.0 10.25.11.1 if 0xb
route -p add 192.168.0.0 mask 255.255.0.0 10.25.11.1 if 0xb
-p表示永久写入
if是接口编号
更换IP后接口会改变
效果如下:
CentOS虚拟机配置多网卡路由
桥接方式
网卡1
ifconfig
ifconfig ens33 10.25.11.236 netmask 255.255.255.0
route add default gw 10.25.11.1
网卡2
ifconfig ens192 10.26.30.237 netmask 255.255.0.0
route add default gw 10.26.0.1
NAT方式
ifconfig ens33 192.168.1.10 netmask 255.255.255.0
route add default gw 192.168.1.2
ifconfig ens37 10.25.11.237 netmask 255.0.0.0
route add -net 10.0.0.0 netmask 255.0.0.0 gw 10.25.11.1 ens37
ifconfig ens33 192.168.1.237 netmask 255.255.255.0
route add default gw 192.168.1.2
system config reset
network interface eth0 ip set 192.168.1.100 mask 255.255.255.0
network route add gw 192.168.1.2 dst 0.0.0.0/0
save
Reference
https://blog.csdn.net/test1280/article/details/90142359
https://blog.51cto.com/skytina/1355253
https://blog.csdn.net/wangzhen209/article/details/77748107
发表评论