Vlan configuration ideas: access, Trunk)
1) create a Vlan
Configure static VLAN on an IOS-based switch:
- Switch # vlan database
-
- Switch (vlan) # vlan-num name vlan-name
-
- Switch (vlan) # exit
-
- Switch # configure teriminal
-
- Switch (config) # interface module/number
-
- Switch (config-if) # switchport mode access // set the port mode to access
-
- Switch (config-if) # switchport access vlan-num // set the vlan to which the port belongs
-
- Switch (config-if) # end
Verify Configuration: show vlan
2) configure the trunk Link
The trunk is a point-to-point link between two catalyst Switch ports or between the catalyst Switch and the router. Trunk links can carry multiple VLANs.
Configure trunk links on IOS-based switches
- Switch (config) # interface mod/port
-
- Switch (config-if) # switchport mode trunk // you can specify trunk as the port mode.
-
- Switch (config-if) # switchport trunk encapsulation {isl | dotlq} // you can specify the frames encapsulated by the trunk.
-
- Switch (config-if) # switchport trunk allowed vlan remove vlan-list // allow those VLANs to pass through trunk
-
- Appendix: switchport trunk allowed vlan {add | all | unique T | remove} vlan-list)
No switchport
No switchport // The physical port is changed to a layer-3 Port, that is, the layer-3 port is used as the port on the router. After a port is configured as a layer-3 Port, an IP address can be allocated to the port, of course, you can still connect to a PC ,. Router port: A physical port is a port generated by the no switchport command in the port configuration status. IP addresses are required for all layer-3 routing ports for Route exchange.
Configuration example:
- Switch# configure terminal
-
- Switch(config)# interface gigabitethernet0/2
-
- Switch(config-if)# no switchport
-
- Switch(config-if)# ip address 192.20.135.21 255.255.255.0
-
- Switch(config-if)# no shutdown
-
- Switch(config-if)# end
Appendix: show interfaces [interface-id] switchport // display the status of the L2 port, which can be used to determine whether the port is a L2 or L3 port. Eg: Switch # show interfaces fastethernet 0/1 switchport
There is still a lot of content about VLAN configuration. This article is just a part of it and I hope you can master it more.