0% found this document useful (0 votes)
1K views8 pages

Commands For Ccna 3 4 Lab

Download as docx, pdf, or txt
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 8

Lab 2.5.

1: Basic Switch Configuration


Switch>enable
Switch#

Switch#show running-config

Switch#show startup-config
startup-config is not present

Switch#show interface vlan1

Switch#show ip interface vlan1

Switch#show vlan

Switch#show flash

Switch#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname S1
S1(config)#exit
S1#

Switch#copy running-config startup-config


Destination filename [startup-config]? (enter)
Building configuration...
[OK]

S1(config)#line console 0
S1(config-line)#password cisco
S1(config-line)#login
S1(config-line)#line vty 0 15
S1(config-line)#password cisco
S1(config-line)#login
S1(config-line)#exit

S1(config)#enable secret class

S1(config)#vlan 99
S1(config-vlan)#exit
S1(config)#interface vlan99
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan99, changed state to down

S1(config-if)#ip address 172.17.99.11 255.255.255.0


S1(config-if)#no shutdown
S1(config-if)#exit
S1(config)#

S1(config)#interface range fa0/1 - 24


S1(config-if-range)#switchport access vlan 99
S1(config-if-range)#exit
S1(config)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to
down
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan99, changed state to up

S1(config)#ip default-gateway 172.17.99.1


S1(config)#exit
S1#show interface vlan 99

S1#show mac-address-table

S1#show mac-address-table ?

S1#show mac-address-table address dynamic

S1#clear mac-address-table dynamic

S1(config)#mac-address-table static 00e0.2917.1884 vlan 99 interface fastethernet 0/18

S1(config)#no mac-address-table static 00e0.2917.1884 vlan 99 interface fastethernet 0/18

S1# configure terminal


S1(config)#interface fastethernet 0/18
S1(config-if)#switchport port-security ?
aging Port-security aging commands
mac-address Secure mac address
maximum Max secure addresses
violation Security violation mode
<cr>

S1(config-if)#switchport mode access


S1(config-if)#switchport port-security
S1(config-if)#switchport port-security maximum 2
S1(config-if)#switchport port-security mac-address sticky
S1(config-if)#switchport port-security violation protect
S1(config-if)#end

S1#show port-security

S1(config-if)#switchport port-security maximum 1


S1(config-if)#switchport port-security violation shutdown

S1#show run
Building configuration...
<output omitted>
!
interface FastEthernet0/18
switchport access vlan 99
switchport mode access
switchport port-security
switchport port-security mac-address sticky
switchport port-security mac-address sticky 00e0.2917.1884
speed 100
duplex full
Lab 3.5.1: Basic VLAN Configuration
It is a good practice to disable any unused ports on the switches by putting them in shutdown. Disable all ports
on the switches and also to clear switch configurations

Switch#config term
Switch(config)#interface range fa0/1-24
Switch(config-if-range)#shutdown
Switch(config-if-range)#interface range gi0/1-2
Switch(config-if-range)#shutdown

Re-enable the user ports on switch

S3(config)#interface range fa0/6, fa0/11, fa0/18


S3(config-if-range)#switchport mode access
S3(config-if-range)#no shutdown

S1(config)#vlan 10
S1(config-vlan)#name faculty/staff
S1(config-vlan)#vlan 20
S1(config-vlan)#name students
S1(config-vlan)#vlan 30
S1(config-vlan)#name guest
S1(config-vlan)#vlan 99
S1(config-vlan)#name management
S1(config-vlan)#end
S1#

S1#show vlan brief

S1(config)#interface range fa0/6-10


S1(config-if-range)#switchport access vlan 30
S1(config-if-range)#interface range fa0/11-17
S1(config-if-range)#switchport access vlan 10
S1(config-if-range)#interface range fa0/18-24
S1(config-if-range)#switchport access vlan 20
S1(config-if-range)#end
S1#copy running-config startup-config
Destination filename [startup-config]? [enter]
Building configuration...
[OK]

show vlan id vlan-number command on S2 to see which ports are assigned to VLAN 10

