Basic Cisco Switch Configuration
Basic steps needed to configure and setup a Cisco switch from scratch.
I. Connect to the device via console
Using software such as PuTTY, connect to the console of the switch. You’ll get the initial command prompt
Switch>
Type
enable
and hit enter. You’ll get into priviled EXEC mode
Switch#
Now, get into Global Configuration Mode:
Switch# configure terminal
Switch(config)#
II. Set up a hostname for the particular switch to distinguish it in the network
Switch(config)# hostname switch1
switch1(config)#
III. Configure an administration password (enable secret password)
switch1(config)# enable secret somestrongpass
** The password above will be used to enter into Privileged EXEC mode **
IV. Configure a password for Telnet and Console access
switch1(config)# line vty 0 15
switch1(config-line)# password strongtelnetpass
switch1(config-line)# login
switch1(config-line)# exit
switch1(config)#
switch1(config)# line console 0
switch1(config-line)# password strongconsolepass
switch1(config-line)# login
switch1(config-line)# exit
switch1(config)#
V. Define which IP addresses are allowed to access the switch via Telnet
switch1(config)# ip access-list standard TELNET-ACCESS
switch1(config-std-nacl)# permit 10.1.1.100
switch1(config-std-nacl)# permit 10.1.1.101
switch1(config-std-nacl)# exit
** Apply the access list to Telnet VTY Lines **
switch1(config)# line vty 0 15
switch1(config-line)# access-class TELNET-ACCESS in
switch1(config-line)# exit
switch1(config)#
VI Assign IP address to the switch for management
** Management IP is assigned to VLAN 1 by default **
switch1(config)# interface vlan 1
switch1(config-if)# ip address 10.1.1.200 255.255.255.0
switch1(config-if)# exit
switch1(config)#
VII Assign default gateway to the switch
switch1(config)# ip default-gateway 10.1.1.254
VIII: Disable unneeded ports on the switch
** Assume that we have a 48-port switch and we don’t need ports 25 to 48 **
switch1(config)# interface range fe 0/25-48
switch1(config-if-range)# shutdown
switch1(config-if-range)# exit
switch1(config)#
IX Configure Layer2 VLANs and assign ports to the them
switch1(config)# vlan 2
switch1(config-vlan)# name VLAN2NAME
switch1(config-vlan)# exit
switch1(config)# vlan 3
switch1(config-vlan)# name VLAN3NAME
switch1(config-vlan)# exit
** Ports 1-2 are assigned to VLAN2 and ports 3-4 to VLAN3
switch1(config)# interface range fe 0/1-2
switch1(config-if-range)# switchport mode access
switch1(config-if-range)# switchport access vlan 2
switch1(config-if-range)# exit
switch1(config)# interface range fe 0/3-4
switch1(config-if-range)# switchport mode access
switch1(config-if-range)# switchport access vlan 3
switch1(config-if-range)# exit
X: Save the configuration
switch1(config)# exit
switch1# wr