cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements

531
Views
5
Helpful
5
Replies
Highlighted
Beginner

How the L2 Switch learns mac addresses if connected PCs do not communicate each other?

PC0 -- SW -- PC1

 

While playing with the packet tracer, I fifgured out that SW learns PC0's and PC1's mac addresss even though PC0 and PC1 literally do nothing, but just connected to the SW. Even though, I am a network newbie, my assumption was that if I statically put the IP address in PC0 and PC1, PC0 and PC1 will send gratuitous arp packet in order to check whether the given ip address is unique or not. By receiving gratuitous arp packets, SW would learn PC0's and PC1's mac address. If I just click DHCP instead of Static, PC0 and PC1 will send DHCP packet. By receiving DHCP packets, SW would learn both PCs' mac address. Of course, since there is no DHCP service, PC0 and PC1 would get an IP address between 169.254.0.1 ~ 169.254.255.254 according to APIPA. If you know the answer, please let me know.     

Everyone's tags (5)
1 ACCEPTED SOLUTION

Accepted Solutions
VIP Advisor

Re: How the L2 Switch learns mac addresses if connected PCs do not communicate each other?

Hi

No, CDP and LLDP are not included on this case (you can disable them and it can learn the MAC address dynamically), now the switches could send frames to ports but it is not always. In the real life and to be more specific when you are using a PC with Window OS the NIC has a default behavior (obtain an IP address automatically) with this the PC will search a DHCP server using a broadcast here the PC is sending frame so the switch will learn the MAC Address, BUT if the PC never send a frame the switch will never learn the MAC address.

Usually a host (it can be a PC, IP printer, IP camera, etc) cannot send BPDU's, the BPDUs are actually the language used by the switches to exchange information to select a root bridge, now if you connect a switch to access port it can exchange BPDU and generate problems. A proof of this is you configure spanning-tree portfast bpduguard enable under the interface it will not be disabled. (if it is always a host)

5 REPLIES 5
VIP Advisor

Re: How the L2 Switch learns mac addresses if connected PCs do not communicate each other?

Hi

Usually ARP is used to find the MAC address but the switch could be sending frames periodically to identify or discover neighbors connected to it, and it will help to initiate a communication with the host connected to the port and through this way the MAC address is learned and stored into the CAM, in order to verify this you can use wireshark. 

In order situations the PC could be sending frames for example to discover a DHCP server using broadcast.

 

Hope it is useful

:-)

Beginner

Re: How the L2 Switch learns mac addresses if connected PCs do not communicate each other?

Could you please elaborate little more? I am getting more confused. You said, switch can learn the mac address by sending frames periodically to identify or discover neighbors connected to it. Are you referring CDP? I tested on the packet tracer 7.1. From that topology, switch learned PC0's and PC1's mac address only by dhcp and gratuitous arp packet... Switch didn't learn the mac address by CDP or BPDU...   

 

 

VIP Advisor

Re: How the L2 Switch learns mac addresses if connected PCs do not communicate each other?

Hi

No, CDP and LLDP are not included on this case (you can disable them and it can learn the MAC address dynamically), now the switches could send frames to ports but it is not always. In the real life and to be more specific when you are using a PC with Window OS the NIC has a default behavior (obtain an IP address automatically) with this the PC will search a DHCP server using a broadcast here the PC is sending frame so the switch will learn the MAC Address, BUT if the PC never send a frame the switch will never learn the MAC address.

Usually a host (it can be a PC, IP printer, IP camera, etc) cannot send BPDU's, the BPDUs are actually the language used by the switches to exchange information to select a root bridge, now if you connect a switch to access port it can exchange BPDU and generate problems. A proof of this is you configure spanning-tree portfast bpduguard enable under the interface it will not be disabled. (if it is always a host)

Beginner

Re: How the L2 Switch learns mac addresses if connected PCs do not communicate each other?

Thank you very much!
This answer is what I have been looking for past few hours :)
VIP Advisor

Re: How the L2 Switch learns mac addresses if connected PCs do not communicate each other?

You are welcome, it was a pleasure.

Have a great day

:-)

CreatePlease to create content
Content for Community-Ad
July's Community Spotlight Awards