eli5:how does one host know the ip address of a destination ip address before sending data?

85 views

eli5:how does one host know the ip address of a destination ip address before sending data?

In: 4

5 Answers

Anonymous 0 Comments

Well either the software in question has the destination IP baked in… but that wouldn’t be a very robust software design. IPs shift and change all the time, that’s why we have domain names and the DNS system.

For example, www.reddit.com resolves to a particular IP address – I won’t get into CDNs and load balancers etc – when Reddit changes their server(s) or perhaps they upgrade or change their internet provider or server hosting or whatever, the actual IP address will change. But so long as they update that DNS entry that maps between www.reddit.com and <IP address>, then every computer can find it.

Basically when a software goes to send something or ask for something from qualified host/domain name, it looks it up in the DNS system. These requests are cached, so first it will look up in the cache. If not, or the msg isn’t delivered, it will query a “domain name server” – this is somewhere upstream from you, usually in your ISP somewhere. And that DNS server gets its updated domain/ip mappings from higher tier DNS servers at _their_ internet provider.

Those high level mappings between DNS names (the domains e.g. reddit.com) and IP addresses can be quite important. So there is a multi-level hierarchy of trust tiers of DNS servers. When you register a domain (foo.com) and want to point that at your webserver (IP), your domain registrar – who is trusted by the DNS authorities – adds that entry into the DNS tables, which then trickle down over minutes and hours to all other DNS servers.

Anonymous 0 Comments

that depends.

If the data was requested by another host then the IP is obviously known (return to sender)

Then there are multiple ways to get a destination address.

DNS can give you an IP for a known host. Like when you type in google.com into your browser, the browser looks up the IP before sending the request.

The host could also have the IPs of certain hosts saved locally.

Anonymous 0 Comments

The host asks the network for the answer. If that network doesn’t know the network will keep asking other networks until they get an answer and then tells the host.

Anonymous 0 Comments

[removed]

Anonymous 0 Comments

It might know it because you told it. If it doesn’t, it needs to find someone else who knows the answer. Simplified to analogy:

If you tell your friend “Deliver this to the third house on the right of this street”, they know where to take it. (This is like an IP address)

If you tell your friend “Deliver this to John’s house” (this is like a Domain Name), it only knows to go to the third house on the right if you’ve already told it that’s where John lives (Domain Name lookup).

If you haven’t told it, then your friend leaves your house, knocks on the next door neighbour’s, and asks “Do you know where John lives?”. It then repeats that process until it finds someone who can tell it the directions (this is using the Domain Name System).