CCNA
CCNA
A computer network can be described as a system of interconnected devices that can communicate
using some common standards (called protocols). These devices communicate to exchange resources
(e.g. files and printers) and services.
Here is an example network consisting of two computers connected together:
In the example above, the two computers are directly connected using a cable. This small network can
be used to exchange data between just these two computers.
What if we want to expand our network? Then we can use a network device, either a switch or a hub, to
connect more than two computers together:
Now all of the devices on the network can communicate with each other.
Network Usage
Networks are used for a number of reasons, one way or another it’s usually about sharing:
Information: we use networks for applications like e-mail or to reach certain websites.
File sharing: we need a network so that users can reach a shared network drive with documents,
pictures and/or other files.
Resource sharing: we can connect a printer to the network that is used by multiple users. No need
to connect a printer directly to each computer.
Application sharing: we might have users that require access to the same application. For example,
a finance department with five users that need access to the same bookkeeping software.
What is a router?
A router is a network device that connects different computer networks by routing packets from one
network to the other. This device is usually connected to two or more different networks. When a data
packet comes to a router port, the router reads the address information in the packet to determine out
which port the packet will be sent. For example, a router provides you with the internet access by
connecting your LAN with the Internet.
A router is considered a Layer 3 device of the OSI model because its primary forwarding decision is
based on the information of the OSI Layer 3 (the destination IP address). If two hosts from different
networks want to communicate with each other, they will need a router between them. Consider the
following example:
We have a network of three computers. Note that each computer is on a different network. Host A
wants to communicate with Host B and sends a packet with Host B’s IP address (10.0.0.20) to the
default gateway (the router). The router receives the packet, compares the packet’s destination IP
address to the entries in its routing table and finds a match. It then sends the packet out the interface
associated with that network. Only Host B will receive the packet. In fact, Host C will not even be aware
that the communication took place.
Functions of a router
A router uses information contained in the internet protocol header to make various decisions; these
decisions include:
Path determination
Routing decision
Load balancing
Path determination
When a router receives an IP packet through any of its interfaces, the router examines the packet’s
destination IP address, the optimal path to reach this destination is added to the routing table. Metrics
are used to determine the optimal path to reach a destination IP address through static and dynamic
routing protocols. These metrics are standard measurements or vectors that give a quantitative value
measure for the distance to a given network.
Common metric
A common metric can either be: hop count, bandwidth, delay, current load on the path, reliability, or
the combination of two or more of these standards.
Hop count
Hop count is the number of internetworking devices, such as a router that an IP packet must pass
through to reach its destination subnet. If a routing protocol uses Hop count as its metric, then the path
with the least metric or number of routers is considered the best path. This path is then added to the
routing table if there is no other routing protocol with less administrative distance. RIP uses hop count
as its metric.
In the image above, a sub-network-A device wants to reach another in sub-network-B; using hop count
as its metric; the network will use Route 1 because it has the least Hop count value (2).
Delay
Delay refers to the time taken to send data from source to destination; this includes the time taken by a
router to process and send a datagram to the receiving interface. For protocols that use delay as their
metric, the link with low latency is considered the best path.
Bandwidth
Bandwidth is defined by this article as the number of bits that a link between two devices can send per
second.
For a protocol that uses bandwidth capacity as its metric, the protocol determines the bandwidth
capacity of all possible routes to the destination subnet, and the route with a higher bandwidth capacity
is considered the best path added to the routing table.
Because metric can depend on single or many characteristics, Enhanced Interior Gateway Routing
Protocol (EIGRP) uses a composite of bandwidth and delay to calculate its metric.
In the figure above, Router 6 will prefer to send its traffic through router 8 rather than send it through
router 7 because the route through router 8 has a higher bandwidth.
Load
Network load refers to the extent to which a network resource like a router or link between networks is
used at any given period. For protocols that use load as their metric, the path with the least load is
considered the best and added to the routing table to transmit the datagram to the destination subnet.
Routing decision
The primary function of a router is to forward a packet to its destination. The router achieves this by
encapsulating the IP packet with the appropriate data link frame type of the egress port. This
encapsulation happens after the router has determined the exit interface associated with the best path
to forward that packet.
The path can either be:
A directly connected route (the destination address in the IP header belongs to a network
connected to one of the router interfaces).
A remote network (when the destination IP address of the packet belongs to another network).
No route determined (when the destination address is not in the routing table).
Load balancing
A router can have two or more paths with equal metric and administrative distance to a destination sub-
network. When this happens, the router will forward the packet using both paths.
The method of sending data to a destination sub-network using two or more paths is called Load
balancing.
Load balancing is possible because a routing table can contain many paths associated with different exit
interfaces of a router having an equal metric or cost path.
In the figure above, the network uses RIP as its routing protocol. To send traffic to Sub-network B,
Router 6 will distribute its traffic to Route 1 and 4 because they have an equal metric. For a well-
configured network, load balancing increases the network’s effectiveness and performance for both
static and dynamic routes.
1. Wireless
It is present in the office, home or railway station, etc. It creates a wireless signal. Suppose you are in the
office, we can connect to the internet using wireless signals because your laptop is within the range. We
can provide security to routers by entering user id and password. When we try to connect to the router,
it will ask for a password and User Id. User Id and password come along with the device. Due to security,
no information about the user is harmed. When we visit public places, we can observe that a Wi-Fi
window will prop up to use the internet on our phone, and you can observe that it is secure with a
password. Wireless routers are publicly available. N number of users can connect to it.
2. Wired Router
The name itself defines its meaning. A wire is available to connect to the network. If we visit a bank or
small college, or office, we can observe that a PC or Laptop is connected to the internet using an
Ethernet cable, and that is the wired router. It has a separate Wi-Fi access point. If a user wants to
connect to the phone, then they can use VIOP (voice-over IP technology). There is an ADSL (modem)
that has two jacks to connect to ethernet and mobile phones.
3. Edge Router
It seats at the edge of the backbone of the network and can connect to the core routers. It can be wired
or wireless and will distribute internet data packets between one or more networks. But it will not
distribute internet data packets within networks.
An edge router, also called a gateway router or just "gateway" for short, is a network's outermost point
of connection with external networks, including the Internet.
Edge routers are optimized for bandwidth and designed to connect to other routers to distribute data to
end users. Edge routers don't usually offer Wi-Fi or the ability to manage local networks fully. They
typically have only Ethernet ports—an input to connect to the Internet and several outputs to connect
additional routers.
Edge router and modem are somewhat interchangeable terms, though the latter term is no longer
commonly used by manufacturers or IT professionals when referencing edge routers.
4. Core Router
It is designed to operate in the internet backbone or core. It supports multiple telecommunication
interfaces of the highest speed and usage in the core internet. It can forward IP packets at full speed on
all of them. It supports the routing protocol that is used in the core. It will distribute internet data
packets within the network. But core will not distribute internet data packets between networks.
Core routers are generally used by service providers (i.e. AT&T, Verizon, Vodafone) or cloud providers
(i.e. Google, Amazon, Microsoft). They provide maximum bandwidth to connect additional routers or
switches. Most small businesses will not need core routers. But very large enterprises that have many
employees working in various buildings or locations may use core routers as part of their network
architecture.
5. Virtual Router
It is the default for a computer sharing network. It functions as per the virtual router redundancy
protocol (VRRP); it becomes active when the main or primary router fails or becomes disabled. It takes
multiple routers in a group so that they can share a virtual IP address. It has a master for each group that
handles IP packets. If the master fails while forwarding packets, then other routers will take a position.
Benefits of Router
Due to the collision feature, network traffic can be reduced.
Due to broadcasting domains, network traffic can be reduced.
It provides a MAC address and IP address that will choose the best route across a network.
Easy to connect to the wired or wireless network.
Highly secured with a password.
No loss of information.
It can connect to different network architecture such as ethernet cable, Wi-Fi, WLAN.
The wireless router is easy to connect to the internet for a laptop or pc. No need to worry about
a bunch of wires.
Router Interface
Aux port:
This auxiliary port is used to connect a modem to the router, which can then be used to remotely
modify the configuration on the router.
Attachment Unit Interface (AUI) port:
Before the WIC became a standard for providing expansion through an add-on port, the AUI allowed
transceivers to be used, providing you with the ability to add various types of network connections, such
as fiber or copper Ethernet connections.
A transceiver is a small electronic device that converts electrical signals from the AUI specification on
one side of the transceiver to that of the connection type on the other side of the transceiver. An AUI
port is shown in the following figure.
Serial:
Connects a modem or other serial device to allow a WAN network interface to be used on the router.
Console:
Serial configuration port for command-line access to router management and configuration. Refer to
Figure 3-1 to see the console port.
Because a wide variety of WAN connectivity options are available (for example, T1, ISDN, ADSL), you can
use this port to add different interfaces to a standard router.
With the integration of services into routers, the WIC interface became too limiting. The HWIC interface
was created to support a wider variety of hardware expansion options, such as switches and service
cards. This port is backward compatible with most older WIC hardware.
Cisco Router Internal Component
ROM
ROM ( Read only memory ) stores four components POST, Bootstrap program, ROMMON mode and
Mini IOS.
POST
POST ( Power on self test ) is a low level diagnostic utility that performs various tests on hardware
components. It verifies that all necessary components are present and operational. Modular slots are
checked in this process for any hardware change like installing new interface or removing existing
interfaces.
Bootstrap
Bootstrap is the second utility in booting sequence. It controls the search and load process of IOS.
Bootstrap program is responsible for bringing up the router, finding IOS on all possible locations and
loading it in RAM.
ROMMON
ROMMON is a portable IOS program that allows us to perform various diagnostic tests. This program is
also used for password recovery procedure. It has its own mode ( Check our previous article to know
more about Cisco IOS mode) known as ROMMON mode. Boot sequence follows a conditional rule for
this mode. If bootstrap successes in finding and loading operation of IOS, then boot sequence will not
enter in this mode. Boot sequence will enter in this mode automatically, if it fails to load IOS in RAM
from all possible locations.
You can manually enter in this mode for diagnostic purpose. Run reload command from privileged mode
to reboot the router. Press + C key combination ( CTRL Key with C Key ) in first 60 seconds of boot
sequence.
Mini-IOS
Mini-IOS is a fallback utility that contains a stripped down version of IOS. This is used in critical situations
where IOS image in flash is not found. Mini-IOS contains only IP code that allows you to load IOS from
other resources such as TFTP Server. Cisco IOS mode used by this stripped down IOS utility known as
RXBOOT mode.
Flash
Flash is a nonvolatile memory. Data store in flash is not lost when you turn the router off. You could
assume flash as hard disk of router. Like data stored in hard disk remain safe, same as data stored in
flash remain safe. Router uses flash to store IOS image. During the boot process router load IOS file from
flash to ram.
NVRAM
NVRAM is another permanent memory. Data stored in NVRAM is also remain safe. Router use NVRAM
to store configuration files. NVRAM uses a battery to maintain the data during the power off stage.
RAM
RAM is a temporary memory. Information stored in RAM does not remain in power off stage. Everything
in RAM is erased, when you turn off the router. RAM is the fastest memory among these memories. In a
powered on router, RAM contains all the information required to function the device.
During the boot process IOS is copied and decompressed in RAM from Flash.
Same as ISO, running configuration is also copied in RAM from NVRAM.
RAM stores ARP, CDP neighbor, routing and other tables.
Interface input and output buffers are also stored in RAM.
It is a four characters hexadecimal value, that can be changed from privileged mode.
Default value is 0x2102.
"0x" indicates that the characters that follow are in hexadecimal.
The third character in the configuration register can modify how the router loads the configuration file.
The fourth character in the configuration register is known as the boot field. Changing this value, will
change booting process.
Setting of 0x2100 will always boot router in ROMMON mode.
Setting of 0x2101 will always boot router in RXBOOT mode.
Setting of 0x2102 to 0x210F will always load first valid IOS from flash.
values of 2 through F for the fourth character specify other IOS image files in flash.
Router keeps password in startup-config file that is stored in NVRAM.
The setting of 0x2142 causes the router to ignore the startup-config file in NVRAM and proceed without
a configuration. Thus the setting of 0x2142 is used for password recovery process of router.
Booting Process
Router is powered on.
Power on self test (POST) is performed to check hardware components including memory and
interfaces.
Bootstrap program is loaded and executed.
Bootstrap reads configuration register value to determine how the router will boot up.
Depending on the value of configuration register, bootstrap program finds and loads the IOS image.
If bootstrap fails to load IOS from all possible locations it will drop boot sequence in ROMMON mode for
troubleshooting.
If IOS is loaded, the IOS will try to find and load the configuration.
If configuration is not presented, system configuration dialog would be launched.
If configuration is loaded, you would be presented in CLI interface .
Router Startup
As shown in the above figure, Norman laptop is connected with Norman router through a console cable.
You need to connect to the console port of the router to the COM port in the PC/Laptop.
As shown in the above figure, Norman laptop is connected with Norman router through a console cable.
You need to connect to the console port of the router to the COM port in the PC/Laptop.
The router console port is shown below:
The console port is marked with circle. You can find the console port on a Cisco router easily, as all port
names are mentioned in the router. You can connect to the console port of router and the COM port of
Laptop/PC. Run the PUTTY Program in your Desktop/PC/Laptop (you can download it for free
from www.putty.org).
After opening the port, the router image will load as shown below
The router is decompressing the image. After it is finished, the router prompt will be displayed as shown
below.
The above image shows the “System Configuration Dialog. The router will work as a wizard – which
which means that if you enter “yes”, the router will take you through a time consuming process step by
step. If you enter “No”, you have to configure it manually. I recommend that students enter “No” and
configure it manually, because manual configuration is the best practice for passing the CCNA Exam,
because they emphasize Command Line rather than this automatic configuration.
As you can see in the above image, we have entered the router Prompt (i.e., router>).
Router IOS
Router IOS (Internetwork operating System) is the operating system by which the router can be
accessed and configured. But this operating system is different from operating system that we have in
our desktop. IOS is a command line operating system to configure routers. Router IOS is designed,
coded, and binds to work with the routing protocols, so we can use IOS to configure the routing
protocols. Router IOS stores as.bin file in the flash memory of the router. We have to remember the
commands to configure the router for specific actions.
Router Modes
User Mode is the first mode a user has access to after logging into the router. The user mode can be
identified by the > prompt following the router name. This mode allows the user to execute only the
basic commands, such as those that show the system's status. The router cannot be configured or
restarted from this mode.
Router>?
Exec commands:
<1-99> Session number to resume
connect Open a terminal connection
disable Turn off privileged commands
disconnect Disconnect an existing network connection
enable Turn on privileged commands
exit Exit from the EXEC
logout Exit from the EXEC
ping Send echo messages
resume Resume an active network connection
show Show running system information
ssh Open a secure shell client connection
telnet Open a telnet connection
terminal Set terminal line parameters
traceroute Trace route to destination
Router>
Router#
Router#?
Exec commands:
<1-99> Session number to resume
auto Exec level Automation
clear Reset functions
clock Manage the system clock
configure Enter configuration mode
connect Open a terminal connection
copy Copy from one file to another
debug Debugging functions (see also 'undebug')
delete Delete a file
dir List files on a filesystem
disable Turn off privileged commands
disconnect Disconnect an existing network connection
enable Turn on privileged commands
erase Erase a filesystem
exit Exit from the EXEC
logout Exit from the EXEC
mkdir Create new directory
more Display the contents of a file
no Disable debugging informations
ping Send echo messages
reload Halt and perform a cold restart
resume Resume an active network connection
rmdir Remove existing directory
send Send a message to other tty lines
setup Run the SETUP command facility
show Show running system information
ssh Open a secure shell client connection
telnet Open a telnet connection
terminal Set terminal line parameters
traceroute Trace route to destination
undebug Disable debugging functions (see also 'debug')
vlan Configure VLAN parameters
write Write running configuration to memory, network, or terminal
Router#
Router(config)#
Global Configuration mode has various submodes, starting with global configuration mode, which can be
identified by the (config)# prompt following the router name. Following are the important Global
Configuration submodes.
Router(config-subif)#
Router(config-line)#
Router(config-router)#
User EXEC Router > Default mode after booting. Login Use the exit command
with the password, if configured.
Privileged Router # Use the enable command from Use the exit or end command
EXEC the user exec mode
Interface Router(config-if)# Use the 'interface type Use the exit command to return
Configuratio number' command from the global in global configuration mode
n configuration mode
Sub-Interface Router(config-subif) Use the 'interface type sub Use the exit command to return
Configuratio interface number' command from in the previous mode. Use
n the global configuration mode or the end command to return in
the interface configure mode. the privileged exec mode.
Router# clock set 13:30:00 15 Apr 2014 (now the clock time and date is set according to
UTC.)
For verifying
As we have seen in the above time display, it displays the UTC time, which means we have to set the
time zone for every country.
Router# configure terminal
Verifying Again:
Router(Config)# exit
Router# show clock
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
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
router(config)#line VTY 0 4
router(config-line)#password GeeksforGeeks
router(config-line)#exit
5. auxiliary password
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).
It provides a short message to the user who wants to access the switch.
GfgSwitch(config)#banner motd &
Enter Text message. End with character '&'
$ This is GeeksforGeeks floor Switch &
Enable password :
The enable password is used for securing privilege mode.
GfgSwitch(config)#enable password GFGGFG
Enable secret password :
This is also used for securing privilege mode but the difference is that it will be displayed as
ciphertext(***) on the configuration file.
GfgSwitch(config)#enable secret GFGGFG
Line console password :
When a person will take access through console port then this password will be asked.
GfgSwitch(config)#line console 0
GfgSwitch(config-line)#password GFG
GfgSwitch(config-line)#login
Line VTY password :
When a person want to access a router through VTY lines (telnet or ssh) then this password will be
asked.
GfgSwitch(config)#line VTY 0 2
GfgSwitch(config-line)#password GFGGFG
GfgSwitch(config-line)#exit
6. Copy to startup-configuration file from running-configuration file :
GfgSwitch#show startup-config
GfgSwitch#show running-config
8. Clear mac address table :
The following procedure is applicable for virtually any Cisco router, such as 800, 2600, 3600,
1800,2800,3800 etc.
Step1:
Connect to the router with a serial console cable and open your terminal emulation software (I
personally use secureCRT). Use the normal terminal settings (9600 baud, no parity, 8 data bits, 1 stop
bit, no flow control). After that, you should get the command prompt.
Step2:
Now you have to power OFF the router from the power switch. Get ready on your keyboard and turn
the power switch to ON. Immediately press the CTRL+BREAK keys on your keyboard several times until
the router goes into ROMMON mode. You will see the rommon 1> prompt on your terminal window.
Step3:
Now you need to change the configuration register of your router. This register is responsible to control
several boot-up and hardware parameters on the device. The normal value of this register is 0x2102. We
will need to change it to 0x2142. This new value tells the router to bypass the startup-configuration
(where the password is stored) and boot with the factory default configuration (i.e no password
request).
At the rommon prompt type the following:
Step4:
After the router reboots, it will ignore the startup configuration and will behave like the very first time
that you switched on the device. It will therefore run the initial setup script. Type “no” at the setup
request or press “Ctrl-C” to terminate the initial setup procedure.
Step5:
Now you will get the Router> prompt. Type “enable” to get into privilege mode.
Router> enable
Router#
Step6:
Now we need to load the “Startup-Config” into the “Running-Config”.
IMPORTANT: DO NOT copy the running config into the startup config because now the running config is
basically empty (factory default) so it will erase all of your startup config.
Step7:
Now we are ready to change our passwords. Change the enable password as below.
Router#config t
Router(config)# enable secret newpassword
Step8:
Another important step now is to change the configuration register back to its normal value which is
0x2102
Router(config)#config-register 0x2102
Step9:
Now save the configuration and reboot.
Router(config)#exit
Router# write
Router# reload
Step10:
After the router boots up, log on with your new password and enable all interfaces (using “no
shutdown”) because during the recovery procedure the interfaces get shut down.
What we have done in the above 10 steps is that we bypassed the original configuration that has the
forgotten password, and then we got to the privileged mode without the need to know the password.
Then we loaded the original configuration into RAM (so we don’t loose it) and imposed a new password
and saved things back to the NVRAM. And then we got back to the original boot sequence.
We will be backing up the IOS to a TFTP server and use the same backup image to restore the
configurations on the router. Thus connectivity between the router and TFTP server is important.
The IOS is the core of the router functionality. There are different types of memory on the Cisco device
and the flash memory stores the Cisco IOS.
The Flash where IOS is stored is non-volatile thus the data is safe even in an event like power off. As the
IOS is important software, having a backup of it is pretty much a requirement in today’s organizations.
In this tutorial we will be storing the backup on TFTP server. Below are some important points related to
TFTP.
Now, let’s demonstrate the entire process of backup and restore of Cisco IOS. We will use the Cisco
Packet Tracer application for this demonstration.
You can also use an actual TFTP server from SolarWinds or Cisco or Whats Up Gold or any TFTP server
available in the market along with your actual Cisco Router. The actual software needs to be installed on
a PC, which is connected to the router via console.
In our demonstration as we are using Packet Tracer, we already have an inbuilt TFTP server running.
Once you open Packet tracer, at the Left side bottom you see some devices represented with relevant
icons.
Choose End Devices and choose a Generic Server and Desktop. Drag and drop these to the work space.
Similarly, Choose a Router and a Switch and place it as shows in the above topology.
Now we need to have the cabling done. Click on Connections on Left bottom and you will see different
types of cables. Connect the router using a console cable
Connect the devices, Router fa0/1 to switch fa0/1 using Straight-Through Cable and the Switch fa0/2 to
fast Ethernet of the Server.
Connect the Router’s Console with the PCs RS232 using a console cable, which is represented by the
Blue color.
Now Lets’ have the connectivity working, and thus need IP addressing.
1. Assign the Router’s fa0/1 an IP address of 192.168.1.100 with mask of 255.255.255.0. Save the
configuration using the command “wr”.
2. Now configure the Server with a Static IP address of 192.168.1.1 with subnet mask 255.255.255.0
and gateway IP address as 192.168.1.100 (Router’s IP address).
Click on the Server “Server0” and then under the Desktop Menu select “IP Configuration”
3. In the IP configuration window, assign the IP address as mentioned above
Click on Server and under the Desktop Tab, Select Command Prompt.
Also test the connectivity from the router to the TFTP Server (Server0)
5. Now check if the TFTP Server is running on the Server0. Click on the Server and under Config Menu;
click TFTP on the left buttons. We see that TFTP is marked as “On” and we also see a list of IOS images in
the list. These are provided by default for test purpose and learning.
6. Now click the PC0, which is connected to the Router using console. Under Desktop Menu, click
Terminal.
7. We see the Terminal configuration settings, no need to change them. Keep them as it is and Click on
OK. You will get the console access to the router.
8. Go to enable mode and run the command “show flash”. Do note the name of the IOS image. In our
case the image file is: c1841-advipservicesk9-mz.124-15.T1.bin
9. Now we will take a backup of this flash to the TFTP Server. In enable mode, run the command:
“copy flash tftp”, which means to copy the flash to tftp server. You will be prompted for the source
and destination file name and the address of the remote host, i.e. the TFTP server where the flash needs
to be saved.
In the above screenshot we see:
Source filename:
Destination filename: The name in the [] square bracket is the default, thus we left it as it is.
10. One the flash is copied to TFTP server, we can go and verify the same on the TFTP Server.
11. Now we will delete the flash from the Router and then check to see if any available flash in the
router. We see the flash is deleted and no .bin files seen when checked with “show flash”.
12. After deleting the Flash, the router can function till a reload is done. Once the reload is performed,
and when the router boots up it cannot find any information in flash and thus will take you to ROMMON
Mode.
1. If you use the question mark (?), you will know the command that can be run in the
ROMMON MODE. We need to use the “tftpdnld” (TFTP Download) command.
2. On the ROMMON mode prompt, type “tftpdnld”. You see a set of information that needs to be set
now to assign an IP address, Gateway, TFTP file name, TFTP Server name etc.
i.e. IP_ADDRESS is a new IP address for the Router, IP_SUBNET_MASK is the subnet mask
4. Finally after assigning the required details run the command “tftpdnld” again and then when
prompted for continuing, type “y”. You will see the message “program flash location <hexcode>”
5. Then run the command “reset” and you will see the flash image getting decompressed.
6. Once the image is decompressed, you get the prompt to configure the Router again using
wizard. You can choose NO and then configure the router using CLI commands.
7. So, with the above steps, we restore the Flash from ROMMON Mode.
BACKUP and RESTORE CONFIGURATION FILES
1. In this section, we will take a backup of the configuration of the Router and then restore the
configuration. For demonstration we will continue to use Packet tracer.
2. Imagine someone changed the configuration of your existing ( running configuration) or the router
rebooted and the running configuration was not copied to startup-config.
3. In such a situation if you have already taken a backup of the running or startup configuration, you
can restore the configuration within few minutes.
4. Consider our configurations in place and we want to take a backup of it. In this demo we will just
change router name and test.
5. We are doing the configuration and as per our requirement we changed the router name to
“Router_AAA”
6. Now we want to backup the current running configuration to TFTP. Run the command :
Give the TFTP server IP when prompted for Remote Host and for destination name, give the name with
which you want to store the running config.
7. Similarly you can also backup the startup-configuration.
8. Go and check the TFTP Server, you should be able to see the files.
9. Now we will change the hostname and then restore the config again to have the old hostname. (This
is just for test; similarly you can get back the entire configuration that was backed up).
10. Now that we see the router name is changed (some configurations changed, we lost old
configuration). Let us restore the old configuration.
11. On the CLI, run the command “copy tftp running-config” and then choose the file you want to use
to restore the configuration. As we stored our running config in “Router_AAA-confg”, we use that file
and restore the old configuration.
12. You see in the above screenshot that after restoring the configuration, the hostname is again
changed to Router_AAA. Thus we restored the configuration.
Routing Protocols
Routing Protocols are the set of defined rules used by the routers to communicate between source &
destination. They do not move the information to the source to a destination, but only update the
routing table that contains the information.
Network Router protocols helps you to specify way routers communicate with each other. It allows the
network to select routes between any two nodes on a computer network.
Types of Routing Protocols
Static
Dynamic
Static routing
Static routing is a routing type in which a network administrator configures the routes into the routing
table to be used by the router to send packets to a destination network.
Static Routing is the process in which static routes are manually added to the routing table through the
direct configuration.
This route includes a destination host address, its corresponding network mask, and the IP address of
the next-hop address.
A default static route is used to send packets when an explicit route is not present in the routing table.
This route is configured with 0.0.0.0/0 as its destination IPV4 address.
By configuring a default static route, a router can match all packets to use this route.
Summary route
This route reduces the number of routing table entries required for many static routes. A summary
route can only be implemented on contiguous routes that use the same exit interface or next-hop
address.
Route summarization
A summary route can be calculated for contiguous addresses; this calculation can be done using either
the binary or decimal (fastest) method.
The two of which we will gander at in the section below. Assuming an administrator has the following
static routes:
To obtain the summary address’s prefix length, add all the bits that formed a match: the 8 bits
from the first octet and the 6 bit from the second octet (8+6 = 14).
This value indicates that the summary-address will have a /14 prefix, a subnet address of
255.252.0.0.
For the summary-address with this subnet mask, use the least network address (172.16.0.0)
from those contiguous addresses together with the calculated prefix (/14 or 255.252.0.0).
With this, the summarized address is 172.16.0.0 /14 or 172.16.0.0 with a subnet mask of
255.252.0.0. The binary method of route summarization gives us a detailed explanation of how
summary routes are created, but it is time-consuming.
The decimal method is the fastest, and this method uses the formula: 256-number of subnet =
subnet mask for the summary address.
In this case, we have four networks which are: 172.16.0.0, 172.17.0.0, 172.18.0.0 and
172.19.0.0.
Thus, the subnet of our summary address will be 256 – 4 = 252. With this, the summarized route
is given as 172.16.0.0 with a subnet mask of 255.252.0.0.
A floating static route is a backup route to any static route or a dynamically learned route. This route is
used only when the primary route fails or is unavailable.
Configure Static Routing in the topology:
Serial interface (s0/0/0) with an IP address 192.168.10.1, and fast Ethernet interface (f0/0) with an IP
address 10.0.0.1.
Configure the IP addresses to the Router1’s interfaces:
Serial interface (s0/0/0)with an IP address 192.168.10.2, and fast Ethernet interface(f0/0) with an IP
address 20.0.0.1.
PC0
PC1
PC2
PC3
Check both Router’s Routing table using the “show ip route” command:
Router0
Router0’s routing table shows the networks that are directly connected to the Router0.
Router1
Router1’s routing table shows the networks that are directly connected to the Router1.
Now, when we ping from PC0 to PC1, we get ping replies in the format, “ip address: bytes time,
and TTL”, because both the PCs (PC0 & PC1) are in the same network.
When we ping from PC0 to PC2, we get ping replies with a failure message “Destination host
unreachable” because both (PC0 & PC2) are in the different network.
To verify again with the second network address, check ping from PC2 to PC3 and we see the below
screenshot ping replies with ip address, bytes, time, and TTL.”
But, when we ping PC2 from PC0 & PC1, we get ping replies a failure message “Destination host
unreachable” because PCs are on a different network.
To provide communication between different networks, we need to configure the static routing using
the following syntax:
ip route [destination_network]
[subnet_mask]
[next-hop_address or exitinterface].
Now check Router0’s routing table, we can see some static router entry in the table. To check routing
table use “show ip route”command.
Now to verify static routing ping from PC0 to PC2, ping replies successfully because the routing
table has a static entry of the network 20.0.0.0.
Similarly, check Router1’s routing table, we see some static route entry in the routing table.
To verify static routing, ping from PC2 to PC1, ping replies because now the Router1’s routing table
has a static entry of the network 10.0.0.0.
Configuration
Here, provided the route for 192.168.10.0 network where 192.168.10.0 is its network I’d and
172.16.10.2 and 172.16.10.6 are the next-hop address.
Now, configuring for R2:
In large networks, configuring and adding a static route to the routing table is very difficult.
Configuring static routes requires background knowledge of the network topology by the
network administrator.
Static route is error-prone.
Default Routing
This is the method where the router is configured to send all packets towards a single router (next hop).
It doesn’t matter to which network the packet belongs, it is forwarded out to the router which is
configured for default routing. It is generally used with stub routers. A stub router is a router that has
only one route to reach all other networks.
The default route is a route that a router uses to forward an incoming packet when no other route is
available for that packet in the routing table. Routers use the routing table to make the forwarding
decision. A routing table entry consists of two pieces: the remote network and the local interface that is
connected to that network.
When a packet arrives on an interface of a router, the router reads the destination network address of
the incoming packet and finds that network address in the routing table. If the routing table contains an
entry for the destination network, the router forwards the incoming packet from the interface that is
written next to the destination network in the entry.
If the routing table does not contain an entry for the destination address, the router drops the incoming
packet. This is the point where the concept of default route fits. A default route gives a route to a router
to forward all incoming packets whose destination network addresses are not available in the routing
table.
A default route contains all zero in the IP address. There are two versions of IP protocol, IPv4 and IPv6.
In both versions, the address of the default route is the following.
All zero (0.0.0.0) in network portion and subnet mask represent all networks and all hosts in the
specified network, respectively.
To configure an IPv4 default route, use the following syntax from the global configuration mode.
To configure an IPv6 default route, use the following syntax from the global configuration mode.
If you use the IP address of the next-hop, the router will forward packets to the remote interface of the
other router (next-hop) that is directly connected to the local router and has configured with the IP
address that you assign in the default route.
If you use the exit-interface, the router forwards packets from the local interface that you configure in
the default route.
You should configure the exit-interface instead of the next-hop IP address. The benefit of the exit-
interface configuration over the next-hop IP address configuration is that the exit-interface
configuration does not depend upon the IP address stability of the next-hop.
The following command configures an IPv4 default route that forwards all packets from the serial 0/0/0
interface.
The following command configures an IPv4 default route that forwards all packets to the next-hop
192.168.1.1.
The following command configures an IPv6 default route that forwards all packets from the serial 1/1/1
interface.
The following command configures an IPv6 default route that forwards all packets to the next-hop
2001:DB8:1:F::1.
To view the default route configuration, use the "show ip route" command from the privileged-
exec mode.
Router#show ip route
You can also use the "show running-config" command to view the command that was used to
configure the default route.
Router#show running-config
Configuration
Using the same topology which we have used for the static routing before.
In this topology, R1 and R2 are stub routers so we can configure default routing for both these routers.
Dynamic routing
Dynamic routing is a technique in which a router learns about routing information without an
administrator’s help and adds the best route to its routing table. A router running a dynamic routing
protocol adds the best route to its routing table and can also determine another path if the primary
route goes down.
Unlike static routing, the route needs to be reconfigured by the administrator in the event of any
change. Different types of dynamic routing protocol are used today; however, in this article, we will take
a gander at Routing Information Protocol (RIP), Open Shortest Path First (OSPF), and Enhanced Interior
Gateway Routing Protocol (EIGRP).
Dynamic routes are routes learned via routing protocols. Routing protocols are configured on routers
with the purpose of exchanging routing information. There are many benefits of using routing protocols
in your network, such as:
unlike static routing, you don’t need to manually configure every route on each router in the network.
You just need to configure the networks to be advertised on a router directly connected to them.
if a link fails and the network topology changes, routers can advertise that some routes have failed and
pick a new route to that network.
Cisco has created its own routing protocol – EIGRP. EIGRP is considered to be an advanced distance
vector protocol, although some materials erroneously state that EIGRP is a hybrid routing protocol, a
combination of distance vector and link state.
All of the routing protocols mentioned above are interior routing protocols (IGP), which means that they
are used to exchange routing information within one autonomous system. BGP (Border Gateway
Protocol) is an example of an exterior routing protocol (EGP) which is used to exchange routing
information between autonomous systems on the Internet.
Distance vector protocols
As the name implies, distance vector routing protocols use distance to determine the best path to a
remote network. The distance is something like the number of hops (routers) to the destination
network.
Distance vector protocols usually send the complete routing table to each neighbor (a neighbor is
directly connected router that runs the same routing protocol). They employ some version of Bellman-
Ford algorithm to calculate the best routes. Compared with link state routing protocols, distance vector
protocols are easier to configure and require little management, but are susceptible to routing loops and
converge slower than the link state routing protocols. Distance vector protocols also use more
bandwidth because they send complete routing table, while the link state procotols send specific
updates only when topology changes occur.
Each router running a link state routing protocol creates three different tables:
neighbor table – the table of neighboring routers running the same link state routing protocol.
topology table – the table that stores the topology of the entire network.
routing table – the table that stores the best routes.
Shortest Path First algorithm is used to calculate the best route. OSPF and IS-IS are examples of link state
routing protocols.
Difference between distance vector and link state routing
protocols
The following table summarizes the differences:
The following table lists the differences between the three most popular interior routing protocols:
(RIPv2)
Dynamic routing protocols can be categorized into two groups: Interior gateway protocols (IGP) and
Exterior Gateway Routing Protocols (EGP).
Interior routing protocols are designed for use within a single autonomous system, while exterior
routing protocols are designed for use between different Autonomous Systems (AS). Any network under
the administrative control of a single organization is known as Autonomous System
(AS).
Routing protocols that by design work best within an autonomous system are known as IGP and
protocols that are designed to exchange routing information between Autonomous Systems (AS) are
known as EGP.
Routing information protocol is an IGP that bases its internal logic on distance-vector; this vector
describes the information a router knows about a route.
This information includes; the destination subnet, the distance metric, and the vector (which is the link
and the next-hop router). Routing information protocol is not in use today because it does not scale well
for large network implementation.
Open Shortest Path First (OSPF)
Open Shortest Path First (OSPF) is a protocol that creates a complete view of the network by gathering
information from all the other routers. Protocols that make such a comprehensive view of a network are
referred to as link-state protocols.
These protocols do not use periodic updates to send new routing updates to their neighbors; instead,
they advertised every detail about the internetwork to all other routers such that all routers in this
internetwork have the same information.
As a link-state protocol, OSPF builds its routes using a mathematical algorithm known as the Dijkstra
Shortest Path First (SPF) algorithm. This algorithm analyses the link-state database and then builds the
local routes with the router’s information to add to the routing table; these pieces of information are a
network address and its subnet mask, an outgoing interface a next-hop router IP address.
Like all other routing protocols, OSPF uses routing protocol information to help build its data structures,
which are then processed using a routing algorithm.
Data structures
Routing protocol messages
Algorithm
Data Structures
A router configured to run OSPF as a routing protocol creates and maintains the following three table:
Adjacency database: This database create a table known as the neighbor’s table; this table list all
neighbor routers that a router has established a bidirectional connection, and it is unique to all
routers.
Link-state database (Topology table): One purpose of forming an OSPF adjacency is to allow two
neighbors to exchange their database. This table stores information about all other routers in
that network, and it is identical for all routers within an area with identical LSDB.
Forwarding database: This database creates the routing table that contains all known networks
connected to the router or learned from adjacent routers.
Routing protocols messages
All layer three devices running OSPF uses five packet types to convey their routing information.
According to CISCO, these packet types are: Hello Packet, Database Description packet, Link-state
request packet, Link-state update packet, and Link-state acknowledgment packet.
Algorithm
OSPF uses the Dijkstra Algorithm to create its topology table. This algorithm makes a Shortest Path First
(SPF) tree by placing every router at the base of this tree and computing the shortest path to every
router, and this path is then added to the routing table; hence, the name Open Shortest
Path.
OSPF is a link-state routing protocol, and unlike distance vector routing protocols, link-state protocols
consume routers resources, and the CPU takes time to run an SPF algorithm; as such, it has slow
convergence.
Single-area OSPF
Multi-Area OSPF
Single-area OSPF
In a single area OSPF, all the router’s interfaces are put in the same area, usually called Area 0
(backbone). The problem with single-area OSPF is that more extensive networks suffer because a larger
topology database requires more memory and is time-consuming.
Multi-area OSPF
Multi-area OSPF is used to create fewer routing table entries. These entries summarize the network
addresses and also minimizes processing and memory requirements.
In a multi-area OSPF, all areas are connected to area 0, and routers that interconnect two or more areas
are referred to as Area Border Routers (ABRs).
The advancement of businesses and technical factors pushed the world toward the second generation
of better routing protocols. Today EIGRP and OSPF are the two primary routing protocols in use in
modern enterprise networks.
Due to the less robust hop-count of metric that RIP uses, it has fallen away as a serious competitor as
most cooperate networks uses either EIGRP or OSPF as their routing protocol.
EIGRP incorporates features of both link-state and distance vector routing protocols. Along these lines,
EIGRP doesn’t fit into Distance vector protocol or Link-state protocol.
It bases its vital principle on the distance vector; as such, it is considered as an advanced distance-vector
routing protocol.
EIRGP features
Diffusing Update Algorithm: EIGRP uses a diffusing update algorithm (DUAL) as its computational
engine.
Establishing neighbor adjacencies: Like other routing protocols, EIGRP establishes a relationship
with other connected EIGRP connected routers to track its neighbors’ status.
Reliable Transport Protocol: EIRGP uses the Reliable Transport Protocol (RTP) to provide reliable
delivery of EIGRP packets.
Equal and Unequal Cost Load balancing: EIGRP is the only protocol that supports unequal load
balancing. This capability allows the administrator to better distribute traffic flow in the
networks, thereby reducing delays.
It is straightforward to configure.
It adapts to network topology changes.
It is suitable in a network where many routers are used.
Configuring dynamic routing does not require detailed knowledge of the network.
Disadvantages of Dynamic Routing
Dynamic routing consumes many network resources when compared to static routing.
This is because dynamic routing broadcast network information, which amounts to a huge
security risk as an attacker can learn about the whole network, especially during recon attacks.
It can be complex to install.
To summarize:
Administrative distance
An organization can configure its router(s) with many dynamic routing protocols and a static route.
However, this is not common but required in some situations.
For example, two companies, A and B, can connect their networks for data transmission. If company A
uses Open Shortest First (OSPF), while company B uses the Enhanced Interior Gateway Routing Protocol
(EIGRP), one company must configure OSPF and EIGRP.
This router then takes the route learned from OSPF and advertises it to EIGRP and vice versa; this
process is called route redistribution; under such a situation, a routing table can contain more than one
route source a destination network.
In this situation, metric values cannot be used to decide which path to forward traffic because each
routing protocol calculates its metric using different information.
To resolve these issues, the Cisco Internetworking Operating System uses a concept known
as administrative distance to choose which routing protocol’s learned route is to
be added to the routing table.
The administrative distance a number that represents the dependability of an entire routing protocol on
a router. The lower the value of this number, the better the routing protocol.
For example, RIP has an administrative distance of 120, while OSPF default to 110, for a router that
learned a path to the same subnet using both RIP and OSPF, OSPF will be the trusted route source and it
routing information is added to the routing table to reach the destination subnetwork.
The table below shows some route type and their administrative distance.
static route 1
EIGRP (Summary Discard Route) 5
BGP(external) 20
OSPF 110
IGRP 100
IS-IS 115
RIP 120
EIGRP (external) 170
Unbelievable 255
Because a connected route has an administrative distance of 0, it takes precedence over any other route
source if any other protocol learned the path to a subnet.