标签:ali default eth span efault scripts pre tool The
系统:CentOS 7
网卡: eth0 内网 网关:192.168.1.1
eth1 外网 网关:10.0.0.1
先安装net-tools:yum -y install net-tools route del default #删除默认路由 route add -net 192.168.1.0/24 gw 192.168.1.1 #指定内网网关 route add -net 192.168.1.0/24 dev eth0 #指定内网网卡 route add -net 0.0.0.0/0 gw 10.0.0.1 #指定外网网关 route add -net 0.0.0.0/0 dev eth1 #指定外网网卡
[root@dcServer003 ~]# cat /etc/rc.local #!/bin/sh # # This script will be executed *after* all the other init scripts. # You can put your own initialization stuff in here if you don‘t # want to do the full Sys V style init stuff. touch /var/lock/subsys/local route add -net 192.168.1.0/24 gw 192.168.1.1 route add -net 192.168.1.0/24 dev eth0 route add -net 0.0.0.0/0 gw 10.0.0.1 route add -net 0.0.0.0/0 dev eth1
标签:ali default eth span efault scripts pre tool The
原文地址:https://www.cnblogs.com/ytyzhn/p/13328449.html