0% found this document useful (0 votes)
7 views

Lab 05 (In English)

The document outlines Lab Work No. 05 for a Computer Networks course, focusing on static and dynamic routing configurations using Cisco routers and the Packet Tracer simulator. It details the objectives of the lab, basic commands for router configuration, and step-by-step instructions for setting up interconnections between networks, including IP configuration, static routing, and dynamic routing using the RIP protocol. The lab emphasizes testing connectivity between different local area networks (LANs) and configuring routing tables to facilitate communication.

Uploaded by

Amel Bt
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Lab 05 (In English)

The document outlines Lab Work No. 05 for a Computer Networks course, focusing on static and dynamic routing configurations using Cisco routers and the Packet Tracer simulator. It details the objectives of the lab, basic commands for router configuration, and step-by-step instructions for setting up interconnections between networks, including IP configuration, static routing, and dynamic routing using the RIP protocol. The lab emphasizes testing connectivity between different local area networks (LANs) and configuring routing tables to facilitate communication.

Uploaded by

Amel Bt
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Module : Computer Networks 2nd year Computer Science Abdelhafid Boussouf University Center, Mila Year : 2024/2025

Lab Work No. 05


"Static and Dynamic Routing"

1.Aim
The three main objectives of this lab are:
 Configuration of interconnection between different networks using routers (IP addressing,
subnetting, gateways, etc.).
 Configuration of static routing.
 Configuration of dynamic routing using the RIP protocol.
All tasks are performed using the Packet Tracer simulator.
2. Basic Commands to Configure a Cisco Switch/Router
The following table lists the main commands necessary for configuring the interconnection of networks:
Command Purpose
enable Enters privileged executive mode.
configure terminal Enters global configuration mode, which lets you
start making changes to the router's configuration.
exit Exits configuration mode for the Fast Ethernet
interface and returns to global configuration mode.
interface type number Enters the configuration mode for a Fast Ethernet
Example: interface on the router.
Router(config)# Interface FastEthernet 0/0
ip address ip-address mask Sets the IP address and subnet mask for the specified
Example: Fast Ethernet interface.
Router(config-if)# ip address 192.168.12.2
255.255.255.0
no shutdown Enables the Ethernet interface, changing its state
from administratively down to administratively up.
copy running-config startup-config Copies the current live configuration into the startup
configuration file, so that your changes are saved
and persist after a reboot.
show ip interface brief Displays the usability status of interfaces configured
for various IP addresses.
ip route prefix mask { ip-address | interface- Specifies the static route for the IP packets.
type interface-number [ ip-address ]}
Example:
Router(config)# ip route 192.168.1.0 255.255.0.0
10.10.10.2
show ip route Displays the current state of the routing table.
no ip route prefix mask ip-address Removes a static route from the router's routing
Example : table.
Router(config)# no ip route 192.168.2.0
255.255.255.0 10.0.0.2
router rip Enters router configuration mode, and enables RIP
on the router.
network ip-address Specifies a list of networks on which RIP is to be
Example: applied, using the address of the network of each
Router(config-router)# network 192.168.1.1 directly connected network.

1/8
Module : Computer Networks 2nd year Computer Science Abdelhafid Boussouf University Center, Mila Year : 2024/2025

3. Network Interconnection
Consider configuring the network shown in the figure:

This network consists of two local networks: LAN1 with IP 172.16.0.0 and LAN2 with IP 192.168.1.0.
Both networks are connected via a router. LAN1 is connected through the FastEthernet 0/0 interface
(denoted as Fa 0/0) and LAN2 through the FastEthernet 0/1 interface (denoted as Fa 0/1).

3.1. IP Configuration of Network Interfaces


Every network card (for PCs and routers) must have an IP address. The router interface gets an IP address
from the LAN it connects to and acts as its gateway.
Remember that the gateway address is the address of the interface through which the network is connected to
other networks — in other words, it is the interface through which a packet will exit to reach an external
network. We start by configuring the local networks (the PCs), and then the routers.

3.1.1. Configuring PC Interfaces


 On each PC, go to "Desktop" > "IP Configuration"
 Example for PC0 on 172.16.0.0/16:

The gateway for this network is the Fa 0/0 interface of the router, with the address 172.16.0.254
Do the same for the other PCs in this network.

