B2206021 DangNhatTuong CT106H Lab3

Download as pdf or txt
Download as pdf or txt
You are on page 1of 49

LAB 3

CONSTRUCT A SIMPLE NETWORK

Name: Đặng Nhật Tường


ID: B2206021
Group: M02

Submission: an ID_NAME_Lab03.pdf file describes clearly how did you solve the problem
Exercise 0: change the directory to your home directory

Answer: $cd
Exercise 12: Construct a simple topology

Answer:
Create exercises12 directory
$ mkdir -p ~/CT106H/lab3/exercises12
$ cd ~/CT106H/lab3/exercises12

Prepare the lab


$ mkdir -p r1/etc/quagga r2/etc/quagga r3/etc/quagga shared
$ gedit lab.conf
$ gedit LICENSE
$ gedit r1.startup
$ gedit r2.startup
$ gedit r3.startup
$ gedit r1/etc/quagga/daemons
$ gedit r1/etc/quagga/ripd.conf
$ gedit r1/etc/quagga/zebra.conf
$ gedit r2/etc/quagga/daemons
$ gedit r2/etc/quagga/ripd.conf
$ gedit r2/etc/quagga/zebra.conf
$ gedit r3/etc/quagga/daemons
$ gedit r3/etc/quagga/ripd.conf
$ gedit r3/etc/quagga/zebra.conf
/etc/init.d/quagga start: the command will start the quagga routing services after setting
up the appropriate configuration files for each router.
zebra=yes: The Zebra daemon is activated. It manages the system's routing table and
facilitates communication between the other routing daemons and the kernel
bgpd=no: The Border Gateway Protocol daemon is turned off
ospfd=no: The OSPF (Open Shortest Path First) daemon is turned off
ospf6d=no: The IPv6 version of the OSPF daemon is turned off
ripd=yes: The Routing Information Protocol daemon is enabled, allowing the system to
route using the RIP protocol
ripngd=no: The IPv6 version of the RIP daemon (RIPng) is turned off

!
hostname ripd
password zebra
enable password zebra
!
This section handles the identification of the RIP daemon and basic security through
password protection, ensuring that only authenticated users can configure the RIP
service
!
router rip
redistribute connected
network eth0
network eth1
!
This section defines how the router interacts with other devices using the RIP protocol,
including which interfaces participate in routing and what information (connected
routes) should be shared

log file /var/log/quagga/ripd.log: this command sets the location where the RIP
daemon will logs its events and activities
Start the lab
$ kathara lstart
Testing connectivity
$ route -n (On r1 r2 r3)
$ ping -c 2 100.0.0.1 (r3 ping to eth0 r1)


⇒ Routing protocols (RIP, OSPF) can detect and update route in the routing table
automatically

On a router, use the command tcpdump to capture the RIPv2 packet; then stop the
command after about 20 seconds. For example, on r1 type: tcpdump -i any -w
/shared/Ex12_r1.pcap
On a router, connecting to the main zebra daemon using the following command:
telnet localhost ripd
The password is zebra

Then type: show ip rip


The command shows ip rip, which displays the RIP routing table. The output provides a
detailed view of the routes learned or advertised via RIP:
● Codes section indicates the source of the routing information and helps
distinguish between dynamically learned routes (e.g., RIP or OSPF) and
manually configured routes (static)
● Subcodes section provides more specific details about the type of route, such as
whether it's a default route, a redistributed route, or a direct connection. This
helps in route classification and decision-making when forwarding packets
● Network: This shows the network addresses for the routes in the table.
● Next Hop: The next hop IP address (the router where packets will be forwarded)
● Metric: RIP uses a hop count as the metric, where the lower the number, the
better the route
● From: The source IP address from which the route was learned
● Tag: A field used for route identification or filtering
● Time: How long the route has been in the table since it was last updated

Open the file Ex12_r1.pcap using Wireshark, select the RIPv2 packet, explain
information in that packet.

