| 586 | With the "access mode" ports in the previous section, VLANs with the same VLAN ID that are on different but connected switches would be recognized as different VLANs despite same VLAN ID. In order to allow the two same-ID VLANs to communicate with one another, we need to 1) set up trunking between the two switches, and 2) enable "dot1q tunneling" on the ports. |
| 587 | |
| 588 | 1. '''Configure the trunk port.''' Say that ports 0/45-48 are trunk ports: |
| 589 | {{{ |
| 590 | !(config-if)# interface range gi 0/45-48 |
| 591 | !(config-if)# switchport mode trunk |
| 592 | !(config-if)# switchport trunk allowed vlan 3,27,28 |
| 593 | }}} |
| 594 | |
| 595 | * "interface range gi 0/45-48" - configure all four ports at once with "interface range" context |
| 596 | * "switchport mode trunk" - make the ports trunk ports |
| 597 | * "switchport trunk allowed vlan 3,27,28" - allow the trunk to only carry frames from VLANs 3,27,or 28 |
| 598 | |
| 599 | '''Some extensions of the "switchport trunk allow" context."''' |
| 600 | Yes, we know that you're thinking "wait, there's more?", but without these sub-contexts you'd have to undo the whole "switchport trunk allowed vlan" bit each time you need to add or remove VLANs from the access list. |
| 601 | |
| 602 | Firstly, the switch's help output: |
| 603 | {{{ |
| 604 | sw-sb09(config-if)# switchport trunk allowed vlan ? |
| 605 | <vlan id list> <List style>. 1 to 4094. ex. "10-20", "30,40" |
| 606 | add add the VLANs to use this port |
| 607 | remove remove the VLANs to use these port |
| 608 | }}} |
| 609 | |
| 610 | Summarized: |
| 611 | * "switchport trunk...vlan add <VLAN IDs> - add VLANs to your current list. |
| 612 | * "switchport trunk...vlan remove <VLAN IDs> - remove VLANs from your current list |
| 613 | |
| 614 | moving on... |
| 615 | |
| 616 | 2. '''Configure the VLAN ports.''' The steps are same as configuring the ports for regular VLANs, except instead of "switchport mode access" we specify "switchport mode dot1q-tunnel" in this case: |
| 617 | {{{ |
| 618 | sw-sb09(config)# int range gigabitethernet 0/1-4, gigabitethernet 0/30 |
| 619 | sw-sb09(config-if-range)# |
| 620 | }}} |
| 621 | |
| 622 | 3. '''Associate the trunk with a Native VLAN.''' Technially speaking, native VLANs allows hosts that do not understand tagging to function on a network implementing VLAN tagging. In context of the switch, the native VLAN is much like a trunk port version of an interface VLAN. |