Working of ARP and IP Forwarding in LAN and Across A Router

Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

Ver 14.

1 Understand working of ARP and IP


Forwarding within a LAN and across a router
(Level 1)
1.1 Theory
In network architecture different layers have their own addressing scheme. This helps the
different layers to be largely independent. The application layer uses host names, network
layer uses IP addresses, and the link layer uses MAC addresses. Whenever a source node
wants to send an IP datagram to a destination node, it needs to know the address of the
destination. Since there are both IP addresses and MAC addresses, there needs to be a
translation between them. This translation is handled by the Address Resolution Protocol
(ARP). In IP network, IP routing involves the determination of suitable path for a network
packet from a source to its destination. If the destination address is not on the local network,
routers forward the packets to the next adjacent network.

(Reference: A good reference for this topic is Section 5.4.1: Link Layer Addressing and ARP, of the book,
Computer Networking, A Top-Down Approach, 6th Edition by Kurose and Ross)

1.2 ARP protocol Description


1. ARP module in the sending host takes any IP address as input and returns the
corresponding MAC address.
2. First the sender constructs a special packet called an ARP packet, which contains
several fields including the sending and receiving IP and MAC addresses.
3. Both ARP request and response packets have the same format.
4. The purpose of the ARP request packet is to query all the other hosts and routers on the
subnet to determine the MAC address corresponding to the IP address that is being
resolved.
5. The sender broadcasts the ARP request packet, which is received by all the hosts in the
subnet.
6. Each node checks if its IP address matches the destination IP address in the ARP
packet.
7. The one with the match sends back to the querying host a response ARP packet with
the desired mapping.
8. Each host and router have an ARP table in its memory, which contains mapping of IP
addresses to MAC addresses.

© TETCOS LLP. All rights reserved Page 1 of 9


Ver 14.0

9. The ARP table also contains a Time-to-live (TTL) value, which indicates when each
mapping will be deleted from the table.

1.3 ARP Frame Format

Figure 1-1: ARP Frame Format

The ARP message format is designed to accommodate layer two and layer three addresses
of various sizes. This diagram shows the most common implementation, which uses 32 bits
for the layer three (“Protocol”) addresses, and 48 bits for the layer two hardware addresses.

1.4 IP Forwarding Description


1. Every router has a forwarding table that maps the destination addresses (or portions of
the destination addresses) to that router’s outbound links.
2. A router forwards a packet by examining the value of a field in the arriving packet’s
header, and then using this header value to index into the router’s forwarding table.
3. The value stored in the forwarding table entry for that header indicates the router’s
outgoing link interface to which that packet is to be forwarded.
4. Depending on the network-layer protocol, the header value could be the destination
address of the packet or an indication of the connection to which the packet belongs.
5. ARP operates when a host wants to send a datagram to another host on the same
subnet.
6. When sending a Datagram off the subnet, the datagram must first be sent to the first-
hop router on the path to the final destination. The MAC address of the router interface
is acquired using ARP.
7. The router determines the interface on which the datagram is to be forwarded by
consulting its forwarding table.
8. Router obtains the MAC address of the destination node using ARP.
9. The router sends the packet into the respective subnet from the interface that was
identified using the forwarding table.

© TETCOS LLP. All rights reserved Page 2 of 9


Ver 14.0

1.5 Network Set up


Open NetSim and click on Experiments> Internetworks> Routing and Switching >
Working of ARP and IP Forwarding within a LAN and across a router then click on the
tile in the middle panel to load the as shown in example see Figure 1-2.

Figure 1-2: List of scenarios for the example of Working of ARP and IP Forwarding within a LAN and
across a router

NetSim UI displays the configuration file corresponding to this experiment as shown below
Figure 1-3.

Figure 1-3: Network set up for studying the ARP across a LAN

© TETCOS LLP. All rights reserved Page 3 of 9


Ver 14.0

1.6 Procedure
ARP across a LAN

The following set of procedures were done to generate this sample:

Step 1: A network scenario is designed in NetSim GUI comprising of 3 Wired Nodes, 2 L2


Switches, and 1 Router in the “Internetworks” Network Library.

Step 2: Configure an application between any two nodes by selecting a CBR application
from the Set Traffic tab. Right click on the Application Flow App1 CBR and select
Properties.

A CBR Application is generated from Wired Node 1 i.e., Source to Wired Node 2 i.e.,
Destination with Packet Size remaining 1460Bytes and Inter Arrival Time remaining
20000µs.

Transport Protocol is set to UDP instead of TCP. If set to TCP, the ARP table will get
updated due to the transmission of TCP control packets thereby eliminating the need for
ARP to resolve addresses.

Step 3: Packet Trace is enabled in the NetSim GUI, and hence we can view the ARP
Request and ARP Reply packets exchanged initially, before transmission of the data
packets.

Step 4: Enable the plots and click on Run simulation. The simulation time is set to 10
seconds.

Step 5: Under Options, the “Static ARP” tab, Static ARP is set to disable see Figure 1-4.

Figure 1-4: Static ARP Configuration Window


Click on OK.

If Static ARP is enabled, then NetSim will automatically create an ARP table for each node.
To see the working of the ARP protocol users should disable Static ARP.

© TETCOS LLP. All rights reserved Page 4 of 9


Ver 14.0

By doing so, ARP request would be sent to the destination to find out the destinations MAC
Address.

1.7 Output – ARP across a LAN


Once the simulation is complete, to view the packet trace file, click on “Open Packet Trace”
option present in the left-hand-side of the Results Dashboard.

Figure 1-5: Open Packet Trace

