LAB3
LAB3
MANUAL
LAB 3:
STATIC ROUTING
Contents
PART 1. CONFIGURING A LINUX PC AS AN IP ROUTER........................................................ 3
1.1 EXERCISE 1(A) Network Setup ............................................................................................ 3
1.2 EXERCISE 1(B) Configuring a Linux PC as an IP router ..................................................... 3
1.3 EXERCISE 1(C) Setting static routing table entries for a Linux PC ...................................... 4
PART 2. CONFIGURING A CISCO ROUTER ............................................................................... 6
2.1 EXERCISE 2(A) Accessing a Cisco router with Hyper Terminal......................................... 6
2.2 EXERCISE 2(B) Switching Cisco IOS command modes ..................................................... 6
2.3 EXERCISE 2(C) Configuring IP interfaces on a Cisco router .............................................. 7
2.4 EXERCISE 2(D) Setting static routing table entries on a Cisco router .................................. 8
PART 3. FINALIZING AND EXPLORING THE ROUTER CONFIGURATION ....................... 10
3.1 EXERCISE 3(A) Finalizing the network setup .................................................................... 11
3.2 EXERCISE 3(B) Testing routes with traceroute ................................................................... 11
3.3 EXERCISE 3(C) Observe MAC addresses at a router. ........................................................ 11
3.4 EXERCISE 3(D) Multiple matches in the routing table ....................................................... 12
3.5 EXERCISE 3(E) Default Routes............................................................................................ 13
PART 4. PROXY ARP .................................................................................................................... 13
4.1 EXERCISE 4 Observing Proxy ARP.................................................................................... 14
PART 5. ICMP ROUTE REDIRECT .............................................................................................. 15
5.1 EXERCISE 5 ........................................................................................................................ 16
PART 6. ROUTING LOOPS ........................................................................................................... 18
6.1 EXERCISE 6 ........................................................................................................................ 18
PART 7. NETMASKS AND ROUTING ........................................................................................ 19
7.1 EXERCISE 7. Exploring the role of netmasks at hosts. ....................................................... 20
RECALL:
Do not switch the KVM switch while a Linux PC is rebooting, otherwise the keyboard and mouse
will not work properly. Wait until the KDE desktop environment appears, otherwise Screen will be
mixed up.
During the lab, you need to save data to files. You may save all files in the directorty
/home/student/Desktop/labdata for convinience. So that your files will be available on Desktop.
Save your files to a flash disk before the end of the lab. You will need the files when you prepare
your lab report.
All four Linux PCs will be connected to a single Ethernet segment via a single switch as shown in
Figure 1.
Lab Report: Use the saved data to answer the following questions:
What is the output on PC1 when the ping commands are issued?
Which packets, if any, are captured by wireshark?
Do you observe any ARP or ICMP packets? If so, what do they indicate?
Which destinations are not reachable? Explain.
The command echo writes the given argument, here, the string "1", to the standard output. Using the
redirect operator (>) and a filename, the output of the command is written to a file. IP forwarding is
disabled with the command
The command has an immediate effect; however, changes are not permanent and are lost when the
system is rebooted. Modifying the IP forwarding state permanently requires changes to the
configuration file /etc/sysctl.conf. IP forwarding is enabled if the file contains a line
net.ipv4.ip_forward = 1, and IP forwarding is disabled when the line does not exist or the file contains
1.3 EXERCISE 1(C) Setting static routing table entries for a Linux PC
Next, you must set up the routing tables of the Linux PCs. PC1 and PC4 are hosts, and PC2 is an IP
router. The routing tables are configured so that they conform to the network topology shown in
Figure 3.1 and Table 3.1. The routes are configured manually, which is also referred to as static
routing.
Configuring static routes in Linux is done with the command route, which has numerous options for
viewing, adding, deleting or modifying routing entries. The various uses of the route command are
summarized in the list.
route e
Displays the current routing table with extended fields. The command is identical to the netstat
r command.
route C
Displays the routing table cache.
The command to add a host route to IP address 10.0.2.31 with the next-hop set to 10.0.1.21 is
The command to add the IP address 10.0.4.4 as the default gateway is done with the command
The commands to delete the entries created with the previous commands are
In Linux, there is no simple way to delete all entries in the routing table. When the commands are
issued interactively in a Linux shell, the added entries are valid until Linux is rebooted. To make static
routes permanent, the routes need to be entered in the configuration file /etc/sysconfig/static-routes,
which is read each time Linux is started.
The listed commands are helpful to get information on routing and to find mistakes in the routing
setup.
ping IPaddress
Tests whether IPaddress can be reached
traceroute IPaddress
Displays the route to the interface IPaddress
1. Configure the routing table entries of PC1 and PC4. You can either specify a default route
or insert separate routing entries for each remote network. For this exercise, add a route for
each individual remote network. As a hint, here is the configuration information for PC4:
2. Configure the routing table entries of the IP router PC2. (The correctness of the routing
entries will be tested after Router1 has been set up.)
3. Display the routing table of PC1, PC2, and PC4 with netstat -rn and save the
output.
Lab Report: Include the saved output of the routing table. Explain the entries in the routing table and
discuss the values of the fields for each entry.
The setup of a Cisco router is more involved. The first step is to establish a physical connection to the
router, so that configuration commands can be entered. There are different ways to connect to a Cisco
router. In the Internet Lab, you establish a serial connection to the router. This is done with a serial
cable that connects the serial port of a Windows PC to the console port of a Cisco router. The next
step is to run HyperTerminal on the Windows PC. Lastly, you have to type IOS commands to
configure the Cisco router. Refer to Introduction to Routers Manual for a detailed discussion on how
to navigate and work with the IOS.
The network setup for this part is as shown in Figure 3.1 and Table 3.1.
1. Make sure that Windows PC is connected to Router 1 via a serial cable and that a HyperTerminal
is started.
2. When Windows PC is connected to the router, you see the prompt of the User EXEC mode
(Router>). To see which commands are available in this mode, type a question mark (?):
Router1> ?
3. To view and change system parameters of a Cisco router, you must enter the
Routerl> enable
Router1#
4. To modify systemwide configuration parameters, you must enter the global configuration mode.
This mode is entered by typing
Router1(config)#
Router1(config-if)#
The name of the interface is provided as an argument. Here, the network interface that is configured is
FastEthernet0/0.
6. To return from the interface configuration to the global configuration mode or from the global
configuration mode to the Privileged EXEC mode, use the exit command:
Router1(config-if)# exit
Router1(config)# exit
Router1#
The exit command takes you one step up in the command hierarchy. To directly return to the
Privileged EXEC mode from any configuration mode, use the end command:
Router1(config-if)# end
Router1#
7. To return from the Privileged EXEC mode to the User EXEC mode, type
8. To terminate the console session from the User EXEC mode, type
Router1> logout
1. Connect Windows PC to Router1 via the serial cable and start HyperTerminal.
2. Configure Router1 with the IP addresses given in Table 3.1.
Router1> enable
Router1(config)# no ip routing
Router1(config)# ip routing
Router1(config-if)# no shutdown
Router1(config-if)# no shutdown
Router1(config-if)# end
3. When you are done, use the following command to check the changes you made to the router
configuration and save the output:
4. Analyze the output to ensure that you have configured the router correctly.
Lab Report: Include the output from Step 3 in your lab report.
2.4 EXERCISE 2(D) Setting static routing table entries on a Cisco router
Next you must add static routes to the routing table of Router 1. The routing table must be configured
so that it conforms to the network topology shown in Figure 3.1 and Table 3.1.
The IOS command to configure static routing is ip route. The command can be used to show,
We next show some examples for adding and deleting routing table entries in IOS. Compare these
commands to the corresponding Linux commands in Part 1, Exercise 1(C). As in Linux, whenever an
IP address is configured for a network interface, routing table entries for the directly connected
network are added automatically.
The command for adding a route for the network prefix 10.21.0.0/16 with 10.11.1.4 as the next-hop
address is
The command to add a host route to IP address 10.0.2.31 with the next-hop set to 10.0.1.21 is
The command to add the IP address 10.0.4.4 as the default gateway is done with the command
Finally, commands to delete the previous entries use the no ip route command.
1. Display the content of the routing table with show ip route. Note the routing entries that are
already present. Save the output.
2. Add routing entries to Router 1 so that the router forwards datagrams for the configuration shown
in Figure 3.1. Routing entries should exist for the following networks:
10.0.1.0/24
10.0.3.0/24
3. Display the routing table again with show ip route and save the output.
Lab Report: Include the saved output of the routing table from Steps 1 and 2. Explain the fields of
the routing table entries of the Cisco router. Explain how the routing table has changed from Step 1
to Step 3.
If the configuration of PC2 and Router 1 was done correctly, it is now possible to send IP datagrams
between any two machines in the network shown in Figure 3.1. However, if the network is not
configured properly, you need to debug and test your setup. Table 3.2 illustrates several common
problems that may arise. Since it is impossible to cover all scenarios, network debugging is a crucial
skill that you need to obtain for your lab experiments to work well.
The network setup for this part is as shown in Figure 3.1 and Table 3.1.
Test the network configuration by issuing ping commands from each host and router to every other
host and router. If some ping commands do not work, you need to modify the configuration of routers
and hosts. If all ping commands are successful, the network configuration is correct, and you can
proceed to the next step.
3. Stop the traffic capture of wireshark and save the traffic generated by the traceroute
command.
4. Save the routing table of PC 1, PC4, PC2, and Router 1.
Lab Report Use the wireshark output and the previously saved routing table to explain the operation
of traceroute.
This exercise requires manipulations to the ARP cache. The arp command in Linux was covered in
Lab 2. The list shows corresponding IOS commands for Cisco routers.
arp IPaddress
no arp IPaddress
Deletes the ARP entry for IPaddress from the ARP cache
4. Save the packet transmissions triggered by the ping command, including ARP
requests, ARP Reply, ICMP Echo Request, and ICMP Echo Reply on both PC1 and
PC4.
Lab Report
Determine the source and destination addresses in the Ethernet and IP headers for the ICMP Echo
Request messages that were captured at PC1.
Determine the source and destination addresses in the Ethernet and IP headers for the ICMP Echo
Request messages that were captured at PC4.
Use your previous answers to explain how the source and destination Ethernet and IP addresses
are changed when a datagram is forwarded by a router.
From Exercise 1(C) there should be a network route for the network prefix 10.0.3.0/24.
If there is no such route, then add the following entry:
2. Referring to the routing table, determine how many matches exist for the following
IP addresses:
10.0.3.9
10.0.3.14
10.0.4.1
3. Start a wireshark session on PC1 and issue the following ping commands from PC1:
Note that gateways with IP addresses 10.0.1.61, 10.0.1.71, and 10.0.1.81 do not exist.
However, PC1 still sends ARP Request packets for these IP addresses.
Lab Report Use the saved output to indicate the number of matches for each of the preceding IP
addresses. Explain how PC1 resolves multiple matches in the routing table. Include only relevant
output data in your report to support your analysis of the data.
b. On PC2, add a default route with interface Ethernet0/0 of Router1 as the default
gateway.
3. Start to capture traffic on PC1 (on eth0) and PC2 (on both eth0 and ethl) with wireshark.
4. Issue a ping command from PC1 to a host on a network that does not exist.
PC1% ping -c 5 10.0.10.110
In this part you explore how Proxy ARP enables routers to forward an IP datagram even though the
sender of the datagram is not aware that the IP datagram should be forwarded to a router. Continue
with the network configuration from Figure 3.1, and with IP addresses as shown in Table 3.1.
The commands to enable and disable Proxy ARP in IOS are listed.
ip proxy-arp
no ip proxy-arp
Proxy ARP is enabled and disabled separately on each interface. In IOS, Proxy ARP is enabled by
default.
Even though PC4 had no default routing entry in its table for Router 1, it was still able to connect
to PC1 (i.e., you should not observe a "network unreachable" error message).
5. Save the ARP table of PC4 and the packets captured by wireshark on the hosts.
6. Explore the captured data and interpret the outcome.
7. Now disable Proxy ARP on both interfaces of Router 1. Is it still feasible to issue a ping from PC4
to PC1?
8. Reset the network mask of PC4 to its original value of 255.255.255.0. Then, reenable Proxy ARP
on Router1.
Lab Report Use the captured data to explain the outcome of the exercise. Use the data to explain how
Proxy ARP allowed PC4 to communicate with PC1. Include only relevant data from your saved
output.
Both the routing cache and the routing table contain information for forwarding traffic. Before a
Linux system performs a routing table lookup, it first inspects the routing cache. If no matching entry
is found in the cache, Linux performs a lookup in the routing table. After each routing table lookup, an
entry is added to the routing cache. The routing cache does not aggregate table entries, and there is a
separate entry for each destination IP address. As a consequence, a lookup in the routing cache does
not require a longest-prefix match. An entry in the routing cache is deleted if it has not been used for
some time, usually after 10 minutes. When an ICMP Redirect message arrives, an entry is added to the
routing cache, but no update is performed to the routing table.
In this part of the lab, you use three Cisco routers. Figure 3.2 and Table 3.3 describe the network
configuration for the later exercises.
NOTE
The following are the commands to display the contents of the routing cache:
5.1 EXERCISE 5
In the network shown in Figure 3.2, when PC2 sends datagrams with destination 10.0.3.10 (PC3) to
10.0.2.1 (Router1), as opposed to 10.0.2.2 (Router2), then Router1 sends an ICMP route redirect
message to PC2. The ICMP route redirect informs PC2 that it should send datagrams with destination
10.0.3.10 to Router2 instead.
In this exercise you create the preceding scenario. First, you will trigger the transmission of an ICMP
route redirect message and subsequently observe a change to the routing cache.
1. Connect the Ethernet interfaces of the routers and the hosts to the hubs as shown in Figure 3.2.
2. Delete all routing table entries and all ARP cache entries on all PCs and on Router 1.
a. Delete the routing cache on PCI with the command
Router1(config)# no ip routing
Router1(config)# ip routing
c. Build a new static routing entry on Router1 for network prefix 10.0.3.0/24 as
follows:
5. Use wireshark to capture the ICMP messages being sent, and issue a ping from PC2
to PC3:
6. Save the network traffic and the contents of the routing table and the routing cache after the ICMP
route redirect messages.
7. Wait a few minutes and check the contents of the routing cache again. Save the output.
Lab Report
Is there a difference between the contents of the routing table and the routing cache immediately
after the ICMP route redirect message?
When you viewed the cache a few minutes later, what did you observe?
Describe how the ICMP route redirect works using the output you saved. Include only relevant
data from your saved output to support your explanations.
Explain how Router1, in the previous example, knows that datagrams destined to network
10.0.3.10 should be forwarded to 10.0.2.2?
6.1 EXERCISE 6
1. Add Router4 to the network topology of Part 5 and configure the interfaces as shown in
Figure 3.3 and Table 3.4.
2. Configure the routing tables of Router2, Router3, and Router4 so that an ICMP Echo
Request message generated by a ping from PC4 to PC1 creates an infinite loop.
Issue a traceroute to verify that a loop exists:
Observe in wireshark that the same ICMP Echo Request message is looping.
5. Save the routing tables of Router2, Router3, and Router4. Count the number of times
you see the ICMP Echo Request message, as captured by wireshark on PC4. Save at
least two of these ICMP Echo Request messages for the lab report.
Lab Report
Are the two ICMP packets that you saved identical? If not, what is different? Include the packet
data in your lab report to substantiate your claims.
Why does the ICMP Echo Request packet not loop forever in the network?
This part uses the network setup shown in Figure 3.4. The network includes one router, four hosts, and
two hubs. The IP addresses of all devices are given in Table 3.5. Here, each host has only a default
route. In other words, the routing table at a host knows about only the directly connected networks
and the default gateway.
1. Configure the hosts and the router to conform to the topology shown in Figure 3.4
using the IP addresses as given in Table 3.5.
2. Add Router 1 as the default gateway on all hosts. For example, for PC1, the command is
b. Start wireshark on PC1 and on PC4, and set the capture filter to capture ICMP and
ARP packets only.
c. Check the ARP table, routing table, and routing cache of each host. Save the out
put. (Make a note that these are the table entries from Step 2 before the ping is
issued.)
Save the ARP tables, routing tables, and routing caches of each host. (Make a note that
these are the table entries from Step 2 after the ping commands are issued.)
e. Save the output of the ping command at PC1 and the output of wireshark on PC1
and PC4.
b. Start wireshark on PC3 and set the capture filter to capture ICMP and ARP packets
only.
c. Check the ARP table, routing table, and routing cache of each host. Save the
output. (Make a note that these are the table entries from Step 3 before the ping
is issued.)
f. Save the output of the ping command and the output of wireshark on PC3.
5. Repeat Step 4, but this time issue a ping from PC3 to PC2. Note that once an entry
is made in the routing cache, you cannot repeat the previous experiment to obtain the
same results; you have to wait until the routing cache is reset (which takes some
time).
Lab Report
Explain what you observed in Steps 3, 4, and 5. Use the saved data to support your answers.
Provide explanations of the observations. Try to explain each observed phenomenon (e.g., if you
observe more ICMP Echo Requests than ICMP Echo Replies, try to explain the reason).
If PC3 had no default entry in its table, would you have seen the same results? Explain for
each of the pings what would have been different.