17

Can anyone explain which layer of the OSI model ARP belongs to and which socket it uses?

I referred to lots of books before asking this question.

In some books, Authors are saying that it belongs to the datalink layer, in some they say it belongs to the network layer. Which is correct ?

For example, BGP uses TCP socket, OSPF uses IP socket...

Mike Pennington
  • 29,876
  • 11
  • 78
  • 152
user2720323
  • 1,611
  • 9
  • 20
  • 26

3 Answers3

23

ARP is layer 2. The reason being is that a broadcast is sent on layer 2 (data link layer) and ARP will normally not traverse to layer 3 (network layer). However it can provide extra features to the layer 3 protocol.

The truth is that not all protocols fit the OSI model exactly, because after all it's just a model. If you really want to push it into a spot I'd say ARP is a layer 2.5 protocol. It fits layer 2, but doesn't fit layer 3 completely.

The same discussion is often held about ICMP and where it fits in: layer 3 or layer 4.

A good explanation on these exceptions is:

Normally, a protocol from layer N+1 is encapsulated with the header of the protocol from Layer N, but protocols like arp, stp, cdp, icmp and igmp are exceptions because are encapsulated with a header of a protocol from the same layer.

Lucas Kauffman
  • 4,151
  • 5
  • 28
  • 51
  • I have a stupid question, what is the OSI model used for? – Bionix1441 Jan 10 '18 at 19:57
  • 1
    @Bionix1441 In the university our professor told us that a "*model*" is a simplification of the reality that makes it easier to talk about the reality and/or to do calculations: If you want to do a computer simulation of some complex process, you'll need to simplify it first. However, simplifying always means that not all aspects of the reality are covered by your model any more! The same is true for the OSI model. Think about encapsulating IP packets in UDP packets (eg. using Teredo): Is UDP now layer-2 or is IP layer-5 ... ? – Martin Rosenau Feb 14 '19 at 13:46
6

The IETF protocol suite is not defined in term of the OSI model, hence the mapping between IETF and OSI protocol is much more a convention then else.

There are -in fact- good reasons to consider it a Layer 2 (it is defined as an ethertype inside an Ethernet-V2 frame, and it is not forwarded by standard IP routers) as a layer 3 (it has to inter-operate with the layer 3-to-2 mapping process of an host: something a pure layer2 node does not have)

That said, literature considering it a layer2 protocol is much wider, and is commonly accepted as "layer 2" instead of "layer 3".

But don't make it a dogma: speaking in term of layer 3 is not completely heretic: The same process held into IPV6 (without ARP anymore) is often defined as "layer 3" but it is the exact conceptual process.

1

Since the ARP packet itself is encapsulated in an Ethernet frame, it cannot be exclusively a L2 protocol. However, ARP services a L2 issue for a L3 service (What interface accepts frames for a certain L3 address?) by use of L2 services (The FFFF.FFFF.FFFF broadcast address.). Therefore, ARP matches L2 + L3.

The question is, what services are touched by ARP at least once? L3 and L2. This does not mean that ARP does not fit into the OSI model. The reference model offers you a profile to match your observations. This does not imply you have to choose a single layer.

user2964971
  • 850
  • 1
  • 9
  • 22
  • 1
    Arp messages happen to contain L3 information, but so do DHCP messages. That does not mean that these protocols have to be defined as L2 and L3, they are simply L2 protocols. – John Kennedy Dec 27 '13 at 20:19
  • 3
    DHCP is an option of UDP that travels on top of IP. How can it be a layer2 protocol? – Emilio Garavaglia Mar 18 '14 at 13:50