How does the sender of a data packet know the IP address of the receiver? Part 1

How does the sender of a data packet know the IP address of the receiver?
There are two possible scenarios we need to analyze to cover your question. In both scenarios, we will assume as valid hosts, i.e. two computers, trying to transfer data between each other. This will also help keep the examples simple to understand and at the same time provide all the essential details. In the first scenario we will examine how data communication takes place between two computers that are located within the same office/network, while the second scenario will examine two computers transferring data between each other via the Internet.

1st Scenario – Both hosts within the same network

Host1-----{Switch}----Host2

In this case, Host1 (IP 192.168.0.10) needs to transfer data to Host2 (IP 192.168.0.12). Since both hosts are within the same network and connected to the same switch, Host1 will need to firstly find Host2's MAC (hardware) address so it can construct its packet and place it on the network. The ARP (Address Resolution Protocol) is used for this purpose.

In the case Host1 knows Host2 only by its name, e.g Computer-2, then it will send a request to either a local DNS server or Wins server to ask for "Computer-2's" IP address. Think of it like a phone directory, where the caller looks up a name, and finds the phone number that's mapped it that name. This whole "lookup" process is determined by the operating systems running in the network and the way naming resolution has been setup by its administrator:

Host1-----{Switch}----Host2
              |
DNS/Wins -----|
Server

Host1 sends an ARP request that contains the following message understood by all network devices: "What is the MAC address for IP address 192.168.0.12?" All devices on the network will 'see' the message, but only Host2 will respond by sending a packet containing its MAC address.

Once Host1 receives this information, it now has enough details to create its packet. Once constructed, the packet will contain the following details:

  1. Destination MAC address (That's Host2's MAC address)
  2. Source MAC address (Host1's MAC address)
  3. Destination IP address (192.168.0.12)
  4. Source IP address (192.169.0.10)
  5. Application Data

As you can see, the senders IP address is included in the packet. This also explains how in this scenario, Host2 who's the receiver, knows about the sender.

Let's now take a look at our 2nd scenario.

Dig Deeper on Network infrastructure

Unified Communications
Mobile Computing
Data Center
ITChannel
Close