Let's say you want to connect to the Internet and you pinged a.b.c.d. Because you thought it's your default gateway, but it's actually the address of another network device. How can you tell you've pinged the wrong thing? Of course, ipconfig or ifconfig shows the default gateway, but is there a different way to do this using ping or another command?
1 Answer
Actually the answer is No.
ping is a troubleshooting command line tool which's task is to send ICMP packets to other host. When we ping any IP address it generates ICMP Echo Requests, if the packet can reach the destination successfully the destination device will respond with ICMP Echo Response. The main purpose of this is to check if a server, website or host is live or dead, and check network hardware or check if IP is working in computer. Sometimes the output shows even the resolved IP address of domain names through DNS, and the ping Latency shown in MS is also a important information.
Here ipconfig or ifconfig shows your network configurations for different network interfaces. It will show your private IP address, subnet mask, default gateway, primary and alternate DNS servers. So they can tell what is the IP address of your Gateway. But directly using ping you cannot tell if you are pinging any gateway or any other host.