linux 路由配置——route命令
阿新 • • 發佈:2019-02-18
新增到主機的路由
# route add -host 192.168.1.2 dev eth0:0 # route add -host 10.20.30.148 gw 10.20.30.40
新增到網路的路由
# route add -net 10.20.30.40 netmask 255.255.255.248 eth0 # route add -net 10.20.30.48 netmask 255.255.255.248 gw 10.20.30.41 # route add -net 192.168.1.0/24 eth1
新增預設路由
# route add default gw 192.168.1.1
刪除路由
# route del -host 192.168.1.2 dev eth0:0 # route del -host 10.20.30.148 gw 10.20.30.40 # route del -net 10.20.30.40 netmask 255.255.255.248 eth0 # route del -net 10.20.30.48 netmask 255.255.255.248 gw 10.20.30.41 # route del -net 192.168.1.0/24 eth1 # route del default gw 192.168.1.1