5

My belief is that an unmanaged plug-and-play layer 2 network switch only deals with MAC addresses.

When computer A on a local network wants to communicate with computer B for example through the unmanaged switch, does the switch simply just forward the Ethernet frames to computer B? If so, how does it know the destination MAC address initially?

Initially when computer A only knows about the computer B's IP address? Does the switch internally keep track of IP addresses matching the MAC addresses? Thanks in advance.

2
  • Did any answer help you? if so, you should accept the answer so that the question does not keep popping up forever, looking for an answer. Alternatively, you could post and accept your own answer.
    – Ron Maupin
    Dec 24, 2021 at 0:21
  • @RonMaupin Agreed. I haven't been online in a while, but I accepted the below answer. Thanks. Jan 18 at 2:52

1 Answer 1

12

An unmanaged switch doesn't use/care for/understand IP addresses at all.

A managed L2 switch uses IP addresses for management only. Some L2 switches also support limited L3/IP functionality like ACLs. L3 switches use IP addresses for L3 forwarding = routing as well.

When computer A on a local network wants to communicate with computer B for example through the unmanaged switch, does the switch simply just forward the Ethernet frames to computer B?

Yes. A basic switch forwards frames by destination MAC address only. Whether higher layers use IPv4, IPv6 or anything else doesn't concern the switch.

If so, how does it know the destination MAC address initially?

A switch ("multiport MAC bridge") learns locations of MAC nodes from the source addresses they use in the frames they send.

If no frame has been sent from a node, its MAC is initially unknown and the switch needs to mimick a repeater hub by flooding the unknown frame to all its ports but the source port.

Initially when computer A only knows about the computer B's IP address?

For IPv4, broadcast-based ARP is used to resolve an IP address to its corresponding MAC address (for MAC-based networks): A broadcasts an ARP request with B's IP address, B replies with its interface MAC address. IPv6 uses multicast-based NDP.

Does the switch internally keep track of IP addresses matching the MAC addresses?

No. A switch only cares for MAC addresses. Matching IP addresses to those MAC addresses is up to the hosts (or more generally up to the L3 nodes, including routers).

10
  • Thank you for your reply. Initially, when computer A and B just comes onto the network and computer A wants to communicate with computer B, but it just knows computer B's IP address, how does computer A know computer B's MAC address already to send the Ethernet frame? Nov 18, 2021 at 10:37
  • A uses ARP to resolve B's IPv4 address to its NIC's MAC address (A send ARP request as broadcast, B replies with its MAC address).
    – Zac67
    Nov 18, 2021 at 10:46
  • Wouldn't B's reply to ARP request mean that the case with repeater hub behavior almost never happens?
    – jaskij
    Nov 18, 2021 at 17:09
  • 1
    @BenVoigt, or you could have a case where a device has a longer timeout for aging off ARP entries than the switches age off MAC entries. Like a Cisco router with a default 4 h ARP timeout vs. a common 5 min MAC timeout.
    – ilkkachu
    Nov 19, 2021 at 11:08
  • 1
    @ilkkachu: Or the end device has a longer timeout than the switch's uptime
    – Ben Voigt
    Nov 19, 2021 at 16:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.