- Frame 1 captured ( 92 bytes in length). The source IP is 150.0.0.2 and the


destination is the multicast 224.0.0.9.
- The protocol is UDP (User Datagram Protocol) with source and destination
ports set to 520, which is the port used for RIP messages.
- RIPv2 (Routing Information Protocol version 2) is a distance-vector routing
protocol used in IP networks to facilitate the exchange of routing information
between routers. It is an enhancement of the original RIP with several
improvements while maintaining simplicity and ease of use.
- The route of packet: 100.0.0.1 ⇒ 150.0.0.0 ⇒ 200.0.0.0 ⇒ 220.0.0.0 ⇒ 224.0.0.9
Clean the lab
$ kathara lclean

Exercise 13 (RIP): Construct the following topology

Create exercises13 directory


$ mkdir -p ~/CT106H/lab3/exercises13
$ cd ~/CT106H/lab3/exercises13
Prepare the lab
$ mkdir -p r1/etc/quagga r2/etc/quagga r3/etc/quagga r4/etc/quagga r5 shared
$ gedit lab.conf
$ gedit LICENSE
$ gedit r1.startup
$ gedit r2.startup
$ gedit r3.startup
$ gedit r4.startup
$ gedit r5.startup
$ gedit r1/etc/quagga/daemons
$ gedit r1/etc/quagga/ripd.conf
$ gedit r1/etc/quagga/zebra.conf
$ gedit r2/etc/quagga/daemons
$ gedit r2/etc/quagga/ripd.conf
$ gedit r2/etc/quagga/zebra.conf
$ gedit r3/etc/quagga/daemons
$ gedit r3/etc/quagga/ripd.conf
$ gedit r3/etc/quagga/zebra.conf
$ gedit r4/etc/quagga/daemons
$ gedit r4/etc/quagga/ripd.conf
$ gedit r4/etc/quagga/zebra.conf
Start the lab
$ kathara lstart

Check the routing table using the route command


# route -n (On r1 r2 r3 r4 r5)
Using RIP dynamic routing protocol, r1 - r2 - r3 - r4 will have all information in the
local network

Otherwise, r5 is just an external router (configured as static routing)

Check connectivity using the ping command


$ ping -c 2 100.1.3.1 (r1 ping to eth3 r3)
$ ping -c 2 100.1.0.8 (r2 ping to eth2 r4)

$ ping -c 2 100.2.0.2 (r3 ping to eth0 r5)

$ ping -c 2 100.1.1.1 (r4 ping to eth3 r1)


$ ping -c 2 100.1.0.13 (r5 ping to eth0 r1)

On R4, type traceroute 100.1.2.1 command, and explain what happens?


# traceroute 100.1.2.1 (On r4)

traceroute 100.1.2.1 command trace the path that data packets take from your computer to the
destination IP address 100.1.2.1. In this process, 100.1.0.13 represents the next hop from R4 on
the way to the final destination, which is 100.1.2.1.

On R1, shutting down an interface using the command ifconfig eth1 down and
Examine the route using the command traceroute 100.1.0.10
# traceroute 100.1.0.10 (before)
# ifconfig eth1 down
# traceroute 100.1.0.10 (after)
Before the shutdown, the traceroute shows that the track from r1 to the IP address
100.1.0.10 is just only 1 hop. After shutting down the interface, the destination was still
reachable but in two hops, also the latency values changed, indicating a different route
or path was used after eth1 went down.

Clean the lab


$ kathara lclean

Exercise 14 (OSPF) - single area: Construct the following topology

