CCNA | P2: Implementing Ethernet LANs | C3: Configuring Basic Switch Management

CCNA | P2: Implementing Ethernet LANs | C3: Configuring Basic Switch Management

Welcome to an electrifying blog post where we’ll be exploring the world of switch management using Cisco IOS commands! Switch management is the cornerstone of network security and performance, giving you the power to control who can access the switch and how they can do it.

We’ll be delving into different methods of switch management, including shared passwords, local usernames and passwords, and SSH. Each method will be explained in detail with examples to guide you along the way.

Lesson Contents

Shared Password

Starting with the basics, one of the simplest ways to secure your switch is by using a shared password for both console and VTY lines. Console lines provide direct access to the switch using a cable, while VTY lines offer remote access using SSH or telnet.
To set a shared password, you’ll need to enter the following commands:

(config)# line console 0/line vty 0 15
(config-line)# login
(config-line)# password pass

For instance, if you want to set a shared password of “cisco” for all VTY lines, you would enter these commands:

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

To access the switch using a shared password, simply enter the password when prompted. For example, if you use telnet to connect to the switch, you would see something like this:

telnet 192.168.1.1
Trying 192.168.1.1 ...
Connected to 192.168.1.1.
Escape character is '^]'.
User Access Verification
Password: cisco

The advantage of using a shared password is its simplicity in configuration and memorability. However, it’s not the most secure method as anyone who knows the password can access the switch. Also, it doesn’t allow you to assign different privileges or roles to different users.

Enable Mode Password

Another method to secure the switch is to use an enable mode password. Enable mode is a special mode that provides access to more commands and configuration options on the switch. To enter enable mode, type “enable” at the prompt and enter the enable mode password when prompted. To set an enable mode password, you need to enter this command:

(config)# enable secret pass

For example, if you want to set an enable mode password of “cisco”, you would enter this command:

(config)# enable secret cisco

To access the switch using an enable mode password, you need to enter the enable mode and then enter the password when prompted. For example, if you use telnet to connect to the switch, you would see something like this:

telnet 192.168.1.1
Trying 192.168.1.1 ...
Connected to 192.168.1.1.
Escape character is '^]'.
User Access Verification
Password: cisco
Switch>enable
Password: cisco
Switch#

The advantage of using an enable mode password is that it adds an extra layer of security, as only authorized users can enter enable mode and make changes on the switch. However, it still uses a single password for all users, which can be compromised or forgotten

Local Usernames and Passwords

To access the switch using local usernames and passwords, you’ll need to enter the username and password when prompted. For instance, if you use telnet to connect to the switch, you would see something like this:

telnet 192.168.1.1
Trying 192.168.1.1 ...
Connected to 192.168.1.1.
Escape character is '^]'.
User Access Verification
Username: guest
Password: guest
Switch>show running-config
% Command authorization failed.
Switch>enable
Password: guest
% Access denied
Switch>

As you can see, the guest account cannot execute the “show running-config” command or enter enable mode, as it does not have enough privileges. The advantage of using local usernames and passwords is that it provides more security and flexibility, as you can create different user accounts with different privileges and roles. However, it requires more configuration and maintenance, as you need to create and manage each user account on the switch.

SSH

The most secure way to manage the switch is to use SSH. SSH is a protocol that provides encrypted and authenticated communication between devices. It’s more secure than telnet, as it prevents eavesdropping, tampering, and spoofing of data. To use SSH, you need to enter these commands:

(config)# hostname hostname
(config)# ip domain-name example.com
(config)# crypto key generate rsa [modulus len]
(config)# username user secret pass
(config)# line vty 0 15
(config-line)# transport input ssh
(config-line)# login local

For example, if you want to enable SSH on the switch with a hostname of “switch1”, a domain name of “example.com”, a key size of 2048 bits, and a user account with username “admin” and password “cisco”, you would enter these commands:

(config)# hostname switch1
(config)# ip domain-name example.com
(config)# crypto key generate rsa modulus 2048
(config)# username admin secret cisco
(config)# line vty 0 15
(config-line)# transport input ssh
(config-line)# login local

To access the switch using SSH, you need to use an SSH client program, such as PuTTY or SecureCRT. You need to specify the IP address or FQDN (fully qualified domain name) of the switch, such as 192.168.1.1 or switch1.example.com. You also need to enter the username and password when prompted. For example, if you use PuTTY to connect to the switch, you would see something like this:

login as: admin
[email protected]'s password:
Switch#

The advantage of using SSH is that it provides the highest level of security and privacy for switch management, as it encrypts and authenticates all data exchanged between devices. However, it requires more configuration and resources, as you need to set up hostname, domain name, RSA keys, user accounts, and SSH client programs.
Switch IP Settings
If you’re working with switches, you might want to know how to configure their IP settings. In the next part of this blog post, I will explain the basics of switch IP settings and show you some useful commands to manage them.

