[Linux] 总结各系统 添加路由
时间:2019-04-08 17:34 来源:linux.it.net.cn 作者:IT
Rhel 6.x
1、临时路由
# route add -net 192.100.0.0/16 gw 172.200.5.254
# route add -host 172.216.33.1 gw 172.214.5.254
# route add default gw 172.200.5.254
2、永久路由
# vi /etc/sysconfig/static-routes
any net 192.100.0.0/16 gw 172.200.5.254
any host 172.216.33.1 gw 172.214.5.254
Rhel 7.x
1、临时路由
参考 Rhel 6.x
2、永久路由
# vi /etc/sysconfig/network-scripts/route-bond0
192.100.33.0/24 via 192.100.5.254 dev bond0
FreeBSD 8.x & 10.x
1、临时路由
# route add -net 192.100.0.0/16 102.100.10.254
2、永久路由
# vi /etc.rc.conf
static_routes="net1 net2 net3"
route_net1="-net 192.100.0.0/16 192.100.10.254"
route_net2="-net 172.200.0.0/16 192.100.10.254"
route_net3="-net 192.168.0.0/16 192.100.10.254"
OpenBSD 5.x
1、临时路由
参考FreeBSD
2、永久路由
# vi /etc/hostname.bnx0
!route add -net 172.200.0.0 -netmask 255.255.255.0 192.100.9.254
HP unix
1、临时路由
# route add net 172.214.0.0 netmask 255.255.255.0 172.203.13.254 1
2、永久路由
# vi /etc/rc.conf.d/netconf
ROUTE_DESTINATION[1]="net 172.214.0.0"
ROUTE_MASK[1]="255.255.255.0"
ROUTE_GATEWAY[1]="172.203.13.254"
ROUTE_COUNT[1]="1"
ROUTE_ARGS[1]=""
(责任编辑:IT)
Rhel 6.x 1、临时路由 # route add -net 192.100.0.0/16 gw 172.200.5.254 # route add -host 172.216.33.1 gw 172.214.5.254 # route add default gw 172.200.5.254 2、永久路由 # vi /etc/sysconfig/static-routes any net 192.100.0.0/16 gw 172.200.5.254 any host 172.216.33.1 gw 172.214.5.254 Rhel 7.x 1、临时路由 参考 Rhel 6.x 2、永久路由 # vi /etc/sysconfig/network-scripts/route-bond0 192.100.33.0/24 via 192.100.5.254 dev bond0 FreeBSD 8.x & 10.x 1、临时路由 # route add -net 192.100.0.0/16 102.100.10.254 2、永久路由 # vi /etc.rc.conf static_routes="net1 net2 net3" route_net1="-net 192.100.0.0/16 192.100.10.254" route_net2="-net 172.200.0.0/16 192.100.10.254" route_net3="-net 192.168.0.0/16 192.100.10.254" OpenBSD 5.x 1、临时路由 参考FreeBSD 2、永久路由 # vi /etc/hostname.bnx0 !route add -net 172.200.0.0 -netmask 255.255.255.0 192.100.9.254 HP unix 1、临时路由 # route add net 172.214.0.0 netmask 255.255.255.0 172.203.13.254 1 2、永久路由 # vi /etc/rc.conf.d/netconf ROUTE_DESTINATION[1]="net 172.214.0.0" ROUTE_MASK[1]="255.255.255.0" ROUTE_GATEWAY[1]="172.203.13.254" ROUTE_COUNT[1]="1" ROUTE_ARGS[1]="" (责任编辑:IT) |