Answer:
Create exercises14 directory
$ mkdir -p ~/CT106H/lab3/exercises14
$ cd ~/CT106H/lab3/exercises14
Prepare the lab
$ mkdir bb0/etc/quagga bb1/etc/quagga bb2/etc/quagga bb3/etc/quagga
bb5/etc/quagga shared
$ gedit lab.conf
$ gedit bb0.startup
$ gedit bb1.startup
$ gedit bb2.startup
$ gedit bb3.startup
$ gedit bb4.startup
$ gedit bb0/etc/quagga/daemons
$ gedit bb0/etc/quagga/ospfd.conf
$ gedit bb1/etc/quagga/daemons
$ gedit bb1/etc/quagga/ospfd.conf
$ gedit bb2/etc/quagga/daemons
$ gedit bb2/etc/quagga/ospfd.conf
$ gedit bb3/etc/quagga/daemons
$ gedit bb3/etc/quagga/ospfd.conf
$ gedit bb4/etc/quagga/daemons
$ gedit bb4/etc/quagga/ospfd.conf
The file represents the configuration of the OSPF (Open Shortest Path First) routing
protocol on a router
interface eth1: Refers to the Ethernet interface eth1.
ospf cost 45: Sets the OSPF cost for this interface to 45. This cost determines the metric
for routing decisions—lower cost paths are preferred.
router ospf: Starts the OSPF routing process.
network 10.0.0.0/16 area 0.0.0.0: This command tells OSPF to include all interfaces
within the 10.0.0.0/16 network in Area 0, which is the backbone area in OSPF.
redistribute connected: Redistributes directly connected routes into OSPF, meaning any
networks directly connected to this router will be advertised in OSPF.
Start the lab
$ kathara lstart

Testing connectivity
# route -n ( On bb0 bb1 bb2 bb3 bb4)
# ping -c 2 10.0.2.1 ( bb1 ping to eth0 bb4)
# ping -c 2 10.0.0.3 ( bb2 ping to eth0 bb0)
Perform a traceroute –I from bb1 to 10.0.2.1
◼ what path is the traceroute expected to take?
◼ what path are ICMP replies expected to take?
# traceroute -I 10.0.2.1 (the -I option specifies that the traceroute should use ICMP
(Internet Control Message Protocol) echo requests instead of the default UDP (User
Datagram Protocol) packets)

The path is bb1 ⇒10.0.0.2 ⇒ 10.0.1.2 ⇒ 10.0.2.1


The path ICMP replies expected to take is bb1 ⇒ 10.0.0.2 ⇒ 10.0.1.2 ⇒ 10.0.2.1
⇒ The path is the same as traceroute expected

*Perform a traceroute –I from bb1 to 10.0.3.2


◼ what path is the traceroute expected to take?
◼ observe the interplay between ospf routes and directly connected networks (i.e.,
perform a show ip route in quagga)
# traceroute -I 10.0.3.2
In OSPF network routing table, the path is: 10.0.1.1 ⇒ 10.0.2.2 ⇒ 10.0.2.3 ⇒ 10.0.3.2
Access the ospfd cli on the various routers and issue the following commands:
◼ show ip ospf database
◼ show ip ospf neighbor

show ip ospf database: Displays information about the OSPF link-state database
(LSDB), which contains all the link-state advertisements (LSAs) used by OSPF to create
the network routing topology.
show ip ospf neighbor: Displays information about the OSPF neighbors with which the
router has formed adjacencies.
Access the ospfd cli on the various routers and issue the following commands:
◼ show ip ospf interface: Dísplays information about OSPF settings for different
interfaces on the router.

On a router, use tcpdump command to capture packets transmitted between


routers and discover them
# tcpdump (On bb1)
Routers send "Hello" packets to each other automatically, so there’s no need for manual ping
commands. This is the key part of how OSPF works as a dynamic routing protocol. These
Hello packets help routers find one another, check that they're connected, and keep their routing
information up to date

Clean the lab


$ kathara clean

Exercise 15 (ospf-multiarea)

Answer:

Create exercises15 directory


