ubuntu 添加/删除路由,traceroute

路由

add route

ip route add {NETWORK/MASK} via {GATEWAYIP}
ip route add {NETWORK/MASK} dev {DEVICE}
ip route add default {NETWORK/MASK} dev {DEVICE}
ip route add default {NETWORK/MASK} via {GATEWAYIP}

delete route

sudo route del -net 0.0.0.0 gw 192.168.178.1 netmask 0.0.0.0 dev eth0

show route

route -n
ip route show
ip r

路由表中 proto 的含义

             redirect - the route was installed due to an ICMP redirect.

             kernel - the route was installed by the kernel during
                   autoconfiguration.

             boot - the route was installed during the bootup sequence.
                 If a routing daemon starts, it will purge all of them.

             static - the route was installed by the administrator to
                   override dynamic routing. Routing daemon will
                   respect them and, probably, even advertise them
                   to its peers.

             ra - the route was installed by Router Discovery protocol.

其它项的具体解释可在 ip route 8 man page 找到

参考

https://www.cyberciti.biz/faq/ip-route-add-network-command-for-linux-explained/
https://serverfault.com/questions/181094/how-do-i-delete-a-route-from-linux-routing-table
https://stackoverflow.com/questions/10259266/what-does-proto-kernel-means-in-unix-routing-table

traceroute

traceroute 结果解读

  • !H 表示目标地址不可达
  • * 表示目标地址无回复
  • * * * 表示 traceroute 被防火墙阻挡

参考

https://networkengineering.stackexchange.com/questions/16454/difference-between-unresponsive-and-unreachable-h-hosts-in-traceroute-out
https://linux.die.net/man/8/traceroute
https://www.geeksforgeeks.org/how-to-read-a-traceroute/

posted @ 2022-09-19 14:47  略略略——  阅读(914)  评论(0编辑  收藏  举报