centos 7 添加永久静态路由,centos静态路由
centos 7 添加永久静态路由,centos静态路由
cat /etc/sysconfig/static-route
any net 10.0.0.0/24 gw 192.168.1.2
注:默认情况下主机中并没有该文件,之所以可以是因为/etc/init.d/network启动脚本会调用该文件,具体调用部分代码如下:
#Addnoninterface-specificstatic-routes.
if[-f/etc/sysconfig/static-routes];then
grep"^any"/etc/sysconfig/static-routes|whilereadignoreargs;do
/sbin/routeadd-$args
done
fi
评论暂时关闭