The show vlan name vlan-name displays the same output.

You can also view VLAN assignment information using the show interfaces interface switchport command.

Assign the management VLAN.


A management VLAN is any VLAN that you configure to access the management capabilities of a
switch. VLAN 1 serves as the management VLAN if you did not specifically define another VLAN. You
assign the management VLAN an IP address and subnet mask. A switch can be managed via HTTP,
Telnet, SSH, or SNMP. Because the out-of-the-box configuration of a Cisco switch has VLAN 1 as the
default VLAN, VLAN 1 is a bad choice as the management VLAN. You do not want an arbitrary user
who is connecting to a switch to default to the management VLAN. Recall that you configured the
management VLAN as VLAN 99 earlier in this lab.
From interface configuration mode, use the ip address command to assign the management IP
address to the switches.
S1(config)#interface vlan 99
S1(config-if)#ip address 172.17.99.11 255.255.255.0
S1(config-if)#no shutdown

Configure trunking and the native VLAN for the trunking ports on all switches.
Trunks are connections between the switches that allow the switches to exchange information for all
VLANS. By default, a trunk port belongs to all VLANs, as opposed to an access port, which can only
belong to a single VLAN. If the switch supports both ISL and 802.1Q VLAN encapsulation, the trunks
must specify which method is being used. Because the 2960 switch only supports 802.1Q trunking, it
is not specified in this lab.

S1(config)#interface range fa0/1-5


S1(config-if-range)#switchport mode trunk
S1(config-if-range)#switchport trunk native vlan 99
S1(config-if-range)#no shutdown
S1(config-if-range)#end

S1#show interface trunk


Lab 4.4.1: Basic VTP Configuration
Switch>enable
Switch#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname S1
S1(config)#enable secret class
S1(config)#no ip domain-lookup
S1(config)#line console 0
S1(config-line)#password cisco
S1(config-line)#login
S1(config-line)#line vty 0 15
S1(config-line)#password cisco
S1(config-line)#login
S1(config-line)#end
%SYS-5-CONFIG_I: Configured from console by console
S1#copy running-config startup-config
Destination filename [startup-config]?

Building configuration...
[OK]

Disable all ports by using the shutdown command.

Re-enable the user ports on S2 and S3.

S2(config)#interface fa0/6
S2(config-if)#switchport mode access
S2(config-if)#no shutdown
S2(config-if)#interface fa0/11
S2(config-if)#switchport mode access
S2(config-if)#no shutdown
S2(config-if)#interface fa0/18
S2(config-if)#switchport mode access
S2(config-if)#no shutdown

Re-enable the trunk ports on S1, S2 and S3

S2(config)#interface fa0/1

S2(config-if)#no shutdown

S2#show vtp status

S1(config)#vtp mode server


Device mode already VTP SERVER.
S1(config)#vtp domain Lab4
Changing VTP domain name from NULL to Lab4
S1(config)#vtp password cisco

Setting device VLAN database password to cisco


S1(config)#end
S2(config)#vtp mode client
Setting device to VTP CLIENT mode
S2(config)#vtp domain Lab4
Changing VTP domain name from NULL to Lab4
S2(config)#vtp password cisco
Setting device VLAN database password to cisco
S2(config)#end
S3(config)#vtp mode transparent
Setting device to VTP TRANSPARENT mode.
S3(config)#vtp domain Lab4
Changing VTP domain name from NULL to Lab4
S3(config)#vtp password cisco
Setting device VLAN database password to cisco
S3(config)#end

S2(config)# interface range fa0/1-5


S2(config-if-range)#switchport mode trunk
S2(config-if-range)#switchport trunk native vlan 99
S2(config-if-range)#no shutdown
S2(config-if-range)#end

S2(config)#interface fa0/6
S2(config-if)#switchport port-security
S2(config-if)#switchport port-security maximum 1
S2(config-if)#switchport port-security mac-address sticky
S2(config-if)#interface fa0/11
S2(config-if)#switchport port-security

S2(config-if)#switchport port-security maximum 1


