Sunday, August 9, 2009

VLAN Trunking

A trunk is a link that carries traffic for more than one VLAN. Trunks multiplex traffic from multiple VLANs. Trunks connect switches and allow ports on multiple switches to be assigned to the same VLAN.

Two methods of identifying VLANs over trunk links are:
  • Inter-Switch Link (ISL)—A Cisco proprietary method that encapsulates the original frame in a header, which contains VLAN information. It is protocol-independent and can identify Cisco Discovery Protocol (CDP) and bridge protocol data unit (BPDU) frames.
  • 802.1Q—Standards-based, tags the frames (inserts a field into the original frame immediately after the source MAC address field), and supports Ethernet and Token Ring networks.
When a frame comes into a switch port, the frame is tagged internally within the switch with the VLAN number of the port. When it reaches the outgoing port, the internal tag is removed. If the exit port is a trunk port, then its VLAN is identified in either the ISL encapsulation or the 802.1Q tag. The switch on the other end of the trunk removes the ISL or 802.1Q information, checks the VLAN of the frame, and adds the internal tag. If the exit port is a user port, then the original frame is sent out unchanged, making the use of VLANs transparent to the user.

If a nontrunking port receives an ISL-encapsulated frame, the frame is dropped. If the ISL header and footer cause the MTU size to be exceeded, it might be counted as an error.

If a nontrunking port receives an 802.1Q frame, the source and destination MAC addresses are read, the tag field is ignored, and the frame is switched normally at Layer 2.


Configuring a Trunk Link


Ports can become trunk ports either by static configuration or dynamic negotiation using Dynamic Trunking Protocol (DTP). A switch port can be in one of five DTP modes:
  • Access—The port is a user port in a single VLAN.
  • Trunk—The port negotiates trunking with the port on the other end of the link.
  • Non-negotiate—The port is a trunk and does not do DTP negotiation with the other side of the link.
  • Dynamic Desirable—Actively negotiates trunking with the other side of the link. It becomes a trunk if the port on the other switch is set to trunk, dynamic desirable, or dynamic auto mode.
Configure a port for trunking at the interface configuration mode:

(config-if)#switchport mode {dynamic {auto | desirable} | trunk}

If dynamic mode is used, DTP negotiates the trunking state and encapsulation. If trunk mode is used, you must specify encapsulation:

(config-if)#switchport trunk encapsulation {isl | dot1q | negotiate}


Native VLAN with 802.1Q

If you are using 802.1Q, specify a native VLAN for the trunk link with the command:

(config-if)#switchport trunk native vlan vlan no

Frames from the native VLAN are sent over the trunk link untagged. Native VLAN is the VLAN the port would be in if it were not a trunk, and it must match on both sides of the trunk link. VLAN 1 is the default native VLAN for all ports.


VLAN Mapping

ISL trunking recognizes only VLANs numbered 1–1001, but 802.1Q can use VLANs 0–4094. If you are using both ISL and 802.1Q in your network and have VLANs numbered above 1001, you have to map the 802.1Q VLANS to ISL numbers. Some rules about mapping VLANs include:
  • You can configure only eight mappings.
  • Mappings are local to the switch; the same mappings must be configured on all switches in the network.
  • You can map only to Ethernet ISL VLANs.
  • The 802.1Q VLANs with the same number as mapped ISL VLANs are blocked. (For example, you map 802.1Q VLAN 1500 to ISL VLAN 150, then 802.1Q VLAN 150 is blocked on that switch.)
  • You should not map the 802.1Q native VLAN.

VLANs Allowed on the Trunk

By default, a trunk carries traffic for all VLANs. You can change that behavior for a particular trunk link by giving the following command at the interface config mode:

switchport trunk allowed vlan vlans

Make sure that both sides of a trunk link allow the same VLANs.


Verifying a Trunk Link

Two commands you can use to verify your trunk configuration are:

#show running-config
#show interfaces [interface no.] switchport | trunk


Using the trunk keyword with the show interfaces command gives information about the trunk link:

No comments:

Post a Comment