2

I was watching a video explaining ARP, which was explained really easily but I got confused when they said that Host A already knows Host D ip address which is on another network.

Host A and B were connected to switch 1, switch 1 was connected to a router, the router had two interfaces, so switch 2 was connected to the other interface on the router and Host C and D were connected to switch 2.

How would Host A know the ip address of Host D since its on another network?

2

That is because the application, or you (through the application or configuration) tells your host what address to use to communicate with different host. If you want to connect to a different host, then you must know the address, or at least the DNS name that gets translated to an address from a DNS server.

A host will have configured in it (manually, or automatically with something like DHCP) a few addresses, such as that of the default gateway and DNS servers. If your application uses names instead of addresses, it takes the name and uses a DNS server to translate the name to an IP address so that the destination host can be contacted.

1

In the old days, all hostname -> IP address mappings were listed in a local file /etc/hosts.

But as the Internet grew (we're talking 1970's/1980's here) that didn't scale and the domain name system (DNS) was invented*. You would hardcode a DNS server IP address in /etc/resolv.conf. Whenever you wanted to to talk to a hostname, the resolver library would connect to the DNS server at it's (known) IP address and resolve the hostname into an IP address.

Then your host would figure out if that destination IP address was on your local network, or a different one. But that question (routing, default route, DHCP) is another story...


*See RFC 882, DOMAIN NAMES - CONCEPTS and FACILITIES and RFC 883, DOMAIN NAMES - IMPLEMENTATION and SPECIFICATION published in November 1983 for the origins of DNS.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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