$ mkdir -p ~/CT106H/lab3/exercises15
$ cd ~/CT106H/lab3/exercises15
Prepare the lab
$ mkdir -p bb0/etc/zebra bb1/etc/zebra bb2/etc/zebra bb3/etc/zebra bb4/etc/zebra
r1/etc/zebra r2/etc/zebra r3/etc/zebra r4/etc/zebra r5/etc/zebra r6/etc/zebra
shared
$ gedit lab.conf
$ gedit bb0.startup
$ gedit bb1.startup
$ gedit bb2.startup
$ gedit bb3.startup
$ gedit bb4.startup
$ gedit r1.startup
$ gedit r2.startup
$ gedit r3.startup
$ gedit r4.startup
$ gedit r5.startup
$ gedit r6.startup
$ gedit bb0/etc/zebra/daemons
$ gedit bb0/etc/zebra/ospfd.conf
$ gedit bb1/etc/zebra/daemons
$ gedit bb1/etc/zebra/ospfd.conf
$ gedit bb2/etc/zebra/daemons
$ gedit bb2/etc/zebra/ospfd.conf
$ gedit bb3/etc/zebra/daemons
$ gedit bb3/etc/zebra/ospfd.conf
$ gedit bb4/etc/zebra/daemons
$ gedit bb4/etc/zebra/ospfd.conf
$ gedit r1/etc/zebra/daemons
$ gedit r1/etc/zebra/ospfd.conf
$ gedit r2/etc/zebra/daemons
$ gedit r2/etc/zebra/ospfd.conf
$ gedit r3/etc/zebra/daemons
$ gedit r3/etc/zebra/ospfd.conf
$ gedit r4/etc/zebra/daemons
$ gedit r4/etc/zebra/ospfd.conf
$ gedit r5/etc/zebra/daemons
$ gedit r5/etc/zebra/ospfd.conf
$ gedit r6/etc/zebra/daemons
$ gedit r6/etc/zebra/ospfd.conf
Start the lab
$ kathara lstart
Testing connectivity
# route -n ( On r1 r6 bb2 bb4)
# ping -c 2 220.0.1.1 (r2 ping to eth1 r4)
# ping -c 2 10.0.1.2 (r3 ping to eth0 bb3)
# ping -c 2 10.0.1.2 (r4 ping to eth1 bb4)
# ping -c 2 210.0.0.1 (bb2 ping to eth2 r3)

Clean the lab


$ kathara lclean
Exercises 16: Construct the following network using the RIPv2
protocol. We note that the RouterISP won’t run the RIPv2 protocol

Answer:
Create exercises16 directory
$ mkdir -p ~/CT106H/lab3/exercises16
$ cd ~/CT106H/lab3/exercises16
Prepare the lab
$ mkdir router1/etc/quagga router2/etc/quagga router3/etc/quagga shared
$ gedit lab.conf
$ gedit pc2.startup
$ gedit pc3.startup
$ gedit router1.startup
$ gedit router2.startup
$ gedit router3.startup
$ gedit routerisp.startup
$ gedit router1/etc/quagga/daemons
$ gedit router1/etc/quagga/ripd.conf
$ gedit router1/etc/quagga/zebra.conf
$ gedit router2/etc/quagga/daemons
$ gedit router2/etc/quagga/ripd.conf
$ gedit router2/etc/quagga/zebra.conf
$ gedit router3/etc/quagga/daemons
$ gedit router3/etc/quagga/ripd.conf
$ gedit router3/etc/quagga/zebra.conf
Start the lab
$ kathara lstart
Testing connectivity
# route -n (On router1 router2 router3)
# ping -c 2 192.168.2.111 (pc2 ping to eth0 pc3)
# ping -c 2 10.0.1.5 (pc2 ping to eth2 router1)
# ping -c 2 192.168.1.200 (pc3 ping to eth0 pc2)
# ping -c 2 10.0.1.9 (pc3 ping to eth2 router2)

# route -n (On routerisp)


# ping -c 2 192.168.2.1 (routerisp ping to eth0 router3)
RouterISP doesn’t run the RIPv2 protocol so it just connect to only router1

Clean the lab


$ kathara clean

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy