Cheatsheet VLANs Cheat Sheet
Cheatsheet VLANs Cheat Sheet
| Task | Command |
|------|---------|
| Enter Global Configuration Mode | `Switch> enable`<br>`Switch# configure terminal`
|
| Create a VLAN and Enter VLAN Configuration Mode | `Switch(config)# vlan <vlan-id>`
|
| Name a VLAN (Optional) | `Switch(config-vlan)# name <vlan-name>` |
| Exit VLAN Configuration | `Switch(config-vlan)# exit` |
| Show VLAN Information | `Switch# show vlan brief` |
| Task | Command |
|------|---------|
| Enter Interface Configuration Mode | `Switch(config)# interface
<interface-id>`<br>(e.g., `interface fa0/1`) |
| Set Interface Mode to Access | `Switch(config-if)# switchport mode access` |
| Assign Interface to a VLAN | `Switch(config-if)# switchport access vlan <vlan-id>`
|
| Shutdown/Enable Interface | `Switch(config-if)# shutdown` / `no shutdown` |
| Exit Interface Mode | `Switch(config-if)# exit` |
| Task | Command |
|------|---------|
| Set Interface as Trunk | `Switch(config-if)# switchport mode trunk` |
| Optionally Specify Allowed VLANs on Trunk | `Switch(config-if)# switchport trunk
allowed vlan <vlan-list>`<br>e.g., `10,20,30` or `10-20` |
| Set Native VLAN (Optional) | `Switch(config-if)# switchport trunk native vlan
<vlan-id>` |
| Verify Trunk Configuration | `Switch# show interfaces trunk` |
| Task | Command |
|------|---------|
| Set VTP Domain Name | `Switch(config)# vtp domain <domain-name>` |
| Set VTP Mode (Server/Client/Transparent) | `Switch(config)# vtp mode server` /
`client` / `transparent` |
| Set VTP Password (Optional) | `Switch(config)# vtp password <password>` |
| Show VTP Status | `Switch# show vtp status` |
## 💾 Save Configuration
| Task | Command |
|------|---------|
| Save Running Config to Startup Config | `Switch# copy running-config
startup-config` |
| Command | Description |
|---------|-------------|
| `show vlan brief` | Displays all VLANs and their assigned ports |
| `show interfaces trunk` | Shows configured trunk ports and VLANs allowed |
| `show mac address-table` | Shows MAC addresses learned by the switch |
| `show running-config` | Displays current configuration |
| `show vtp status` | Shows VTP configuration and statistics |
```bash
Switch> enable
Switch# configure terminal
Switch(config)# vlan 10
Switch(config-vlan)# name Sales
Switch(config-vlan)# exit
Switch(config)# interface fa0/1
Switch(config-if)# switchport mode access
Switch(config-if)# switchport access vlan 10
Switch(config-if)# no shutdown
Switch(config-if)# exit
Switch(config)# end
Switch# copy running-config startup-config