Windows : ping -S
Linux : ping -I <device>
-I interface
interface is either an address, or an interface name. If interface is an address, it sets source address to specified interface address. If interface in an
interface name, it sets source interface to specified interface. For IPv6, when doing ping to a link-local scope address, link specification (by the
\'%\'-notation in destination, or by this option) is required.
➜ Desktop ping -I wlp3s0 baidu.com PING baidu.com (123.125.115.110) from 10.210.10.160 wlp3s0: 56(84) bytes of data.
➜ Desktop ping -I tun0 baidu.com PING baidu.com (220.181.57.216) from 10.72.12.142 tun0: 56(84) bytes of data.
保持更新,转载请标明出处。