本文介绍在Linux上操作路由相关的命令,Windows上路由相关的,请参看:https://blog.terrynow.com/2021/08/20/windows-server-cmd-route-related-commands/
- 查看路由信息
使用netstat -r
[root@ecs-587c opt]# netstat -r Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface default gateway 0.0.0.0 UG 0 0 0 eth0 169.254.169.254 192.168.0.254 255.255.255.255 UGH 0 0 0 eth0 192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
- 添加路由
sudo route -n add 192.168.0.0/16 10.22.0.253 #指定interface route add -host 54.81.143.201 -interface en0 #redhat: ip route add 10.22.0.0/16 via 192.168.23.254
- 删除路由
route delete 10.2.0.0
文章评论