1

I'm trying to understand the specifics of trunking a VLAN on two switches.

Say I have two switches, both hosting half of VLAN 3.

Switch 1: Ports 0-5 on VLAN 3, Port 6 is Trunk

Switch 2: Ports 0-5 on VLAN 3, Port 6 is Trunk

Do the two switches know what the MAC addresses are of the devices connected to the other switch which are in the same VLAN, or do the switches just know that Port 6 is a VLAN 3 trunk and when they receive a broadcast frame, they just flood the frame to the trunk port with the VLAN tag and expect the switch on the other end to deal with it?

2

When a frame enters a switch, the switch will take the source MAC address and update its MAC address table with the interface where the frame entered the switch. That interface can be an access or trunk interface.

Broadcast or unknown unicast frames will be sent to all interfaces (except the one where the frame entered the switch), including access and trunk interfaces.

Known unicast frames will be sent to the switch interface indicated in the switch MAC address table, whether an access or trunk interface.

  • As I wrote, when a frame enters a switch, the switch will look at the source MAC address and update its MAC address table with the interface where the frame entered the switch. It doesn't matter that the interface is an access or trunk interface. Each switch maintains its own MAC address table, independent of every other switch, only using frames that have entered the switch. A different, connected switch could have frames that remain in that switch, and your switch would never know about those MAC addresses in the other switch. – Ron Maupin Sep 11 '17 at 15:48
  • @JFL, that assumes that the frame has a reason to travle to switch 1. If there is a host on switch 2 that never sends any traffic that would be delivered to switch 1, e.g. only conversing with another host on switch 2, then switch 1 will not have its MAC address. – Ron Maupin Sep 11 '17 at 15:57
  • Yes. A trunk can have multiple VLANs, all but one of which will be tagged. Other than that, it is still a switch interface. From the perspective of each VLAN on the trunk, it simply looks like an interface exclusive to each VLAN. The VLANs know nothing of trunks or tags; that is something the switches do to separate traffic on a trunk, but one VLAN doesn't know anything about any other VLAN. – Ron Maupin Sep 12 '17 at 12:51
  • Thank you Ron. I have another question regarding trunk ports. If I connect Switch A's trunk port to Switch B's Vlan10 port and it's not set as an access port with "switchport mode access" command, and it autonegotiates to become a trunk port, does that port leave Vlan10? Or what happens? – user39822 Sep 12 '17 at 14:34
  • Let us continue this discussion in chat. – user39822 Sep 12 '17 at 14:35
0

VLAN3 is just a subnet or another network. Say you have 192.168.0.0/24 vlan 1 and vlan 3 is 192.168.1.0/24. Each device in vlan 3 will get the 192.168.1.1-254 IP. That IP is assigned to the MAC address of the end device This is held in the arp table on a layer 3 device. Only the switch, as it is a layer 2 device, only knows the MAC address of the devices directly attached to it.

A Trunk port allows for multiple networks or VLANS to communicate over the same port, But without a layer 3 they cannot talk to one another.

A broadcast will be sent to any device on that VLAN or network. It doens't care if it's on switch one or two.

  • 1
    A vlan is a subset of switch ports, they usually pair with subnets but nothing enforce it and you can have two different subnets on the same vlan (with all the problem it could cause, but that's another problem). In brief a VLAN only act at level 2, level 3 isn't related. – Tensibai Sep 11 '17 at 15:20
  • Yes you can have multiple subnets on a single VLAN but that would be more trouble that it is worth and for general purpose it should be a 1 to 1 ratio. Even though a VLAN is assigned to a switch port having more than one subnet on the same vlan would create many more issues. – NineTail Sep 11 '17 at 15:25
  • I partly agree (Overlay networking does work), I just say that you're saying verbatim a VLAN is a subnet, that's just false, a VLAN is a subset of switch ports, the level 3 has nothing to do with that... – Tensibai Sep 11 '17 at 15:29
0

There's 2 thing in your question.

First if you consider a single vlan, the port 6 being a trunk is not mandatory, setting the port 6 of both switch as VLAN3 will work.

A trunk port has interest when you have multiples vlan on a switch, this mean you have made partitions on your switch, port 1 to 5 on VLAN3, port 7 to 12 on VLAN 4 for example, and you configure your port 6 as trunk to transport vlan 3 and 4. You may achieve the same thing without a trunk port if you keep port 6 in vlan 3 and use port 12 in VLAN 4 to link the two switches for example.

A switch records incoming mac address on a port, such that when a packet is directed to a mac address it know where to send it, when it don't know or if it's a broadcast it send it on all ports within the same vlan, trunk included and the switch receiving the packet will scan it's own table before forwarding the packet to the correct port if already know or on all port within the vlan if the mac address is unknown or broadcast.

Mainly a vlan is a virtual switch within the switch and the trunk is an aggregation of "virtual ports" to transport multiple vlans on a single link (trunk on multiple links are trunks made on port aggregation (LACP) and are another subject).

Your Answer

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