route的基本用法

route -n 查看

route add 增加

route add [-net|-host] target [netmask Nm] [gw Gw] [[dev] If]

目标:192.168.1.3 网关:172.16.0.1

route add -host 192.168.1.3 gw 172.16.0.1 dev eth0

目标:192.168.0.0 网关:172.16.0.1

route add -net 192.168.0.0 netmask 255.255.255.0 gw 172.16.0.1 dev eth0

route add -net 192.168.0.0/24 gw 172.16.0.1 dev eth0

默认路由,网关:172.16.0.1

route add -net 0.0.0.0 netmask 0.0.0.0 gw 172.16.0.1

route add default gw 172.16.0.1

删除:route del

route del [-net|-host] target [gw Gw] [netmask Nm] [[dev] If]

目标:192.168.1.3 网关:172.16.0.1

route del -host 192.168.1.3

目标:192.168.0.0 网关:172.16.0.1

route del -net 192.168.0.0 netmask 255.255.255.0

你可能感兴趣的:(centos,运维)