2

If some host sends a frame to another one that is not in the same LAN, a the frame arrives to a LAN switch, what does it do? I believe it would broadcast it, but I'm not sure about it. And what if both are on the same LAN? I think it would discard it, because it assumes it has arrived its destination if it's on the LAN already.

3

A switch really doesn't know that there are other LANs. Switches deal with the layer-2 (MAC) addresses. A switch will create a MAC address table table that relates a destination MAC address to the switch interface where the MAC address was last seen.

A frame destined for a different LAN will be addressed by the source host with the gateway MAC address as the destination MAC address, so the switch will forward the frame to the switch interface toward the gateway.

If a switch doesn't have a destination MAC address in its MAC address table, that is when it floods the frame to all the other switch interfaces.

  • I'm a bit confused now. LANs are defined for 2nd or 3rd layer? I don't know if it is correct, but would it be wise to name the former "broadcast domain" and the latter "IP network"? – Tendero Feb 18 '18 at 23:14
  • In almost all cases, you will have a single layer-3 network for a single layer-2 broadcast domain (LAN). If I were you I would not worry about the odd cases until you have mastered the basics. A host will compare the destination layer-3 address, masked with its mask, to its masked address. if the two values are equal, it knows they are on the same network, and it will try to send directly to the destination at layer-2. If they are not equal, it knows that the destination is on a different LAN, and it will address the layer-2 frame with its configured gateway layer-2 address. – Ron Maupin Feb 18 '18 at 23:17
  • @Tendero, a switch is a transparent bridge. The hosts have no idea that there is a switch; they think they are delivering frames directly to the destination on the same layer-2 LAN. At layer-3, they think they are sending the layer-2 frames directly to the gateway. The switch will try to learn where each MAC address is, and it will deliver the frames directly as possible. – Ron Maupin Feb 18 '18 at 23:31
  • 1
    @Tendero if there are two LANs connected to the same switch then by definition they are the same LAN. You can't connect two different LANs with a switch and have them stay different. (Unless you're using Virtual LANs which is a more advanced feature) – immibis Feb 18 '18 at 23:56
  • 1
    I wouldn't call what is in the drawing broadcast domains. It looks like the entire thing is one big broadcast domain. To get traffic from one broadcast domain to another requires a router. If a switch can be configured to have multiple LANs (VLANs), you need a router for traffic to get from one to the other. VLANs logically divide a switch into multiple switches. What your diagram does show are separate collision domains. Bridges (including switches) bound collision domains, but not broadcast domains. – Ron Maupin Feb 19 '18 at 0:15

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.