Professional Documents
Culture Documents
NetlabInc
Switch Basic Configuration
1. Hostname
Switch>
Switch>ena
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname SW1
SW1(config)#
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#line con 0
Switch(config-line)#password cisco
Switch(config-line)#login
Switch(config-line)#exec-timeout 0
Switch(config-line)#
Switch Basic Configuration
3. Securing the Virtual Connection or VTY
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#line vty 0 4
Switch(config-line)#password cisco
Switch(config-line)#login
Switch(config-line)#exec-timeout 0
Switch(config-line)#
4. Secure the Privilege Mode Enable password
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#enable password cisco
Switch(config)#exit
Switch#
Switch Basic Configuration
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#enable secret cisco1
Switch(config)#
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#service password-encryption
Switch(config)#
Switch Basic Configuration
7. Interface Vlan 1 configuration
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#int vlan 1
Switch(config-if)#ip address 192.168.20.1 255.255.255.0
Switch(config-if)#no shutdown
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to up
8. IP Default-gateway
Switch#conf t
Switch(config)#ip default-gateway 192.168.20.10
Switch(config)#
Switch Basic Configuration
Verify the Configuration
interface GigabitEthernet0/2
Switch#sh run
!
Building configuration...
interface Vlan1
Current configuration : 1351 bytes
ip address 192.168.20.1 255.255.255.0
!
!
version 12.2(37)SE1
ip default-gateway 192.168.20.10
no service timestamps log datetime msec
ip classless
no service timestamps debug datetime msec
!
service password-encryption
ip flow-export version 9
!
!
hostname Switch
line con 0
!
exec-timeout 0 0
!
password 7 0822455D0A16
enable secret 5 $1$mERr$q.MA2tj.WFptzvbifq/1i.
login
enable password 7 0822455D0A16
!
spanning-tree mode pvst
line aux 0
!
line vty 0 4
exec-timeout 0 0
password 7 0822455D0A16
login
end
Switch#
Switch Basic Configuration
Switch Port Modes
Has something to do with the type of links between
the cisco switch.
2 Types of Links
Depends on the type of device that is connected on the interface
between the links.
1. Trunk Links
If Switch is connected to a switch or a router.
2. Access Links
1. Administrative Mode
Mode that is default or Manually Configured mode
1. Dynamic default mode on all cisco switch / auto configured modes
A. Dynamic Desirable
Actively send DTP Packet to inform the interface on
the other end that it would make the link as trunk.
B. Dynamic Auto
Don’t send DTP packet a passive interface just wait for the
DTP packets to become trunk.
Switch Basic Configuration
2. Trunk Mode
Manually Configured Administrative switch port modes
Unconditionally sets the interface as trunk and send out DTP packets
3. Access Mode
Manually Configured Administrative switch port modes
Note: Best Practice all interface that is facing to end devices must be configured as
access ports and disable negotiation. Also on the trunk link can disable the DTP
so no negotiation will took place especially on the cisco switches that are attached
to a none cisco devices.
Switch Basic Configuration
Dynamic Dynamic
Trunk
Modes Auto Desirable Access
Switch1#sh int fastEthernet 0/1 switchport Switch2#sh int fastEthernet 0/1 switchport
Name: Fa0/1 Name: Fa0/1
Switchport: Enabled Switchport: Enabled
Administrative Mode: dynamic auto Administrative Mode: dynamic auto
Operational Mode: static access Operational Mode: static access
Administrative Trunking Encapsulation: negotiated Administrative Trunking Encapsulation: negotiated
Operational Trunking Encapsulation: native Operational Trunking Encapsulation: native
Negotiation of Trunking: On Negotiation of Trunking: On
Access Mode VLAN: 1 (default) Access Mode VLAN: 1 (default)
Trunking Native Mode VLAN: 1 (default) Trunking Native Mode VLAN: 1 (default)
Note: Output of switch Verification on its interface
Switch Basic Configuration
Configuration of Switch Administrative Modes
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#int fa
Switch(config)#int fastEthernet 0/1
Switch(config-if)#switchport mode trunk
Command rejected: An interface whose trunk encapsulation is "Auto" can not be configured to "trunk" mode.
Switch(config-if)#switchport trunk encapsulation dot1q
Switch(config-if)#switchport mode trunk
S: DD
D: BB
Note: Frame received is broadcast then it is send to all ports except the port where it was received
Unknown unicast frame is flooded or forwarded on all switch interface except where it was received
Known unicast frame is forwarded on the interface found on its Mac Address table
Switch Port Security How it works
Switch>ena
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#int fas
Switch(config)#int fastEthernet 0/24
Switch(config-if)#switchport mode access Static Allocation Of Mac Address on the Port
Switch(config-if)#switchport port-security Switch(config-if)#switchport port-security mac-address AAAA.BBBB.CCCC
Switch(config-if)#switchport port-security maximum 1
Switch(config-if)#switchport port-security mac-address
AAAA.BBBB.CCCC
Switch>ena
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#int fas
Switch(config)#int fastEthernet 0/24 Static Allocation Of Mac Address on the Port
Switch(config-if)#switchport mode access
Switch(config-if)#switchport port-security mac-address sticky
Switch(config-if)#switchport port-security
Switch(config-if)#switchport port-security maximum 1
Switch(config-if)#switchport port-security mac-address sticky
Switch Port Security How it works
Verification
Switch#sh port-security interface fastEthernet 0/22 Switch#sh port-security interface fastEthernet 0/23
Port Security : Enabled Port Security : Enabled
Port Status : Secure-up Port Status : Secure-up
Violation Mode : Shutdown Violation Mode : Shutdown
Aging Time : 0 mins Aging Time : 0 mins
Aging Type : Absolute Aging Type : Absolute
SecureStatic Address Aging : Disabled SecureStatic Address Aging : Disabled
Maximum MAC Addresses : 1 Maximum MAC Addresses : 2
Total MAC Addresses : 0 Total MAC Addresses : 1
Configured MAC Addresses : 0 Configured MAC Addresses : 1
Sticky MAC Addresses : 0 Sticky MAC Addresses : 0
Last Source Address:Vlan : 0000.0000.0000:0 Last Source Address:Vlan : 00D0.D388.ABDB:1
Security Violation Count : 0 Security Violation Count : 0
Switch Port Security How it works
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#int fastEthernet 0/22
Switch(config-if)#shutdown
%LINK-5-CHANGED: Interface FastEthernet0/22, changed state to administratively down
Switch(config-if)#no shutdown
Note: The port will recover after 10 mins when it goes down due to violation on port security
Vlan (Virtual Lans) How it works
Advantages
Broadcast Control
eliminates unnecessary broadcast traffic,
improving network performance and scalability.
Security
logically separates users and departments,
allowing administrators to implement access-lists to control
traffic between VLANs.
Flexibility
removes the physical boundaries of a network, allowing
a user or device to exist anywhere.
Vlan (Virtual Lans) How it works
Note: Verification
Vlan (Virtual Lans) How it works
Note: Verification
VTP (Vlan Trunking Protocol) How it works
It is a simply means vlan replication protocol
VTP modes
Server
responsible for creating, deleting or modifying entries in the vlan database
Clients
cannot modify the database and rely on the advertisements from the other
switches to update vlan information.
Transparent
maintains its own local VLAN database and does not directly participate in the VTP domain.
A transparent switch will never accept VLAN database information from another switch,
even a server.
Also, a transparent switch will never advertise its local VLAN
database to another switch.
Transparent switches will pass through advertisements from other switches in the VTP domain.
VTP (Vlan Trunking Protocol) How it works
Switch#sh vtp status
VTP Version :2
Configuration Revision :0
Maximum VLANs supported locally : 255
Number of existing VLANs :5
VTP Operating Mode : Server
VTP Domain Name :
VTP Pruning Mode : Disabled
VTP V2 Mode : Disabled
VTP Traps Generation : Disabled
MD5 digest : 0x7D 0x5A 0xA6 0x0E 0x9A 0x72 0xA0 0x3A
Configuration last modified by 0.0.0.0 at 0-0-00 00:00:00
Local updater ID is 0.0.0.0 (no valid interface found)
Switch#
VTP (Vlan Trunking Protocol) How it works
Configuring Switch VTP Modes
Switch>ena Switch#conf t
Switch#conf t Enter configuration commands, one per
Enter configuration commands, one line. End with CNTL/Z.
per line. End with CNTL/Z. Switch(config)#vtp mode tra
Switch(config)#vtp mode client Switch(config)#vtp mode transparent
Setting device to VTP CLIENT mode. Setting device to VTP TRANSPARENT
Switch(config)# mode.
Switch(config)#
Switch#conf t Switch#conf t
Enter configuration commands, one per line. End with
Enter configuration commands, one CNTL/Z.
per line. End with CNTL/Z. Switch(config)#vtp domain PLMAR
Switch(config)#vtp version 2 Changing VTP domain name from NULL to PLMAR
Setting device VLAN database password to d
Switch(config)#
Note: In VTP switch with no domain name will always adopt the domain available but will not effect the change if password
were not the same.
Trunking Encapsulation How it works
2 Trunking Encapsulation
30 bytes additional
Trunking Encapsulation How it works
2 Trunking Encapsulation
2. 802.1Q
Open standard in encapsulation that tagged frames of
It’s vlan ID
Switch>ena
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#int fastEthernet 0/10
Switch(config-if)#switchport trunk encapsulation dot1q
Switch(config-if)#switchport mode trunk
Switch(config-if)#
• 802.1q adds vlan headers to all frames sent out except from frames
originating from its native vlan.
• Frames from native vlan by default are sent out on 802.1q trunks untagged.
• It is a must that both end switch must have the same native vlan configure.
• Native vlan by default is vlan 1.
Hence all frames from vlan 1 will be sent out untag on 802.1q trunks
Switch>ena
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#vlan 10
Switch(config)#int range fastEthernet 0/1 - 10
Switch(config-if-range)#switchport mode access
Switch(config-if-range)#switchport access vlan 10
Switch(config-if-range)#
3. Make sure that the interface connecting to the router of the switch is configure
as trunk port.
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#int gigabitEthernet 0/1
Switch(config-if)#switchport mode trunk
Switch(config-if)#
Inter Vlan Routing How it works
4. Configure the router interface with sub interface and assigned IP address
with encapsulation dot1q.
Router>ena
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int gigabitEthernet 0/0
Router(config-if)#no shut
Router(config-if)#
Inter Vlan Routing How it works
4. Configure the router interface with sub interface and assigned IP address
with encapsulation dot1q.
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int gigabitEthernet 0/0.10
Router(config-subif)#
%LINK-5-CHANGED: Interface GigabitEthernet0/0.10, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0.10, changed state to up
Router(config-subif)#encapsulation dot1Q 10
Router(config-subif)#ip address 192.168.10.1 255.255.255.0
Router(config-subif)#no shut
Router(config-subif)#
Note: Do the same for the other network for vlan 20.
Inter Vlan Routing How it works
5. Verify the configuration check if the router interface in configured with the
correct IP for the 2 vlan and if it has the route for the 2 vlan on the
routing table.
5. Verify the configuration check if the router interface in configured with the
correct IP for the 2 vlan and if it has the route for the 2 vlan on the
routing table.
Using L3 Switch
Switch>ena
Switch#conf t
Enter configuration commands, one per line. End
Switch(config)#vlan 20
with CNTL/Z.
Switch(config-vlan)#exit
Switch(config)#vlan 10
Switch(config)#int range fastEthernet 0/11 - 15
Switch(config-vlan)#exit
Switch(config-if-range)#switchport mode access
Switch(config)#int range fastEthernet 0/1 - 10
Switch(config-if-range)#switchport access vlan 20
Switch(config-if-range)#switchport mode access
Switch(config-if-range)#exit
Switch(config-if-range)#switchport access vlan 10
Switch(config-if-range)#exit
Switch(config)#int gig
Inter Vlan Routing How it works
Using L3 Switch
Using L3 Switch
Switch>ena
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#int gigabitEthernet 0/2
Switch(config-if)#switchport trunk encapsulation dot1q
Switch(config-if)#switchport mode trunk
Switch(config-if)#
Inter Vlan Routing How it works
Using L3 Switch
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#vlan 10
Switch(config-vlan)#exit
Switch(config)#vlan 20
Switch(config-vlan)#
Inter Vlan Routing How it works
Using L3 Switch
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#int vlan 10
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan10, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan10, changed state to up
Switch(config-if)#ip address 192.168.10.1 255.255.255.0
Switch(config-if)#no shut
Switch(config-if)#
Using L3 Switch
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#int vlan 20
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan20, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan20, changed state to up
Switch(config-if)#ip address 192.168.20.1 255.255.255.0
Switch(config-if)#no shut
Using L3 Switch
Switch#
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#IP routing
Switch(config)#
Using L3 Switch
Test Time
Spanning Tree Protocol 802.1d How it works
Create a loop free topology in a switch network
NETWORK A NETWORK B
STP PROCESS
MAC ADDRESS
PRIORITY
Note: The Lower the Bridge ID the Better and will become the Root Bridge
Spanning Tree Protocol 802.1d How it works
STP PROCESS
Default Priority: 32768
SW1 SW3
Mac Address : AAAA Mac Address : CCCC
Priority : 32768 Priority : 32768
Spanning Tree Protocol 802.1d How it works
STP PROCESS
Identifying Root Ports
Default Priority: 32768
The second step in the STP process is identifying
Mac Address : BBBB
Root Ports, or the port on each switch that has the
Priority : 32768
lowest path cost to get to the Root Bridge.
Each switch has only one Root Port, and the
D D Root Bridge cannot have a Root Port.
SW2
Path Cost is a cumulative cost based on the
bandwidth of the links. The higher the bandwidth,
19 cost 19 cost the lower the Path Cost:
Bandwidth Cost
R R 4mbps
10mbps
250
100
SW3 16mbps 62
19 cost 100mbps 19
SW1 Mac Address : CCCC
Mac Address : AAAA 1Gbps 4
Priority : 32768 10Gbps 2
Priority : 32768
Spanning Tree Protocol 802.1d How it works
STP PROCESS
Identify the Designated and None Designated Port
Default Priority: 32768 On the None-Root Switch
Mac Address : BBBB The Criteria will be…
Priority : 32768
R R
SW3
SW1
DP 19 cost NDP
Mac Address : CCCC
Mac Address : AAAA
Priority : 32768
Priority : 32768
Spanning Tree Protocol 802.1d How it works
STP PROCESS
Identify the Designated and None Designated Port
Default Priority: 32768 On the None-Root Switch
Mac Address : BBBB The Criteria will be…
Priority : 32768
R R
SW3
SW1
DP 19 cost NDP
Mac Address : CCCC
Mac Address : AAAA
Priority : 32768
Priority : 32768
Spanning Tree Protocol 802.1d How it works
STP CONFIG
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#spanning-tree vlan 1 root primary
Switch(config)#
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#spanning-tree vlan 1 root secondary
Switch(config)#
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#spanning-tree vlan 1 priority 4096 default value increment
Switch(config)#
Spanning Tree Protocol 802.1d How it works
STP Port States
Listening
15 seconds of listening for the BPDUs
Switch sends / receives BPDUs
Learning
15 seconds of learning Mac Address
Populates switch CAM Table
Forwarding
Port is forwarding the traffic
Blocking
Bonus switch will wait up to 20 seconds before moving
The blocked port into listening phase
Disabled
A network administrator has manually disabled the switch port.
EtherChannel (Link Aggregation)
How it works
Negotiation Protocols
Negotiation Protocols
Switch# sh etherchannel ?
load-balance Load-balance/frame-distribution scheme among ports in
port-channel
port-channel Port-channel information
summary One-line summary per channel-group
<cr>
Switch# sh etherchannel summa
Switch# sh etherchannel summary ?
<cr>
Switch# sh etherchannel summary
Flags: D - down P - in port-channel
I - stand-alone s - suspended
H - Hot-standby (LACP only)
R - Layer3 S - Layer2
U - in use f - failed to allocate aggregator
u - unsuitable for bundling
w - waiting to be aggregated
d - default port
Number of channel-groups in use: 1
Number of aggregators: 1
Group Port-channel Protocol Ports
------+-------------+-----------+----------------------------------------------