gpt4 book ai didi

routing - 如何在Linux IP路由表中查找?

转载 作者:行者123 更新时间:2023-12-04 05:41:47 24 4
gpt4 key购买 nike

我一直在通过“route add”和“route del”操纵Linux路由表。现在给定一个 IP,我怎么知道(通过键入一些命令)它将通过哪个网关/设备?

例如,如果我已经运行:

route add -net 192.57.66.0 netmask 255.255.255.0 dev eth0

有没有命令可以告诉我如果我访问192.57.66.42,它会通过eth0吗?

最佳答案

你应该停止使用网络工具,因为你不会在那里找到答案。但是对于 iproute:

ip route add 192.57.66.0/24 dev eth0
ip route get 192.57.66.42

关于routing - 如何在Linux IP路由表中查找?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8952292/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com