S2(config-if)#switchport port-security mac-address sticky
S2(config-if)#interface fa0/18
S2(config-if)#switchport port-security
S2(config-if)#switchport port-security maximum 1
S2(config-if)#switchport port-security mac-address sticky
S2(config-if)#end

S2(config)#vlan 88
S2(config-vlan)#name test
S2(config-vlan)#

S3(config)#no vlan 88

Configure the management interface address on all three switches.


S1(config)#interface vlan 99
S1(config-if)#ip address 172.17.99.11 255.255.255.0
S1(config-if)#no shutdown
S2(config)#interface vlan 99
S2(config-if)#ip address 172.17.99.12 255.255.255.0
S2(config-if)#no shutdown
S3(config)#interface vlan 99
S3(config-if)#ip address 172.17.99.13 255.255.255.0
S3(config-if)#no shutdown

S3(config)#interface range fa0/6-10


S3(config-if-range)#switchport access vlan 30
S3(config-if-range)#interface range fa0/11-17
S3(config-if-range)#switchport access vlan 10
S3(config-if-range)#interface range fa0/18-24
S3(config-if-range)#switchport access vlan 20
S3(config-if-range)#end
S3#copy running-config startup-config
Destination filename [startup-config]? [enter]
Building configuration...
[OK]
Configure VTP Pruning on the Switches
VTP pruning allows a VTP server to suppress IP broadcast traffic for specific VLANs to switches that
do not have any ports in that VLAN. By default, all unknown unicasts and broadcasts in a VLAN are
flooded over the entire VLAN. All switches in the network receive all broadcasts, even in situations in
which few users are connected in that VLAN. VTP pruning is used to eliminate or prune this
unnecessary traffic. Pruning saves LAN bandwidth because broadcasts do not have to be sent to
switches that do not need them.
Pruning is configured on the server switch with the vtp pruning command in global configuration
mode. The configuration is pushed to client switches.
Confirm VTP pruning configuration on each switch using the show vtp status command. VTP
pruning mode should be enabled on each switch.
S1#show vtp status
VTP Version : 2
Configuration Revision : 17
Maximum VLANs supported locally : 255
Number of existing VLANs : 9
VTP Operating Mode : Server
VTP Domain Name : Lab4
VTP Pruning Mode : Enabled
<output omitted>
Lab 6.4.1: Basic Inter-VLAN Routing.

Configure the Router and the Remote Server LAN

Clear the configuration on the router and reload.


Router#erase nvram:
Erasing the nvram filesystem will remove all configuration files!
Continue? [confirm]
Erase of nvram: complete
Router#reload
System configuration has been modified. Save? [yes/no]: no

R1(config)#interface fastethernet 0/1


R1(config-if)#no shutdown
R1(config-if)#interface fastethernet 0/1.1
R1(config-subif)#encapsulation dot1q 1
R1(config-subif)#ip address 172.17.1.1 255.255.255.0
R1(config-if)#interface fastethernet 0/1.10
R1(config-subif)#encapsulation dot1q 10
R1(config-subif)#ip address 172.17.10.1 255.255.255.0
R1(config-if)#interface fastethernet 0/1.20
R1(config-subif)#encapsulation dot1q 20
R1(config-subif)#ip address 172.17.20.1 255.255.255.0
R1(config-if)#interface fastethernet 0/1.30
R1(config-subif)#encapsulation dot1q 30
R1(config-subif)#ip address 172.17.30.1 255.255.255.0
R1(config-if)#interface fastethernet 0/1.99

R1(config-subif)#encapsulation dot1q 99 native

R1(config-subif)#ip address 172.17.99.1 255.255.255.0

Note the following points in this configuration:


• The physical interface is enabled using the no shutdown command, because router interfaces
are down by default. The virtual interfaces are up by default.
• The subinterface can use any number that can be described with 32 bits, but it is good practice
to assign the number of the VLAN as the interface number, as has been done here.
• The native VLAN is specified on the L3 device so that it is consistent with the switches.
Otherwise, VLAN 1 would be the native VLAN by default, and there would be no communication
between the router and the management VLAN on the switches.

You might also like