Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Question about PING 4

Status
Not open for further replies.

Accessdabbler

Technical User
Oct 15, 2002
728
0
0
CA
Does PING 127.0.0.1 accomplish the same thing as "pinging" your NIC's actual IP address?
 
Yes. 127.0.0.1 is a local loopback configured automatically on IP devices.
 
Thanks. I thought so but I could not find it written anywhere that ping 127.0.0.1 was the equivalent to ping <NIC IP address>.
 
That is not really true. The 127.0.0.1 address is a loopback and is not associated with a physical device. A proper response from 127.0.0.1 indicates only that TCP/IP is installed and the stack is functioning. A proper response from your NIC IP address indicates that TCP/IP is bound to a particular interface and the interface is up.
 
OK, I used a packet sniffer (Ethereal) to monitor a ping session. Pinging 127.0.0.1 or the actual NIC's IP address does not generate any packets on the wire. I thought this odd.

So, what is this ping actually doing? Generating packets that &quot;bounce&quot; off the bottom physical layer and back up the stack? I was expecting the packet to go out on the wire and be reflected back to the NIC. A successful ping to the localhost seems to prove that internal packets work but it doesn't actually test if the NIC can spit a packet out on the wire. Or, am I missing something here?

If pinging the localhost failed, what does that tell me? Bad NIC? TCP/IP problem?
 
A ping never makes it to the physical layer (layer 1). The ICMP message is generated at the newtwork layer (layer 3) (I think), sent to the data link layer (layer 2). Layer 2 turns it around and sends it back to layer 3 before it ever hits the hardware.

A failed ping to localhost (127.0.0.1) indicates a problem with either the IP protocol or one of its components, or a problem with layer 2, which is generally ethernet. Has absolutely nothing to do with the physical layer (hardware) as the loopback is a virtual device, there is no physical layer involved. Could be a bad configuration or a corrupted driver.

A failed ping to an address belonging to the host in question also indicates a problem at layer 2 or 3. Difference is that it could be the result of a layer 1 problem, not because layer 1 is directly involved, but because layer 2 and those above are dependent upon a existence and proper function of a device. If the physical or virtual device is not present or is not functioning properly, it may not allow the higher layers to load or it may disrupt their function.

You should also note that a good ping to either local address does not indicate a good physical connection. It is entirely possible that the layers involved are loaded and functioning with a problem at the physical layer.

That was the long answer. Short answer, if a ping to localhost fails, it generally would indicate a problem with TCP/IP or the layer 2 service (ethernet). If a ping to an external address assigned to the host fails after a successful ping to localhost, it generally indicates that there is a problem with the device that has holds that address. It does not necessarily indicate a hardware problem, although a hardware problem could be the undelying cause.

Guess that one wasn't all that short either. Oh well, hope some of it makes sense.
 
It does. I was under the impression that &quot;ping localhost&quot; told us whether the NIC could send and receive packets over the wire (ie. all functions of the NIC work). My book here says, &quot;First, use PING with the loopback address to determine if the system can send and receive packets. If you're not getting a good response, your NIC has a problem!&quot;

This isn't entirely true as the problem could be with the TCP/IP stack or the NIC. But even a successful response doesn't fully exonerate the NIC from being the culprit when there is a problem. I have difficulty imagining what could be wrong if ping 127.0.0.1 works but ping <NIC address> doesn't.
 
I have pluged out my Netwrok card and then tried 'ping 127.0.0.1'. But I didn't get any response. It said &quot;75% packets lost&quot;. Can anybody tell me the reason? If 'ping 127.0.0.1' checks only the NIC of the local PC then it should work.

Thanks,
P.SenthilKumar
 
Ping 127.0.0.1 never ping the IP belonging to your PC.
Run &quot;route print&quot; in &quot;cmd&quot;,you can find that:
A NIC has two IP: one is the regular IP(just like 192....),the other is 127.0.0.1,a loopback address,not for the real use.
 

Ping 127.0.0.1 never ping the IP belonging to your PC.

The IP belonging to your PC??

You're *clearly* a windows person. An IP address is not bound to a host (computer) at all and 127.0.0.1 is not bound to a NIC.

IP addresses are bound to interfaces, NIC and loopback interfaces, for example. The 127.0.0.1 address is just as real as any other. In fact it is used all the time by applications and a computer wouldn't function without it.

A NIC can have just as many addresses as you like. They're not bound to the host or the hostname at all.

Cheers Henrik Morsing
Certified AIX 4.3 Systems Administration
& p690 Technical Support
 
Mr. Morsig,

But if anything is &quot;bound&quot; to a host, ip 127.0.0.1 certainly is.

If your point was that localhost is not bound to the NIC this is correct. But it has no reality without the host.

If your point is that other IPs are bound to the NIC and not the host this is a quibble that serves no purpose that I can see for this thread discussion other than to let you vent a gratuitous jibe at the Windows-using responder.

 

...vent a gratuitous jibe at the Windows-using responder.

You probably partly right. Sorry about that.

My vent did answer the original question though: &quot;Does pinging 127.0.0.1 accomplish the same as pinging the actual NIC address?&quot;.

No, because 127.0.0.1 is bound to the 'lo' interface (not the host) and the 'lo' interface is a virtual interface.
I'll still argue that a host in itself does not have IP addresses or interfaces.

But what happens when you ping locally bound IP addresses is
the same because the IP layer (3) cathces the packet and returns it before it hits the physical (1) layer.

Cheers

Henrik Morsing
Certified AIX 4.3 Systems Administration
& p690 Technical Support
 
To muddy the waters a bit (and maybe learn something in the process), I would say that 127.0.0.1 is as real as any other IP address.

Surely messing about with IP addresses are the the function of TCP/IP not the NIC.
The NIC is concerned with Ethernet packets which are the electrical side of things. It cares about Ethernet(MAC) addresses. If it captures a packet with its Ethernet address it accepts it and passes the guts of the packet on up to the protocol layers for them to sort out.

BTW - Reading through the WATCOM TCP/IP source code - data sent to 127.0.0.1 is looped-back before it reaches the NIC related stuff.
 
I would say that to answer succinctly the original question that pinging 127.0.0.1 is not the same as pinging the NIC IP. From a troubleshooting perspective, if you can't ping 127.0.0.1 you are having a problem with the TCP/IP stack on your machine and should troubleshoot this problem posthaste.
If on the other hand you can ping 127.0.0.1 but can not ping the NIC IP address, you should ensure that your NIC is configured properly with regards to addressing and determine whether your NIC card has inserted into the network. Most often in this scenario, the problem is related to configuration or physical media.

Each platform is different in how you should respond when ping 127.0.0.1 fails but in all instances you would want to figure out what is wrong with TCP/IP 1st. Windows is peculiar because you must install an adapter to bind TCP/IP to before you can ping 127.0.0.1 which is not the same on many other platforms.
 
Thanks for everyone's comments! I'm preparing to write the Network+ Exam and most sources I've read talk about pinging 127.0.0.1 to test the NIC then, if this passes, to ping another address on the network.

I guess I wanted to know if pinging the NIC's IP address should be the next step instead?
 

I would say no (but I know absolutely nothing about Windows). I assume the question isn't Windows related.

Pinging the NIC address wouldn't get any further than pinging 127.0.0.1 because the IP layer returns the packet after inspecting the routing table.

If they don't behave the same, it's a routing problem not an IP problem.

Cheers

Henrik Morsing
Certified AIX 4.3 Systems Administration
& p690 Technical Support
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top