NODE 1 will send ARP_REQUEST to SWITCH-4, SWITCH-4 sends this to ROUTER-6, and
SWITCH-4 also sends this to NODE-2. ARP-REPLY is sent by the NODE-2 to SWITCH -4,
and in-turn SWITCH-4 sends it to NODE-1.

1.8 Discussion – ARP across a LAN


Intra-LAN-IP-forwarding:

ARP PROTOCOL- WORKING:

Figure 1-6: Intra LAN IP Forwarding

NODE-1 broadcasts ARP_Request, which is then broadcasted by SWITCH-4. NODE-2


sends the ARP_Reply to NODE-1 via SWITCH-4. After this step, datagrams are transmitted
from NODE-1 to NODE-2. Notice the DESTINATION_ID column for ARP_Request type
packets, which indicates Broadcast-0.

ARP across a WAN

NetSim UI displays the configuration file corresponding to this experiment as shown below
Figure 1-7.

© TETCOS LLP. All rights reserved Page 5 of 9


Ver 14.0

Figure 1-7: Network set up for studying the ARP across a WAN

1.9 Procedure
The following set of procedures were done to generate this sample.

Step 1: A network scenario is designed in the NetSim GUI comprising of 3 Wired Nodes, 2
L2 Switches, and 1 Router.

Step 2: Click on Set Traffic tab and configure any application between the nodes. Right click
on the application and set the properties.

APP 1 CBR is created from Wired Node 1 to Wired Node 3, Packet size set as 1460 bytes
and Inter arrival time as 20000 Micro sec and Transport layer protocol to UDP.

APP 2 CBR is created from Wired Node 2 to Wired Node 3, Packet size set as 1460 bytes
and Inter arrival time as 20000 Micro sec and Transport layer protocol to UDP. Additionally,
the start time is set to 1 second and end time to 3 second.

Transport Protocol is set to UDP instead of TCP. If set to TCP, the ARP table will get
updated during transmission of TCP control packets thereby eliminating the need for ARP to
resolve addresses.

Step 3: Packet Trace is enabled in the NetSim GUI, and hence we can view the ARP
Request and ARP Reply packets exchanged initially, before transmission of the data
packets.

Step 4: Click on Run simulation. The simulation time is set to 10 seconds.

Step 5: Under Options, the “Static ARP” tab, Static ARP is set to disable.

© TETCOS LLP. All rights reserved Page 6 of 9


Ver 14.0

1.10 Output I – ARP across a WAN

Once the simulation is complete, to view the packet trace file, click on “Open Packet Trace”
option present in the left-hand-side of the Results Dashboard.

In packet trace, filter the CONTROL PACKET TYPE/ APP NAME filed to view APP 1CBR,
ARP_REQUEST, ARP_REPLY.

Figure 1-8: Open Packet Trace

NODE 1 will send ARP_REQUEST to SWITCH-4, SWITCH-4 sends this to ROUTER-6, and
SWITCH-4 also sends this to NODE-2. ARP-REPLY is sent by the ROUTER-6 to SWITCH -
4, and in-turn SWITCH-4 sends it to NODE-1. Again ROUTER-6 will send ARP_REQUEST
to SWITCH-5, SWITCH-5 sends this to NODE-3. ARP_REPLY is sent by NODE-3 to
SWITCH-5 and in-turn SWITCH-5 sends it to ROUTER-6.

The IP forwarding table formed in the router can be accessed from the IP_Forwarding_Table
list present in the Simulation Results window as shown below Figure 1-9.

Figure 1-9: IP Forwarding Table


Click on Detailed View checkbox to view the additional fields as indicated above.

© TETCOS LLP. All rights reserved Page 7 of 9


Ver 14.0

Router forwards packets intended to the subnet 192.169.0.0 to the interface with the IP
192.168.0.1 based on the first entry in its routing table.

1.11 Discussion I – ARP across a WAN


From the above case we can understand that, since Router_6 did not know the destination
address, the Application packets reach only till Router_6, and ARP mechanism continues
with Router_6 re-broadcasting the ARP_REQUEST, finding the destination address and the
datagram is getting transferred to Wired node 3 (destination).

1.12 Output II – ARP across a WAN


In same packet trace, filter the CONTROL PACKET TYPE/ APP NAME column to view APP
2 CBR, ARP_REQUEST, ARP_REPLY only.

In the below figure users can observe that ARP_REQUEST is broadcasted from Wired Node
2, the ARP Reply is sent from the Router 6, upon receiving the ARP_REPLY. Router 6
directly starts sending the data packet to the Wired Node 3 unlike the previous sample.

Figure 1-10: Open Packet Trace

© TETCOS LLP. All rights reserved Page 8 of 9


Ver 14.0

1.14 Discussion II – ARP across a WAN


Across-Router-IP-forwarding

ARP PROTOCOL- WORKING

Figure 1-11: Across Router IP Forwarding


NODE-2 transmits ARP_Request which is further broadcasted by SWITCH-4. ROUTER-6
sends ARP_Reply to NODE-2 which goes through SWITCH-4. Then NODE-2 starts sending
datagrams to NODE-3. If router has the MAC address of NODE-3 in its ARP table, then ARP
ends here, and router starts forwarding the datagrams to NODE-3 by consulting its
forwarding table. Router 6, has this information updated during transmission of APP1
packets and hence ARP request for identifying the MAC address of NODE-3, need not be
sent again. In the other case (Output -I), Router sends ARP_Request to appropriate subnet
and after getting the MAC address of NODE-3, it then forwards the datagrams to NODE-3
using its forwarding table.

© TETCOS LLP. All rights reserved Page 9 of 9

You might also like