Configuring Cisco switches is an essential part of any IT network. With the right configuration, you can ensure that your network is running optimally and securely. In this article, we will discuss how to configure a Cisco switch using the Cisco IOS command-line interface (CLI). We will cover topics such as setting up basic networking parameters, configuring VLANs. After reading this article, you should be able to successfully configure a Cisco switch for your IT network.
Switch>enable Switch#configure terminal Enter configuration commands, one per line. End with CNTL/Z. # CHANGING HOSTNAME Switch(config)#hostname SWITCH1 # SET ENABLE PASSWORD SWITCH1(config)#enable secret !WeConfigure123. # SET TELNET PASSWORD SWITCH1(config)#line vty 0 15 SWITCH1(config-line)#password !YouConfigure123. SWITCH1(config-line)#login SWITCH1(config-line)#exit # SET CONSOLE PASSWORD SWITCH1(config)#line console 0 SWITCH1(config-line)#password !IConfigure123. SWITCH1(config-line)#login SWITCH1(config-line)#exit # SET MANAGEMENT IP (VLAN1) SWITCH1(config)#interface vlan 1 SWITCH1(config-if)#ip address 192.168.1.1 255.255.255.0 SWITCH1(config-if)#exit # SET DEFAULT GATEWAY SWITCH1(config)#ip default-gateway 192.168.1.254 # SETTING UP VLANs (OPTIONAL) SWITCH1(config)#vlan 2 SWITCH1(config-vlan)#name SALES SWITCH1(config-vlan)#exit SWITCH1(config)#vlan 3 SWITCH1(config-vlan)#name ENGINEERING SWITCH1(config-vlan)#exit SWITCH1(config)#int vlan 2 SWITCH1(config-if)#ip address 192.168.2.1 255.255.255.0 SWITCH1(config-if)#exit SWITCH1(config)#int vlan 3 SWITCH1(config-if)#ip address 192.168.3.1 255.255.255.0 SWITCH1(config-if)#exit SWITCH1(config)#do wr #DESIGNATING ACCESS PORTS SWITCH1(config)#interface range g1/0/1-12 SWITCH1(config-if-range)#sw mode acc SWITCH1(config-if-range)#sw acc vlan 2 SWITCH1(config-if-range)#no sh SWITCH1(config-if-range)#exit SWITCH1(config)#interface range g1/0/13-24 SWITCH1(config-if-range)#sw mode acc SWITCH1(config-if-range)#sw acc vlan 3 SWITCH1(config-if-range)#no sh SWITCH1(config-if-range)#exit
After this basic configuration you might want to check your current configuration on the switch. You may follow below commands to check your switch status etc.
- #show running-config >> shows currently running configuration on the switch.
- #show vlan >> shows all the VLANs and the member ports.
- #show interfaces >> shows all ports and port related configurations.
- #show interface g1/0/x >> shows g1/0/x’s port configuration, which vlan it belongs to etc.