2/8
Module : Computer Networks 2nd year Computer Science Abdelhafid Boussouf University Center, Mila Year : 2024/2025

 For a PC in the 192.168.1.0/24 network, do the following:

The gateway for this network is the Fa 0/1 interface of the router, with the address 192.168.1.254
Do the same for the other PCs in this network.

3.1.2. Configuring Router Interfaces


The router must be configured so that it knows it is connected to the "171.16.0.0" network via its
FastEthernet 0/0 interface, and to the "192.168.1.0" network via its FastEthernet 0/1 interface. Click on the
router and select the CLI tab, which stands for "Command-Line Interface." The prompt "Router>" will
appear, allowing you to use command lines to configure each of the router's interfaces. To configure the
Fa 0/0 interface, proceed as follows:

Router> enable
Router# configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#interface fastEthernet 0/0
Router(config-if)#ip address 172.16.0.254 255.255.0.0
Router(config-if)#no shutdown
Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
Router(config-if)#exit

To configure the Fa 0/1 interface, proceed in the same way:

Router(config)#interface fastEthernet 0/1


Router(config-if)#ip address 192.168.1.254 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
Router(config-if)#exit
Router(config)#exit
Router#
%SYS-5-CONFIG_I: Configured from console by console

3/8
Module : Computer Networks 2nd year Computer Science Abdelhafid Boussouf University Center, Mila Year : 2024/2025

To save the configuration:

Router# copy running-config startup-config


Destination filename [startup-config]?
Building configuration...
[OK]
Router#

3.1.3. Configuration Testing


Use the ping command from a PC in LAN1 to a PC in LAN2 (or vice versa) to verify connection. For
example, on PC0 in the 172.16.1.0/16 network, run the command ping 192.168.1.1. You will notice that the
connection is established and the network is properly configured.

Note: It is possible to visualize the ping in "Simulation" mode to see the path taken by the packets.

3.2. Static Routing Configuration


Routing is a feature of forwarding ensured through networks. To study it, we modify the configuration of the
previous network as follows: A second router is added in such a way that there will be three interconnected
LAN networks; the two networks LAN1 and LAN2 become interconnected through the 10.0.0.0/8 network.

The router interfaces are configured, taking into account this time the addition of a third LAN network.

4/8
Module : Computer Networks 2nd year Computer Science Abdelhafid Boussouf University Center, Mila Year : 2024/2025

3.2.1. Configuring Router 1


Change Fa0/1 to use an address in 10.0.0.0, e.g., 10.0.0.1

Router# show ip interface brief


Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 172.16.0.254 YES manual up up
FastEthernet0/1 192.168.1.254 YES manual up up
Vlan1 unassigned YES unset administratively down down
Router# configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#interface fastEthernet 0/1
Router(config-if)#ip address 10.0.0.1 255.0.0.0
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#exit
Router#
%SYS-5-CONFIG_I: Configured from console by console

Router# copy running-config startup-config


Destination filename [startup-config]?
Building configuration...
[OK]

Router#

L’interface à changer
3.2.2. Configuring Router 2
We assign the address 10.0.0.2 to the Fa 0/0 interface and the address 192.168.1.254 to the Fa 0/1 interface,
and we follow the same procedure as that used for Router 1 (see section 3.1.2. Configuring router interfaces).

3.2.3. Routing Table Configuration


If we ping from PC0 on the 172.16.0.0/16 network to PC2 on the 192.168.1.0/24 network, we will get:

The 172.16.0.0 network cannot communicate with the 192.168.1.0 network because the communication does
not occur directly (as in the previous case where only the LAN1 and LAN2 networks were connected); it
now goes through the 10.0.0.0/8 network, and the router is not configured to recognize this.
Therefore, we need to configure the routes that will allow communication between the 172.16.0.0/16
network and the 192.168.1.0/24 network.
We start by configuring the routes on Router 1. To do this, we add a route to 192.168.1.0/24 through the
next-hop with the address 10.0.0.2:

5/8
Module : Computer Networks 2nd year Computer Science Abdelhafid Boussouf University Center, Mila Year : 2024/2025

