Basic Config
Basic Config
Most Cisco devices use a CLI (Command Line Interface) to configure the network device. The CLI is an
interface, based on text. We type in configuration commands and use show commands to get the output
from the router or switch. There are also GUIs (Graphical User Interface) for the routers, switches and
firewalls but the CLI is much easier to work.
User EXEC level allows you to access only basic monitoring commands; privileged EXEC level allows
you to access all router commands. Privileged EXEC level can be password protected to allow only
authorized users the ability to configure or manage the router. From privileged EXEC level, you can
access all the command modes.
There are five command modes: global configuration mode, interface configuration mode, subinterface
configuration mode, router configuration mode, and line configuration mode.
After an EXEC session is established, commands within Cisco IOS Software are hierarchically structured.
The following figure illustrates a simple high-level schematic diagram of some Cisco IOS commands.
This figure summarizes the different modes you will explore in the Interface Labs in a later section.
Privilege levels
Privilege levels define what commands users can issue after they have logged into a network device.
Cisco Internetwork Operating System (IOS) currently has 16 privilege levels that range from 0 through
15. Users have access to limited commands at lower privilege levels compared to higher privilege levels.
To illustrate this, think of being on a mountain, when you're at the bottom (Level 0) you see very little
around you. As soon as you make your way to the top of the mountain (Level 15), you see a whole lot
more, having access to commands assigned to level 15 and below. Using the command "show privilege"
allows the user to determine what privilege level a user is currently assigned, here are two examples:
Router>
Router>show privilege
Current privilege level is 1
Router>
Once we type "enable", we are assigned a higher privilege level. (By default, this level is 15; we can also
use the command "enable 15" to specifically elevate our privilege level to 15.)
Router>enable 15
Router#
Router#show privilege
Current privilege level is 15
Router#
Typing "?" under each privilege level provides a list of available commands. You'll see certain commands
missing while in level 1 as opposed to level 15.
Typically the preconfigured default levels are 1 and 15. Level 1 being a "read-only" mode with limited
access to commands and no ability to modify the running configuration; with level 15 having full
administrative access
There is no middle ground; it‘s all or nothing.
Level 15: Full Access to all commands, such as the "Reload" command, and the ability to make
configuration changes.
Level 1: Read-only, and access to limited commands, such as the "Ping" command.
Console Cabling
On the switch, you will find one or two physical connectors for the console. Take a look at the picture
below:
This is a Cisco Router; you see the light blue RJ45 port. This cable is called a Cisco console cable and
you will need a serial port on your computer. Modern computers or laptops don‘t have these serial ports
anymore so you might have to use a serial-to-USB cable like this one:
This cable emulates a serial port and has a USB connection. Once you have connected your computer to
the switch, we can start a terminal application to access the CLI.
Terminal Emulator
There are many terminal emulator applications. If you are new to this, the best one to start with is Putty.
It‘s free and allows you to connect using a serial connection, telnet and SSH. Once you have downloaded
it, you will see the main screen:
Make sure you select the ―Serial‖ option. The default speed is 9600 (baud rate). The COM port will
depend on your computer; it might be COM1 but if you are unsure, check the device manager in
Windows. Click on Start > Run and enter ―devmgmt.msc‖:
Depending if your switch already has a configuration or not, you might see the following message:
If there is no configuration, the switch will ask you if you would like to follow a wizard called the initial
configuration dialog. If you see this, type ―no‖ to continue so that we can start with a blank configuration.
We will configure the device ourselves.
Router>
The > symbol tells us that we are currently in user mode. To get full access to the switch, we have to enter
privileged mode, also called enabled mode. Here is how to do this:
Router>enable
Router#
1. Switch Configuration
hostname
login banner
enable password for accessing privilege mode
assign console password to prevent console login
assign IP for vlan 1 (Management VLAN)
configure virtual terminal for telnet session
set default gateway for the switch
1. Router as Configuration
hostname
login banner
enable password for accessing privilege mode
Assign IP Address on Router Interface
assign console password to prevent console login
configure virtual terminal for telnet session
Assign IP for the PC
Save all configurations
Verification
Switch Configuration
1. First check the startup-config and running-config…If there any configuration is exist
When you type a command in the global configuration mode it is stored in the running configuration. A
running configuration resides in a device‘s RAM, so if a device loses power, all configured commands will
be lost.
So you need to copy your current configuration into a startup configuration. A startup configuration is
stored in the NVRAM of a device, now all configurations are saved even if the device loses power.
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch (config) #hostname DU
DU(config)#
Enable password will restrict one's access to privilege mode which is like a root user's password. We can
set it in two ways: enable password / enable secret command.
# enable secret password provides encryption automatically using MD5 hash algorithm.
The enable password password does not encrypt the password and can be view in clear text in the
running-config. In order to encrypt the enable password password, use the service password-encryption
command. Actually, the enable secret password command provides stronger encryption than the service
password-encryption command.
A login banner is displayed whenever someone connects to the router by telnet or console connections
5. Console Password
We can protect console port of Cisco devices using console port password.
DU(config)#line console 0
DU(config-line)#password ashish123
DU(config-line)#login
DU(config-line)#exit
DU(config)#
6. Telnet configuration for remote access
Telnet is a user command and an underlying TCP/IP protocol for accessing remote devices.
The VTY lines are the Virtual Terminal lines of the router. They are Virtual in the sense that they are a
function of software - there is no hardware associated with them. They appear in the configuration as line
vty 0 4.
DU#conf t
Enter configuration commands, one per line. End with CNTL/Z.
DU(config)#line vty 0 4
DU(config-line)#password ashish@123#
DU(config-line)#login
DU(config-line)#exit
By default, all switch ports are part of VLAN 1. VLAN 1 contains control plane traffic and can contain
user traffic.
By default, VLAN 1 is the management VLAN. Management VLAN is used for purposes such as telnet,
SNMP, and syslog.
DU(config)#interface vlan 1
DU(config-if)#ip address 192.168.10.10 255.255.255.0
DU(config-if)#no shutdown
DU(config-if)#exit
DU(config)#
The switch should be configured with a default gateway if the switch will be managed remotely from
networks not directly connected. The default gateway is the first Layer 3 device (such as a router) on the
same management VLAN network to which the switch connects. The switch will forward IP packets with
destination IP addresses outside the local network to the default gateway.
Router Configuration
Router #conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router (config)#hostname BUET
BUET(config)#
5. Console password
BUET(config)#line console 0
BUET(config-line)#password ashish123
BUET(config-line)#login
BUET(config-line)#exit
BUET(config)#
6. Enter Virtual Terminal lines and give a password ashish@123#, to login remotely
BUET(config)#line vty 0 4
BUET(config-line)#password ashish@123#
BUET(config-line)#login
BUET(config-line)#exit
BUET(config)#
By default, all interfaces on a Cisco router are “Administratively Down”. To bring an interface up,
issue the no shutdown command.
BUET(config-if)#no shutdown
BUET(config-if)#exit
BUET(config)#
8. Save Configuration
BUET#write memory
Building configuration...
[OK]
DU# write memory
Building configuration
[OK]
C:\>ping 192.168.10.3
C:\>ping 192.168.10.1
N.B. if the switch is L3 you can assign IP address to its interfaces as follows:
DU(config)# ip routing
Telnet was designed to work within a private network and not across a public network where threats can
appear. Because of this, all the data is transmitted in plain text, including passwords. This is a major
security issue and the developers of SSH used encryptions to make it harder for other people to sniff the
password and other relevant information.
Secure Shell (SSH) is a protocol which provides a secure remote access connection to network devices.
Communication between the client and server is encrypted in SSH. To do this, it uses a RSA
public/private keypair.
There are two versions: version 1 and 2. Version 2 is more secure and commonly used.
Enable SSH on Cisco Switch
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#interface vlan 1
Switch(config-if)#ip address 192.168.10.10 255.255.255.0
Switch(config-if)#no shutdown
The name of the RSA keypair will be the hostname and domain name of the router.
Switch(config)#hostname ASHISH-SW
ASHISH-SW(config)#ip domain-name ashish.com
Step 4: Generate the RSA Keys
ASHISH-SW(config)#line vty 0 4
ASHISH-SW(config-line)#transport input ssh
ASHISH-SW(config-line)#login local
Step 7: Create the username password
ASHISH-SW(config)#line console 0
ASHISH-SW(config-line)#logging synchronous
ASHISH-SW(config-line)#login local
Router>en
Router#conf t
Router(config)#hostname Venus
Venus(config)#interface fastEthernet 0/0
Venus(config-if)#ip address 192.168.10.1 255.255.255.0
Venus(config-if)#no shutdown
Venus(config-if)#exit
Venus(config)#ip domain-name cisco.com
Venus(config)#username ashish privilege 15 password cisco123
Venus(config)#crypto key generate rsa
Venus#show ip ssh