Linux下使用指定網(wǎng)卡進(jìn)行ping操作
# ping --help ping: invalid option -- '-' Usage: ping [-aAbBdDfhLnOqrRUvV64] [-c count] [-i interval] [-I interface] [-m mark] [-M pmtudisc_option] [-l preload] [-p pattern] [-Q tos] [-s packetsize] [-S sndbuf] [-t ttl] [-T timestamp_option] [-w deadline] [-W timeout] [hop1 ...] destination
1 # man ping I interface3 interface is either an address, or an interface name. If interface is an4 address, it sets source address to specified interface address. If interface in5 an interface name, it sets source interface to specified interface. For IPv6,6 when doing ping to a link-local scope address, link specification (by the7 '%'-notation in destination, or by this option) is required.
# . PING . (.) ( bytes from .: icmp_seq= ttl= = bytes from .: icmp_seq= ttl= =
# ping I 192.168.187.10 172.16.0.112 PING 172.16.0.11 (172.16.0.11) from 192.168.187.10 : 56(84) bytes of data. From 192.168.187.10 icmp_seq=1 Destination Host Unreachable
# ping I ens33 192.168.187.112 PING 192.168.187.11 (192.168.187.11) from 192.168.187.10 ens33: 56(84) bytes of data. 64 bytes from 192.168.187.11: icmp_seq=1 ttl=64 time=18.1 ms4 64 bytes from 192.168.187.11: icmp_seq=2 ttl=64 time=4.11 ms
1 # ping -I 本機指定網(wǎng)卡名或網(wǎng)卡的IP地址 目標(biāo)地址
*博客內(nèi)容為網(wǎng)友個人發(fā)布,僅代表博主個人觀點,如有侵權(quán)請聯(lián)系工作人員刪除。