-1

So, if one PC will use another PC's IP address for ARP resolution, how does the PC sending the ARP Request even know which IP address to call for in the first place? What happens in a scenario where the PCs are directly connected (i.e. there is no intermediary network device like a switch)?

closed as unclear what you're asking by YLearn Jul 17 '15 at 18:20

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • how does the PC sending the ARP Request even know which IP address to call for in the first place? - Well why would one PC send an ARP in the first place, why would a PC ever need to know the IP of another? To connect to that PC of course! I open my browser an tell my computer I want to connect to www.google.com so my PC has to ARP out for my default-gateway so start the process of DNS resolution and eventually TCP connectivity to a web server. – jwbensley Jul 15 '15 at 11:03
  • @jwbensley I'm asking how ARP resolution is performed, not why an IP address is necessary (see this serverfault.com/questions/410626/… for an answer to the latter question). See the responses below for a better idea of what I'm looking for. – logsofrhythms Jul 15 '15 at 18:10
  • You could improve your question by editing it. You may find our Question Checklist helpful when editing your question. I am tempted to cast a close vote for either "unclear what you are asking" or "too broad" as you seem to be mixing concepts. Why do I think it is unclear: you ask about ARP, but then you ask how IP addresses are learned, which has nothing to do with ARP. Why do I think it is too broad: it is almost vague enough to fall into a "how does networking work" type question as it stands. – YLearn Jul 15 '15 at 21:35
  • @YLearn I asked about IP addressing as a further question in remark to somebody else's answer. That has nothing to do with the initial question. Thus, I'm quite scrambled as to why you would want to close it. Perhaps you misunderstood the difference? It would also be helpful if, as a moderator, you referenced such extensions on an answer given by users. For example, were you referring to JJ or Pieter's answer? – logsofrhythms Jul 16 '15 at 1:52
  • @logsofrhythms, from the title and body respectively: "learn each other's IP addresses" and "which IP address" clearly show you are asking about how the IP addresses are found. Yet you mention ARP more than anything else and use the arp tag. Ultimately the question has nothing at all to do with ARP which is why the question is unclear and causes confusion to people who read it. This confusion is why you got the two answers you reference (that mention ARP a total of once between them) and one that addresses ARP only. Your concepts are mixed and what you are asking is unclear. – YLearn Jul 16 '15 at 3:56
0

You're correct in thinking that the two machines will have no way of knowing each other's IP addresses initially, and there are a few different ways in which this problem can be solved.

In a directly connected scenario in a home network with windows PCs, chances are that NetBIOS will be used for name resolution. You can find out more about this protocol in the appropriate RFC, here: https://tools.ietf.org/html/rfc1001

You can think of this as working in a similar way to ARP, insofar as the computer who wants to find out the IP address associated with a certain name will send out a broadcast message to every device on its subnet to find out if any of them have the name in question.

Once the target device has replied, the original machine then knows which IP to use for this name, and also vice versa, since the NetBIOS broadcast contains the same information about the sender.

There's good answer with details about NetBIOS here as well: https://serverfault.com/questions/352305/why-can-windows-machines-resolve-local-names-when-linux-cant . I don't know much about apple devices, but I believe that they use a similar protocol called "bonjour", although someone may correct me on this, and on linux, you're likely to come across Avahi (http://www.avahi.org/) as the solution to this problem.

In a non-windows situation, or in a large business network where NetBIOS is likely to be disabled because of security concerns, name resolution is likely to be controlled via DNS. Servers may have their DNS server addresses hard coded, and workstations are likely to receive their DNS server information via DHCP. Quite often the DNS and DHCP servers will be running on the same host.

DNS is pretty complicated. If you want to REALLY understand how it works, the rfc is here: https://www.ietf.org/rfc/rfc1035.txt , however the wikipedia article is probably good enough for a basic understanding.

The basic idea though, is that if a computer doesn't know what IP address is associated with a given name, it can ask it's DNS server. Assuming that your network is set up correctly, when a DHCP lease if given out, or a static IP address is assigned to a machine, a DNS record should also be created on the DNS server.

Finally, most operating systems have a "hosts" file, which contains a list of names and associated IP addresses. If there is an entry in this file for a given name, then the OS will just use that IP address and be done with it. On a windows machine, this is located at C:\windows\system32\drivers\etc\hosts. By default it's pretty empty, you just have one entry mapping "localhost" to 127.0.0.1.

  • Ha, I always wondered why I had to enter a computer's host name when initially configuring a host! So, if I have this right, then the computer's host name is used by NetBIOS for a NetBIOS name and through NetBIOS name resolution, a PC can learn about the IP addresses on its subnet with which it may use ARP resolution to learn their MAC addresses as well? – logsofrhythms Jul 15 '15 at 17:28
0

The ip is configured into the application that does the connection as either a dns name(resolved to ip via dns server) or as a IP static IP.

There are also auto-discovery protocols that utilise broadcasts and multi casts to advertise and find services. e.g. avahi

If pc's are auto configured using DHCP, the dhcp lease includes information such as DNS server ip, GW-ip, and can even include additional auto configuration information.

0

Your initial question seems to be about name resolution, but on your comment bellow you ask

How ARP resolution is performed.

I'll try to address that question.


A brief explanation of ARP resolution

When a network device needs to find the MAC address of an IP it will send a packet with destination MAC address FF:FF:FF:FF:FF:FF.

This is considered a broadcast mac address so the switch will simply flood the packet to all ports (if vlans are used then only to the ports belonging to the same vlan).

The broadcast packet is an ARP Request message, essentially asking every device on the network 'Who has this IP?'

All the devices will receive the ARP Request and the one that has the IP configured will reply back with an ARP Reply message from its MAC Address to the device's MAC address that sent the ARP Request.

So it receives the reply and adds the IP <> MAC pair to it's ARP table cache.

For as long as the entry is in cache, whenever it needs to communicate with that device it will know how to send the packets directly to its MAC address.

If the entry is expired, it will re-sent an ARP Request message and the process starts from the beginning.

This is a very crude explanation of course. There are many tutorials explaining this in great detail.

With a quick google search I came up with a nice one with graphs and all :)
http://www.omnisecu.com/tcpip/address-resolution-protocol-arp.php
http://www.tummy.com/articles/networking-basics-how-arp-works/

Now, to answer your question regarding 2 devices directly connected, the same principle applies in that case too. ARP resolution works the same way weather it's a direct connection or using a switch with tens of devices.

Not the answer you're looking for? Browse other questions tagged or ask your own question.