linux添加静态路由

1、route add -net 192.168.10.0/24 -gw 172.16.1.1
2、vim /etc/rc.d/rc.local
route add -net 192.168.10.0/24 -gw 172.16.1.1
3、vim /etc/sysconfig/static-routes
any net 192.168.10.0/24 -gw 172.16.1.1

4、
路由的配置文件/etc/sysconfig/network-scripts/route-eth0,默认是不存在,需要自己添加。
默认网关可以在网卡的配置文件中添加。
[root@nagios-server ~]# more /etc/sysconfig/network-scripts/route-eth0
192.168.1.0/24 via 192.168.1.1

 

3,4二选一

posted @ 2020-05-14 15:55  litton888  阅读(737)  评论(0)    收藏  举报