Cisco Router basic commands
A router is a layer 3 device used to forward packets from one network to another. It forwards the packet through one of its ports on the basis of destination IP address and the entry in the routing table. By using a routing table, it finds an optimized path between the source and destination network.
Here, we will talk about Cisco router’s basic commands like assigning an IP address to an interface, bringing up an interface, applying to enable and secret passwords.
Giving hostname to the router –
It is used to set a name to a device stating an identity to a device. This is important as these hostnames are used in WAN for authentication purposes.
We can set the hostname as:
router(config)#hostname GeeksforGeeksrouter GeeksforGeeksrouter(config)#
Applying banners – These are specifically used to give a small security notice to the user who wants to access the router. We can customize it According to our needs as like asking for credentials needed for the login.
Types of banners are:
1. banner motd –
GeeksforGeeksrouter(config)#banner motd # Enter Text message. End with character '#' $ No unauthorized access allowed. Enter your credentials!! #
Here motd means a message of the day and # means delimiter i.e message should end with the symbol provided. This message will be shown while entering into the router’s user execution mode
2. Exec banner – It will be displayed on the screen when the user will log in through the VTY lines.
3. Login banner – This banner will be displayed after the banner motd but before the login.
These banners are used to make login interactive.
Setting password –
There are five passwords used to secure a Cisco device:
1. enable password – The enable password is used for securing privilege mode. This password will be shown in clear text by the command “show running-configuration”. These are replaced by secret passwords nowadays.
router(config)#enable password GeeksforGeeks
2. Enable secret password – This is also used for securing privilege mode but the d the difference is that it will be displayed as a cipher in “show running-configuration”. This password will override the enable password if both passwords are set.
router(config)#enable secret GeeksforGeeks
3. line console password – When a user will take access through the console port then this password will be asked.
router(config)#line console 0 router(config-line)#password GeeksforGeeks router(config-line)#login
4. line VTY password – When a user wants to access a router through VTY lines (telnet or ssh) then this password will be asked.
The following configuration is shown for the telnet password.
router(config)#line VTY 0 4 router(config-line)#password GeeksforGeeks router(config-line)#exit
5. auxiliary password – This password will secure the aux port.
router(config)#line aux 0 router(config-line)#password GeeksforGeeks router(config-line)#login
Assigning IP address to a router’s interface –
As we know the router is a layer 3 device therefore every port of a router should have an IP address to work. By default, a router’s port has no IP address and its line protocol is also down.
router(config)#interface fa0/0 router(config-if)#ip address 192.168.1.1 255.255.255.0 router(config-if)#no shut
Here first we have to specify the router’s interface on which we want to give an IP address. Then we will enter interface mode where we will give an IP address as shown followed by its subnet mask (255.255.255.0). Then, we have made the router port administratively up by no shut command.
Copying and erasing configuration –
We can manually copy the running configuration (configuration in RAM) to startup configuration (configuration in NVRAM). Therefore, when the next time router will boot up, it will load the configuration that we have copied (as by default the configuration of NVRAM is loaded).
router#copy running-config startup-config
To erase the configuration of NVRAM, use the command