cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
7002
Views
5
Helpful
7
Replies

sh ip arp on layer 2 and 3 device.

mahesh18
Level 6
Level 6

Hi Everyone,

User is connected to Switch 1  which has no routing acting as layer 2 only.

Switch 1 has uplink connection to switch 2 which is also acting as layer 2 only.

Switch 2  has uplink to Switch 3 .

Switch 3 has ip routing enabled and is layer 3.

Question is

1>If we need to find IP address of user who is connected to Switch 1 and we know its mac address  we need to go to Switch 3 and will do

sh ip arp mac address

it will show the ip address.

My question is why sh ip arp command works only on layer 3 switch ?

Why does not it work on layer 2 switch ?

Thanks

Mahesh

2 Accepted Solutions

Accepted Solutions

Raju Sekharan
Cisco Employee
Cisco Employee

Role of Layer 2 switches is to do switching based on the destinaction mac-adddress

Role of layer 3 switch or router  is to provide routing. ARP is a protocol which proivded the layer 2 address information to Network layer(routing).

ARP is not needed for pure layer 2 switching. Arp palys a role only when that device want to do a layer 3 communication to any IP which is on ethernet segment

Thank you

Raju

View solution in original post

Hi Mahesh.

we cannot send an ethernet frame without knowing destination mac-address

When I want to send a packet from a layer 3 device to antoher IP address, I should know the layer 2 address of that device

In case of ethrenet it is mac-address.

How does the router know the mac-address of the device?

It uses ARP to get that infomation

Look at below topology

Router(192.168.1.3)---------Layer 2 switch----PC1(192.168.1.1)

                                                   |

                                                   |

                                                PC2

                                           192.168.1.2

Thnk that I am sending a ping to 192.168.1.1 from router

This is what happens

1. Router will look in its ARP table to see if there is an ARP entry for 192.168.1.1

2. If it has ARP entry, it uses that mac, and creates a ethernet frame using source mac as router interface and destination mac as the mac address correspodning to 192.168.1.1

3. if it doesn't have ARP entry for 192.168.1.1. it will send a ARP broadcast requesting who has 192.168.1.1

4. both PC1 and PC2 receive the broadcast. PC1 responds back with ARP reply with its mac-address. after receving ARP reply, it deoes step 2

The layer 2 switch, just keeps learning the mac-adrdress attached to each port and just does packet forwardign based on destination mac. So the layer  2 switch needs only a mac-address table to forward the packet. it doesn't need ARP because it doesn't even have an IP address on it

Router and PC1 and PC2 will have ARP entry because it is doing layer 3 communication

Thanks

Raju

View solution in original post

7 Replies 7

Raju Sekharan
Cisco Employee
Cisco Employee

Role of Layer 2 switches is to do switching based on the destinaction mac-adddress

Role of layer 3 switch or router  is to provide routing. ARP is a protocol which proivded the layer 2 address information to Network layer(routing).

ARP is not needed for pure layer 2 switching. Arp palys a role only when that device want to do a layer 3 communication to any IP which is on ethernet segment

Thank you

Raju

Hi Raju,

when you say this --

Arp palys a role only when that device want to do a layer 3 communication to any IP which is on ethernet segment

Can you please explain this in more detail?

Thanks

MAhesh

Hi Mahesh.

we cannot send an ethernet frame without knowing destination mac-address

When I want to send a packet from a layer 3 device to antoher IP address, I should know the layer 2 address of that device

In case of ethrenet it is mac-address.

How does the router know the mac-address of the device?

It uses ARP to get that infomation

Look at below topology

Router(192.168.1.3)---------Layer 2 switch----PC1(192.168.1.1)

                                                   |

                                                   |

                                                PC2

                                           192.168.1.2

Thnk that I am sending a ping to 192.168.1.1 from router

This is what happens

1. Router will look in its ARP table to see if there is an ARP entry for 192.168.1.1

2. If it has ARP entry, it uses that mac, and creates a ethernet frame using source mac as router interface and destination mac as the mac address correspodning to 192.168.1.1

3. if it doesn't have ARP entry for 192.168.1.1. it will send a ARP broadcast requesting who has 192.168.1.1

4. both PC1 and PC2 receive the broadcast. PC1 responds back with ARP reply with its mac-address. after receving ARP reply, it deoes step 2

The layer 2 switch, just keeps learning the mac-adrdress attached to each port and just does packet forwardign based on destination mac. So the layer  2 switch needs only a mac-address table to forward the packet. it doesn't need ARP because it doesn't even have an IP address on it

Router and PC1 and PC2 will have ARP entry because it is doing layer 3 communication

Thanks

Raju

Hi Raj,

Very nice explanation,

Am I correct with the statement below?

Two pcs are connected to a switch example PC1 and PC2

I am pinging PC 2 from PC1 with ip address, here arp comes in to picture at PC 1 level itself and it sends the packet basing on the mac.

Role of switch is to send the packet to the destination(pc2) with the help of mac procvided by pc1 Mac address.

Regards
Thanveer
"Everybody is genius. But if you judge a fish by its ability to climb a tree, it will live its whole life believing that it is a stupid."

Hi Thanveer,

You are right

Raju

Hi Raju,

You explained so well.

Many thanks

Mahesh

You are welcome

Thank you

Raju

Review Cisco Networking products for a $25 gift card