Router# configure terminal


Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#ip route 192.168.1.0 255.255.255.0 10.0.0.2
Router(config)#exit
Router#
%SYS-5-CONFIG_I: Configured from console by console

We can view the new routing table:

Router#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D-EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1-OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1-OSPF external type 1, E2 - OSPF external type 2, E - EGP
i-IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is not set

C 10.0.0.0/8 is directly connected, FastEthernet0/1


C 172.16.0.0/16 is directly connected, FastEthernet0/0
S 192.168.1.0/24 [1/0] via 10.0.0.2
Router#

Now we configure the routes on Router 2. To do this, we add a route to 172.16.0.0/16 through the next-hop
with the address 10.0.0.1:

Router# configure terminal


Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#ip route 172.16.0.0 255.255.0.0 10.0.0.1
Router(config)#exit
Router#
The new routing table of Router 2 is:

Router# show ip route


.
.
.
Gateway of last resort is not set

C 10.0.0.0/8 is directly connected, FastEthernet0/0


S 172.16.0.0/16 [1/0] via 10.0.0.1
C 192.168.1.0/24 is directly connected, FastEthernet0/1
Router#

6/8
Module : Computer Networks 2nd year Computer Science Abdelhafid Boussouf University Center, Mila Year : 2024/2025

The connection between the two networks can be tested with a ping from PC0 on the 172.16.0.0/16 network
to PC2 on the 192.168.1.0/24 network. You will notice that the connection is established and the network is
properly configured.

3.2.4. Default Route


When the router needs to access a server (internet, DNS, file server, etc.) or another network that is unknown
to it, a default route must be set. The default route provides the router with a fallback path. To do this, the
following command is used:

Router(config)# ip route 0.0.0.0 0.0.0.0 next-hop

3.3. Dynamic Routing Configuration


The drawback of static routing is that it does not automatically adapt to changes in topology during an
incident, such as a route failure. For this reason, dynamic routing is used.
In the following steps, we configure dynamic routing for the same network as before. First, we clear the
routing tables, and to do this, we delete the routes one by one as follows:

Router# configure terminal


Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#no ip route 192.168.1.0 255.255.255.0 10.0.0.2
Router(config)#exit

We do this for all the routes on both routers.

3.3.1. Routing Algorithms


There are several routing algorithms that differ in their operating principles and the metrics used to choose a
path between the source and the destination. One such class is known as "Distance Vector" routing.
Algorithms in this class use the number of hops as the metric to determine the best path between two
devices. The representative algorithm of this class is the Routing Information Protocol (RIP).
This is the algorithm we will use to implement dynamic routing in the network. Note that this algorithm is
installed by default on Cisco routers.

3.3.2. RIP Configuration


For each router, we configure dynamic routing using the RIP algorithm with the command "router rip".
Then, for each interface on the router, we add the route to the LAN network connected to that interface using
the "network" command.
For Router 1:

Router# configure terminal


Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#router rip
Router(config-router) # network 172.16.0.0
Router(config-router) # network 10.0.0.0
Router(config)#exit
Router#

7/8
Module : Computer Networks 2nd year Computer Science Abdelhafid Boussouf University Center, Mila Year : 2024/2025

For Router 2:

Router# configure terminal


Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#router rip
Router(config-router) # network 10.0.0.0
Router(config-router) # network 192.168.1.0
Router(config)#exit
Router#

The routing table view of Router 1 shows:

Router#show ip route
.
.
.
Gateway of last resort is not set

C 10.0.0.0/8 is directly connected, FastEthernet0/1


C 172.16.0.0/16 is directly connected, FastEthernet0/0

There are only two entries.


If we test the connection between the two networks, 172.16.0.0 and 192.168.1.0, we observe that the
connection is established and the network is properly configured.
The routing table of Router 1 shows:

Router# show ip route


.
.
.
Gateway of last resort is not set

C 10.0.0.0/8 is directly connected, FastEthernet0/1


C 172.16.0.0/16 is directly connected, FastEthernet0/0
R 192.168.1.0/24 [120/1] via 10.0.0.2, 00:00:16, FastEthernet0/1
Router#
Notice that a route to the 192.168.1.0 network has been added—this is thanks to the execution of the RIP
algorithm by Routers 1 and 2 (they exchange their routing tables and update them accordingly).

8/8

You might also like