Basic Cisco Ios Commands
Basic Cisco Ios Commands
Basic Cisco Ios Commands
1 Switch>
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:
1 Switch> enable
2 Switch#
Above you can see that the “>” symbol changed to “#”. This tells us we are now in enabled mode,
granting us full access to the switch.
1 Switch# exit
2 Switch>
1 Switch#show
The show mac address-table dynamic command tells us all MAC addresses that the switch
has learned.
What if we want to see the entire conguration of the switch? There’s a show command for
that:
Use the copy command to copy the running conguration to the startup conguration.
Here’s a simple illustration to help you visualize the two conguration files:
Instead of copy, we can also use write to save our configurations
1 Switch# write
4. Configuration
You probably want to make some changes to the conguration of your switch/router. Change its
default hostname, perhaps add an IP address so you can manage it remotely, etc.
To do this, we have to use conguration mode. In this mode, we can make changes to the
conguration of the switch. Here’s how you enter configuration mode:
1 Switch> enable
First, you need to make sure you are in enable mode. Now you can use the following
command:
With the congure terminal command, we enter conguration mode. Now we can make
changes to the switch.
Let’s start with something simple, let’s change the name of our switch with the hostname command:
1 Switch(config)#hostname SW1
2 SW1(config)#
Here is a picture to help you visualize the different modes and how to move from one to
another:
5. Do Command
If you are in the conguration mode, you will face the following issue if you try a show
command:
1 SW1(config)#show version
2 ^
Why? The command is typed correctly but the problem here is that this is a command for the
enable mode, not the conguration mode.
You could exit the conguration mode but instead, you can add do in front of the show
command:
Problem solved !
6. Question Mark
Not sure what the command was again or how to type it? The question mark is your friend. If
you use it, it will tell you all possible commands:
1 SW1#?
The question mark works in user, enable and conguration mode so go ahead and try it
everywhere. It also helps you finding out which commands are possible. For example :
1 SW1#cl?
2 clear clock
If I type cl? then the CLI tells me there are two possible commands:
• clear
• clock
7. Abbreviation
There is no need to type the exact command for CLI to accept it. You can also shorten
commands. For example, I just used copy running-config startup config but I don’t have to
type the entire thing. This will also work:
1 SW1#copy run st
After the copy command, there is only one parameter that starts with “run” which is
running-cong. The only parameter that starts with “st” is startup-cong. Once you get more
experience with the CLI and become familiar with the different commands, you will
automatically use this more often.
8. Advanced Configurations (Hostname, Interface, Telnet, SSH, console…)
With the congure terminal command, we enter conguration mode. Now we can make
changes to the switch/Router.
A. Hostname
Let’s change the name of our switch with the hostname command:
1 R1(config)#hostname name
2 name(config)#
D. Console Port
1 R1(config)#line cons 0
2 R1(config-line)#login local
1 R1(config)#line vty 0 4
2 R1(config-line)#login local
1 R1(config)#hostname test
2 test(config)#ip domain-name “name.com”
3 test(config)#crypto key generate rsa
Here the root stands for the username in the set of username & password and
192.168.10.1 stands for the IP address of the remote router
• For the Telnet
After configuring our set of username and password, we can just connect to our remote computer
and tape the next command to reach the remote router through Telnet
1 C:\>telnet 192.168.10.1
F. DHCP
Here, ip1 refers to the start of our range and ip2 refers to the end of it
G. Static Routes
DETAILED STEPS
Step 1
Enters configuration mode.
1 R1#configure terminal
2 R1(config)#
Step 2
Configures a static route and the interface for this static route. You can optionally configure
the next-hop address.
Step 3
(Optional) Displays information about static routes.
1 R1(config)#show ip route