Switch IP Settings

Switches use layer 2 Switch Virtual Interfaces (SVI) instead of layer 3 port interfaces (unless specifically configured on a Layer 3 switch). SVI interfaces are associated with a VLAN. A layer 2 switch can have only 1 IP address, to be used for administrative access. A layer 3 switch can have multiple IP addresses (on its SVI or physical interfaces) and route packets between them.
To set the IP address and default gateway for a switch, you need to enter the interface context for the SVI of the VLAN you want to configure. For example, if you want to assign an IP address to VLAN 1, you need to type:

(config)# interface vlan 1

Then, you can either set a static IP address and netmask, or use DHCP to obtain an address automatically. For example, to set a static IP address of 10.10.10.10 with a netmask of 255.255.255.0, you need to type:

(config-if)# ip address 10.10.10.10 255.255.255.0

To use DHCP, you need to type:

(config-if)# ip address dhcp

After setting the IP address, you need to enable the interface with the no shutdown command:

(config-if)# no shutdown

To set the default gateway for the switch, you need to type:

(config)# ip default-gateway address

where address is the IP address of the gateway device. For example, if the gateway device has an IP address of 10.10.10.1, you need to type:

(config)# ip default-gateway 10.10.10.1

To set one or more DNS servers for the switch, you need to type:

(config)# ip name server server address [secondary-address]

where server address and secondary-address are the IP addresses of the DNS servers. For example, if the DNS servers have IP addresses of 8.8.8.8 and 8.8.4.4, you need to type:

(config)# ip name server 8.8.8.8 8.8.4.4

To verify the IP settings of the switch, you can use some show commands, such as:

#show dhcp lease – show DHCP leases on all SVIs
#show interfaces vlan 1 – show details for VLAN 1 SVI
#show ip default-gateway – show default gateway

If you want to configure multiple interfaces at once, you can use a range command, such as:

(config)# configure Gi0/0 - 24

This will allow you to enter the interface context for all interfaces from Gi0/0 to Gi0/24 and apply commands to them.

Command Line Miscellanea

In addition to the basic commands, there are several miscellaneous commands that can enhance your experience with the command line interface of the switch:

#show history  # This command shows the exec command history.
#terminal history size x  # This command sets the history size to x commands for this session only.
(config)# history size x  # This command sets the default history size to x commands.
(config)# no logging console  # This command prevents the display of syslog messages on the console.
(config)# logging console  # This command enables the display of syslog messages on the console.
(config-line)# logging synchronous  # This command synchronises syslog messages with other output.
(config-line)# exec-timeout minutes seconds  # This command logs out users after a set time of inactivity (5 minutes by default, 0 means do not time out).
(config)# no ip domain-lookup  # This command prevents the resolution of 
what looks to be a domain name in the command line.

These commands can help you manage the command history, control the display of syslog messages, set the timeout for user inactivity, and more. They provide additional flexibility and control over the switch management process.

Summary

In this comprehensive guide, we’ve explored the fascinating world of switch management using Cisco IOS commands. Switch management is a pivotal component of network security and performance, as it empowers you to control who can access the switch and how they can do it.
We’ve navigated through various methods of switch management, including:
Shared Password: A simple method that uses a common password for both console and VTY lines. It’s easy to configure and remember, but lacks in security as anyone with the password can access the switch.
Enable Mode Password: This method adds an extra layer of security, allowing only authorized users to enter enable mode and make changes on the switch. However, it still uses a single password for all users.
Local Usernames and Passwords: This method provides more security and flexibility by creating different user accounts with different privileges and roles. However, it requires more configuration and maintenance.
SSH: The most secure method that provides encrypted and authenticated communication between devices. It requires more configuration and resources, but offers the highest level of security and privacy.

We also delved into the configuration of Switch IP settings and the use of miscellaneous commands that can enhance your experience with the command line interface of the switch. These commands help manage the command history, control the display of syslog messages, set the timeout for user inactivity, and more, providing additional flexibility and control over the switch management process.
Each method of switch management carries its own set of advantages and disadvantages concerning security, simplicity, flexibility, and performance. It’s crucial to select the method that aligns best with your specific needs and preferences. Stay tuned for more captivating insights into the networking universe! 🚀

Kunal Patel | Contact me
description

Kunal Patel

Working as Assistant Manager IT my curiosity led me to learn technologies beyond networking, including cloud computing, Python, APIs, Rust, Dart/Flutter, Linux, and Virtualization.
Mumbai, India