The blog provides Network Security Tips, Tricks, How To/Procedures. Products and areas not limited to Firewalls, Security, Check Point, Cisco, Nokia IPSO, Crossbeam, SecurePlatform, SPLAT, IP Appliance, GAiA, Unix/Linux.

Linux/Unix - Use Specific Network Interface or Source IP Address To Ping A Destination Host




Ping utility has an option "-I" which allows you to use a specific network interface or source IP address to ping a destination host. Network interface name and IP addresses list can be viewed using command "ifconfig".

Syntax:


ping -I <Interface name or IP address> <Destination host name or IP address>

Example:


[root@unix]# ping -I 172.16.0.15 10.25.202.35
PING 10.25.202.35 (10.25.202.35) from 172.16.0.15 : 56(84) bytes of data.
64 bytes from 10.25.202.35: icmp_seq=1 ttl=255 time=1.24 ms
64 bytes from 10.25.202.35: icmp_seq=2 ttl=255 time=0.356 ms
64 bytes from 10.25.202.35: icmp_seq=3 ttl=255 time=0.400 ms
64 bytes from 10.25.202.35: icmp_seq=4 ttl=255 time=0.431 ms
64 bytes from 10.25.202.35: icmp_seq=5 ttl=255 time=0.556 ms
64 bytes from 10.25.202.35: icmp_seq=6 ttl=255 time=0.538 ms
64 bytes from 10.25.202.35: icmp_seq=7 ttl=255 time=0.404 ms

--- 10.25.202.35 ping statistics ---
7 packets transmitted, 7 received, 0% packet loss, time 5999ms
rtt min/avg/max/mdev = 0.356/0.561/1.245/0.288 ms
[root@unix]#


Linux/Unix - Use Specific Network Interface or Source IP Address To Ping A Destination Host Linux/Unix - Use Specific Network Interface or Source IP Address To Ping A Destination Host Reviewed by Admin on 19:02:00 Rating: 5