用源IP Ping IP?

use*_*989 6 windows command-line ping

我正在尝试发送 ping,但使用源 Ip。试过这个,

ping example.org -i 88.65.48.77
Run Code Online (Sandbox Code Playgroud)

它 ping 没有任何错误,但我很困惑。在手册中,它说 -S 是一个源操作符。但是如果我使用 -S 88.65.48.77,我会得到一个Ping Transmit failed. General Error.那么正确的方法是什么?

Mar*_*art 5

-S当您有多个网络接口卡 (NIC),并且您希望ping来自特定 NIC 时,您才需要/想要该标志;这很少需要。你的命令

ping example.org -i 88.65.48.77
Run Code Online (Sandbox Code Playgroud)

实际上是用 TTL(生存时间)值 88.65.48.77 来 ping example.org,其中 -i 实际上期望最大“跳数”——比如 10,而不是 IP 地址。

因此,如果您尝试 ping 88.65.48.77,只需

ping 88.65.48.77
Run Code Online (Sandbox Code Playgroud)

  • 抱歉,您无法使用 ping 命令欺骗您的 IP 地址。一些网络协议分析器可以通过生成“经过修改的”数据包来实现这一点,但不能使用 ping 命令。 (3认同)

小智 5

在不同环境中使用源地址检查您的网络。

如果您是 Windows 用户,请使用以下命令。例子:

ping target address(x.x.x.x) -S source address(x.x.x.x)
Run Code Online (Sandbox Code Playgroud)

如果您是 Linux 用户,请使用以下命令。例子:

ping -I source address(x.x.x.x) target address(x.x.x.x) 
Run Code Online (Sandbox Code Playgroud)

在 Cisco 设备中使用以下命令示例:

ping target address(x.x.x.x) source source address(x.x.x.x)
Run Code Online (Sandbox Code Playgroud)