149
Switch(Config-ethernet1/8)#switchport mode access
Switch(Config-ethernet1/8)#switchport access vlan 100
Switch(Config-ethernet1/8)#exit
5.2.2.3 switchport interface
Command: switchport interface <interface-list>
no switchport interface <interface-list>
Function: Specify Ethernet port to VLAN; the “no switchport interface <interface-list>
command deletes one or one set of ports from the specified VLAN.
Parameter: <interface-list> is the port list to be added or deleted, “;” and “-“ are
supported, for example: ethernet 1/1;2;5 or ethernet 1/1-6;8.
Command mode: VLAN Mode
Default: A newly created VLAN contains no port by default.
Usage Guide: Access ports are normal ports and can join a VLAN, but a port can only join
one VLAN for a time.
Example: Assign Ethernet port 1, 3, 4-7, 8 of slot 1 to VLAN100.
Switch(Config-Vlan100)#switchport interface ethernet 1/1;3;4-7;8
5.2.2.4 switchport mode
Command: switchport mode {trunk|access}
Function: Set the port in access mode or trunk mode.
Parameter: trunk means the port allows traffic of multiple VLAN; access indicates the
port belongs to one VLAN only.
Command mode: Interface Mode
Default: The port is in Access mode by default.
Usage Guide: Ports in trunk mode is called Trunk ports. Trunk ports can allow traffic of
multiple VLANs to pass through, VLAN in different switches can be interconnected with
the Trunk ports interconnections. Ports under access mode is called Access ports. An
access port can be assigned to one and only one VLAN at a time.
Example: Set port 1/5 to trunk mode and port 1/8 to access mode.
Switch(Config)#interface ethernet 1/5
Switch(Config-ethernet1/5)#switchport mode trunk
Switch(Config-ethernet1/5)#exit
Switch(Config)#interface ethernet 1/8