2

Consider a standard GigE network switch. In order to do the switching, presumably it needs to maintain a map of MAC addresses of all things that exist on the network to its (switch's) port numbers.

  • How does it maintain such a map?
  • What are the protocols involved?
  • If I change the topology of one part of the network, does the entire network get notified or do things get discovered "lazily" (i.e. on first need)?
NPE
  • 669
  • 3
  • 9
  • 19

3 Answers3

8

The switch learns the MAC-port mapping by looking at the source mac address of each incoming packet. So, the switch can build the mac table gradually.

When it needs to forward a packet, it looks at the destination mac address and forwards it to the appropriate port according to the mac table. If it did not find any entry, it will sent the packet to all ports (except the sending port).

To keep only valid entries in the mac table, the switch flushes the unused entries after a specific timeout.

When network topology changes, the switch can learn the new location of the mac address when it receives a new packet. It will overwrite the old mapping of this mac address.

For more info, look at this link.

Khaled
  • 35,688
  • 8
  • 69
  • 98
0

It is called MAC address table and it contains the port, the MAC address and a timestamp. If you change the topology, because you will disconnect some cables, at that time all entries that contain the ports involved will be discarded from the MAC address table. The new entries are learned after each first packet gets received from equipments. Some entries will remain for the wrong port, if the equipment is not directly attached, but, usually, it will be learned soon because of the broadcasts. If there is no traffic from an equipment, then it must pass the timeout until its entry gets discarded. The timeout is usually 120 seconds.

Mircea Vutcovici
  • 16,706
  • 4
  • 52
  • 80
0

taken this scenario:

host_a - port 1 host_b - port 2

when host_a wants to send a packet to host_b then will hit the switch which will record the mac address of host_a and because host_b didn't send anything yet will broadcast the frame on all the ports - host_b will notice that is sent to him and respond on port b.

at this moment the switch knows that host_a has mac1 on port 1 and host_b has mac2 on port 2. any further communication it will be done just trough this ports instead of broadcasting.

  • how does maintain the map is vendor specific but it comes down to a list of mac and their associated ports.
  • in the simplest model there is no protocol really except that all it happens at level 2 OSI
  • if you change the topology the switch will delete the old entry and update it with the new one (as host_1 mac1 is on port 10 instead of 1).

what i said apply to unmanaged switches and could apply to managed switches as well but there things get more complicated. for example cisco can configure what mac comes to what port, they run proprietary protocols as ISL or the open dot1q http://en.wikipedia.org/wiki/IEEE_802.1Qlink text

silviud
  • 2,677
  • 2
  • 16
  • 19