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

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

169.254.X.Y
Beginner
Beginner

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.     

1 Accepted Solution

Accepted Solutions

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)




>> Marcar como útil o contestado, si la respuesta resolvió la duda, esto ayuda a futuras consultas de otros miembros de la comunidad. <<

View solution in original post

5 Replies 5

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

:-)




>> Marcar como útil o contestado, si la respuesta resolvió la duda, esto ayuda a futuras consultas de otros miembros de la comunidad. <<

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...   

 

 

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)




>> Marcar como útil o contestado, si la respuesta resolvió la duda, esto ayuda a futuras consultas de otros miembros de la comunidad. <<

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

You are welcome, it was a pleasure.

Have a great day

:-)




>> Marcar como útil o contestado, si la respuesta resolvió la duda, esto ayuda a futuras consultas de otros miembros de la comunidad. <<
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: