Configure basic VLANs on a switch and assign ports to them.
Configuring VLANs (Virtual Local Area Networks) on a switch involves dividing a physical network into multiple logical segments to enhance network efficiency, security, and manageability. Assigning ports to specific VLANs allows you to control traffic flow and separate broadcast domains. Here's a technical explanation of how to configure basic VLANs on a switch and assign ports to them:
1. Access the Switch:
- Connect to the switch using a terminal emulator or a management software like PuTTY. Access can be via console port, SSH, or web interface, depending on the switch model.
2. Enter Privileged EXEC Mode:
- Log in with appropriate credentials and enter privileged EXEC mode to have the necessary permissions for configuration.
shellCopy codeSwitch> enable
Password: [Enter your password]Switch#
3. Enter Global Configuration Mode:
- Access the global configuration mode to make changes to the switch configuration.
shellCopy codeSwitch# configure terminal
Switch(config)#
4. Create VLANs:
- Define the VLANs you want to create. VLANs are identified by a numerical ID (1 to 4095).
shellCopy codeSwitch(config)# vlan 10
Switch(config-vlan)# name Sales
Switch(config-vlan)# exit
Switch(config)# vlan 20
Switch(config-vlan)# name Marketing
Switch(config-vlan)# exit
Repeat this process for all the VLANs you want to create.
5. Assign VLANs to Ports:
- Go to the interface configuration mode for each port you want to assign to a VLAN.
shellCopy codeSwitch(config)# interface GigabitEthernet0/1
Switch(config-if)# switchport mode access
Switch(config-if)# switchport access vlan 10
Switch(config-if)# exit
Switch(config)# interface GigabitEthernet0/2
Switch(config-if)# switchport mode access
Switch(config-if)# switchport access vlan 20
Switch(config-if)# exit
Repeat this process for all the ports and VLANs you want to configure. switchport mode access
sets the port to access mode, and switchport access vlan [VLAN_ID]
assigns the port to the specified VLAN.
6. Verify Configuration:
- Check the VLAN configuration and port assignments.
shellCopy codeSwitch# show vlan
Switch# show interfaces status
Verify that each port is in the correct VLAN.
7. Save Configuration:
- Save the configuration to ensure it persists after a reboot.
shellCopy codeSwitch# write memory
8. Exit Configuration Mode:
- Exit the configuration mode when you are done.
shellCopy codeSwitch(config)# exit
Switch#