Friday, April 5, 2024

Cisco 103 - Initial VLAN commands

#show vlan brief
Shows VLANs and which ports they are configured on
 
VLAN    Name   Status   Ports
1       default active    Gi0/0, Gi0/1, Gi0/2...
 
; Define interfaces g1/0, g1/1, g1/2, and g1/3
#interface range g1/0 - 3
; Config interfaces in access mode
; as opposed to trunk mode
(config-if-range)#switchport mode access
; Assign interfaces to vlan 10
; Notice that vlan 10 does not exist so it has to create vlan 10
(config-if-range)#switchport access vlan 10
% Access VLAN does not exist. Creating vlan 10
(config-if-range)#interface range g2/0 - 2
(config-if-range)#switchport mode access
(config-if-range)#switchport access vlan 20
% Access VLAN does not exist. Creating vlan 20
; If you need to create a vlan that did not get auto-created by commands above
#Vlan 30
 
 
 
; Assign names to VLANs
; If VLAN did not exist, it would first create VLAN
(config)#vlan 10
(config-vlan)#name Engineering
(config-vlan)#vlan 20
(config-vlan)#name HR
;
(config)#int range Fa3/1, Fa4/1
(config-if-range)#switchport mode access
(config-if-range)#switchport access vlan 10
(config-if-range)#int range Fa5/1, Fa6/1
(config-if-range)#switchport mode access
(config-if-range)#switchport access vlan 20
(config-if-range)#exit
(config)#exit
 

SW1#show int status

Port Name  Status    Vlan    Duplex Speed Type

Gig0/1     connected 10      auto   auto  10/100BaseTX

Gig1/1     connected 20      auto   auto  10/100BaseTX

Gig2/1     connected 30      auto   auto  10/100BaseTX

Fa3/1      connected 10      auto   auto  10/100BaseTX

Fa4/1      connected 10      auto   auto  10/100BaseTX

[These are my notes from Jeremy's excellent CCNA course which can be viewed here.]