arp tables lookup algorithms

3
Introduction ARP (Address Resolution Protocol) is a data link layer protocol used in networks to find out the physical address of other hosts based on their IPs. This protocol generates ARP tables, that consist of IP and MAC addresses tables that contain the addresses of all devices connected to the network in which a certain machine is placed on. Routers keep these ARP tables because when they receive a packet that is destined for a host with a specific IP address, they may need to know the MAC address of the destination host in order to able to forward packets towards the correct direction. In the creation or update processes of these tables, routers send a broadcast request to the network in which the destination host is on. This request has the IP it wants to know the physical address associated, and the host that recognises this IP as its own reply with its MAC. Each machine in a network maintains its own ARP cache with an ARP table. This is done with the aim of diminishing latency on communications and the load in networks according to http://pt.wikipedia.org/wiki/Address_Resolution_Protocol. Figure 1 shows an example of ARP tables: Figure 1: ARP Table example With the aim performing queries upon these tables, machines make use of lookup algorithms. These algorithms (also called search algorithms) are defined as a

Upload: douglas-mangini

Post on 24-Jan-2016

10 views

Category:

Documents


0 download

DESCRIPTION

RP Table Lookup Algorithms

TRANSCRIPT

Page 1: ARP Tables Lookup Algorithms

Introduction

ARP (Address Resolution Protocol) is a data link layer protocol used in networks to find out the physical address of other hosts based on their IPs. This protocol generates ARP tables, that consist of IP and MAC addresses tables that contain the addresses of all devices connected to the network in which a certain machine is placed on.

Routers keep these ARP tables because when they receive a packet that is destined for a host with a specific IP address, they may need to know the MAC address of the destination host in order to able to forward packets towards the correct direction.

In the creation or update processes of these tables, routers send a broadcast request to the network in which the destination host is on. This request has the IP it wants to know the physical address associated, and the host that recognises this IP as its own reply with its MAC.

Each machine in a network maintains its own ARP cache with an ARP table. This is done with the aim of diminishing latency on communications and the load in networks according to http://pt.wikipedia.org/wiki/Address_Resolution_Protocol.

Figure 1 shows an example of ARP tables:

Figure 1: ARP Table example

With the aim performing queries upon these tables, machines make use of lookup algorithms. These algorithms (also called search algorithms) are defined as a procedure “for finding items with specified properties among a collection of items” (a table, in this case) in http://en.wikipedia.org/wiki/Search_algorithm. The chosen lookup algorithms implemented in the devices of a network can affect its delay, making them significantly slower if the algorithms are not well designed.

This report will analyse three algorithms that can be used in the context of searching upon an ARP table regarding their efficiency and viability, which are Linear Search (also known as Exact-match lookup), Binary Search and a mix of Prefix-match with Binary Search. Measurements as average elapsed time, average number of needed iterations, and memory usage were done and compared. Also, an overview of their theoretical complexity is given when applicable.

Page 2: ARP Tables Lookup Algorithms

Procedure

A set of one thousand IPs and associated MAC addresses were created randomically and put inside of a matrix for serving an ARP table. Implementations of Linear Search, Binary Search and a fusion between Binary Search and Prefix-Match Lookups were also developed. These algorithms were chosen based on the book Network Algorithmics of G. Varghese.

Linear search consists in verifying elements one by one in a list. Binary Search assumes an ordered list and starts the search by its middle. It cuts the amount of elements it needs to verify by half in each iteration by analysing if the element searched in higher or lower than the one it is comparing to in that iteration (then it continues to search only in the part of the list that the element could be). Prefix-match uses the prefix of the IP to diminish the searching area, because it only needs to search the ARP table on the part of it where the IPs with the same prefix are located.

After, a testing software was coded. It consists in randomically generating fifty IPs and searching them on the ARP table. After each search, the testing software takes in account the time elapsed, number of iterations that were done and the amount of memory that was used.

With those measurements, the average of the first two values were calculated and are here presented in Graphs 1 and 2.

The results were expected because the Linear Search algorithm has a complexity of O(n) in its average case, while Binary Search’s one is O(log n).

Conclusion

From the three algorithms analysed, the combined version of Prefix-match with Binary Search was the one that presented the best performance. With way less time consumed and iterations needed to find an IP (on average), it saves reasonable resources and causes a lot less delay on the network than Linear Search. Pure Binary Search presented a relatively good performance, ranking second in this test, but still being extremely better the Linear Search.