Monday, August 26, 2013

Be Carefull with Switchport Trunk Allowed Vlan 'add'

This is notice, warning for you. The good network engineers should be know about it. To configure trunk allowed vlan. Why ? if you're wrong or forget to put 'add' command, your network will be down. You can check with question mark (?) 'add' is mean add VLANs to the current list. If you write vlan-number without 'add' before, is mean vlan-number will be replace to the current list. Be carefull ..!

Please follow this example.

#### Define Interface to Trunk

IOS# show run interface Ethernet0/0
Building configuration...

Current configuration : 57 bytes
!
interface Ethernet0/0
 no ip address
 duplex auto
end

IOS# conf t
Enter configuration commands, one per line.  End with CNTL/Z.
IOS(config)# interface Ethernet0/0
IOS(config-if)# switchport 
IOS(config-if)# switchport trunk encapsulation dot1q 

#### Add VLANs to Trunk with 'add'

IOS(config-if)# switchport trunk allowed vlan ?
  WORD    VLAN IDs of the allowed VLANs when this port is in trunking mode
  add     add VLANs to the current list
  all     all VLANs
  except  all VLANs except the following
  none    no VLANs
  remove  remove VLANs from the current list

IOS(config-if)# switchport trunk allowed vlan add 11,12,13
IOS(config-if)# switchport trunk allowed vlan add 14,16,18
IOS(config-if)# do show run interface Ethernet0/0
Building configuration...

Current configuration : 135 bytes
!
interface Ethernet0/0
 switchport
 switchport trunk encapsulation dot1q
 switchport trunk allowed vlan 11-14,16,18
 duplex auto
end

#### Add VLANs to Trunk without 'add', this mean replace

IOS(config-if)# switchport trunk allowed vlan 19
IOS(config-if)# do show run interface Ethernet0/0
Building configuration...

Current configuration : 126 bytes
!
interface Ethernet0/0
 switchport
 switchport trunk encapsulation dot1q
 switchport trunk allowed vlan 19
 duplex auto
end

No comments: