Lab3

advertisement
91-414 Data Communications II
LAB3 Static Routing
Sources: Mastering Networks, Liebeherr & Zarki
Kurose & Ross
Resources:
 Man pages for route and traceroute (also www.freebsd.org/cgi/man.cgi)
 www.cisco.com/warp/public/105/5.html for proxyarp information
 www.cisco.com for Cisco router information
 www.cisco.com/univercd/cc/td/doc/product/software/ios121/121cgcr/fun_c/fcd00
2.htm for Cisco IOS (Internet Operating System)
Managing the Routers
A Cisco router is managed with Cisco IOS. The router has a startup and a running
configuration. The startup config is used on reboot and the running config is set to the
startup config. Changes made are applied to the running config and will be lost on reboot
unless they are saved. We will not be saving changes.
Cisco IOS has different modes each with its own prompt. Typing exit, end, or Ctrl-Z
exits a mode. Typing ? gives a list of valid command in the mode. Typing no before a
command usually negates it. A table with IOS commands is provided following the
example.
The following configures port 0 with IP address 10.0.2.1/24 and port 1 with address
10.0.3.1/24.
Router> enable
Password: <enable secret>
Router# configure terminal
Router(config)# no ip routing
Router(config)# ip routing
Router(config)# interface Ethernet0
Router(config-if)# no shutdown
Router(config-if)# ip address 10.0.2.1 255.255.255.0
Router(config-if)# interface Ethernet1
Router(config-if)# no shutdown
Router(config-if)# ip address 10.0.3.1 255.255.255.0
Router(config-if)# end
1
91-414 Data Communications II
user exec
>
privileged exec
#
Limited command set
(e.g. ping, traceroute, telnet)
No change of system parameters
Manage config files, examine router state, reboot
To enter from user exec mode:
 enable
 Password: <enable secret> Our setup doesn’t need one.
To exit:
 # disable
show interfaces
show protocols
write term
Displays current config of router
show running-config
show config
show startup-config
reload
global
configuration
(config) #
interface
configuration
(config-if)#
router
configuration
(config-router)#
Displays startup config
Forces reboot. Discards running config &
reloads startup config
Change systemwide config parameters
To enter from privileged exec mode:
 # configure terminal
Some commands:
ip routing Enables IP forwarding
ip route 20.0.1.0 255.55.255.0 10.1.1.1
Adds route for 20.0.1.0/24 via 10.1.1.1 to routing table
Modify config of an interface
To enter from global configuration mode:
 interface <name>
interfaces used in lab: Ethernet, FastEthernet, serial
e.g. interface Ethernet0/1 for port 1 of Ethernet card in slot 0 of
the router. We will be using Ethernet0 and Ethernet1.
ip routing
Enables ip forwarding
no ip routing
Disables forwarding & deletes routing table
no shutdown
Enables network interface
shutdown
Disables network interface
ip address IPaddress netmask Sets ip address & netmask of
interface.
Modify config of a routing protocol. Name of protocol is argument
(e.g. rip, ospf, bgp)
 router rip
2
91-414 Data Communications II
Static Routing Exercise
Reboot the Linux PCs. Save data needed in directory /labdata. Save files to floppy.
Submit answers to questions 1-15 via email, hard copy, or floppy.
PC1 and PC4 are to be used as hosts. PC2 and Router1 are to be set up as IP routers. All
routing tables are configured manually (static routing).
Note: On the PCs, eth0 is the port below and eth1 is the port above.
Eth0
10.0.1.11/24
PC1
Eth0
Eth1
10.0.1.21/24 10.0.2.22/24
PC2
Hub1
10.0.1.0/24 network
Ethernet0
10.0.2.1/24
Hub2
Ethernet1
10.0.3.1/24
Router 1
10.0.2.0/24 network
Eth0
10.0.3.41/24
PC4
Hub3
10.0.3.0/24 network
 Cable as above and use ifconfig to set the ip addresses for PC1, PC2, and PC4.
 Start ethereal on PC1
 From PC1, ping PC2, Router1, and PC4.
1. Save the ethereal output and attach to lab report.
2. Which destinations are not reachable?
Set up PC2 as an IP router
 echo “1” >/proc/sys/net/ipv4/ip_forward
This writes a one to the file. On reboot, it will revert to a 0.
Set static routing table entries using route. These will last until the next reboot.
 Configure the routing entries for PC1 and PC4. You can specify a default route or
add separate routing table entries for each remote network. Here’s what to do for
PC4. Figure out what to do for PC1 yourself.
route add –net 10.0.2.0 netmask 255.255.255.0 gw 10.0.3.1
route add –net 10.0.1.0 netmask 255.255.255.0 gw 10.0.3.1
 Configure the routing table entries for PC2, the Linux ip router.
3. Display the routing tables for PC1, PC2, and PC4 with netstat –rn
Attach the tables to the lab report. Explain the entries in the routing tables.
Connect to the Cisco Router via the console port with kermit.
 Make sure a serial cable (light blue cable plus adapter) is connected from the serial
port of PC1 to the console port of Router 1. The serial port can be ttyS0 or ttyS1.
 Start kermit on PC1 by typing kermit.
 Once in kermit, select the ttyS0 (or ttyS1) serial port: set line /dev/ttyS0
3
 Disable the requirement for a carrier detect signal: set carrier-watch off
 Connect to the router: connect (You should have a prompt, Router>. Hit enter.)
91-414 Data Communications II
Configure the Cisco router ip addresses
You’re connected to the Cisco IOS now. Explore it a bit before continuing.
Configure its interfaces with the ip addresses in the set up diagram above.
Router> enable
Password:
Router # configure terminal
Router (config)# no ip routing
Router (config)# ip routing
Router (config)# interface Ethernet0/0
Router (config-if)# ip address 10.0.2.1 255.255.255.0
Router (config-if)# no shutdown
Router (config-if)# interface Ethernet0/1
Router (config-if)# ip address 10.0.3.1 255.255.255.0
Router (config-if)# no shutdown
Router (config-if)# end
4. When you are done, use the following to check the changes and save the output. Attach it to your
lab report. Make sure you’ve configured the router addresses correctly.
Router# show interfaces
Router# show running-config
Set the static routing table entries on the Cisco router use route
5. Save the content of the routing table using show ip route and include it in the lab report.
- Add routing entries to Router1 so that it forwards for the set up. Routing entries
should be made for 10.0.1.0/24, 10.0.2.0/24, 10.0.3.0/24.
Examples:
Add route for network prefix 10.21.0.0/16 with 10.11.1.4 as next hop address:
Router(config)# ip route 10.21.0.0. 255.255.0.0 10.11.1.4
Add a host route to IP address 10.0.2.31 with next hop 10.0.1.21:
Router(config)# ip route 10.0.2.31 255.255.255.255 10.0.1.21
(In IOS a host route is identified by a 32 bit prefix.
Add the IP address 10.0.4.4 as the default gateway:
Router(config)# ip route 0.0.0.0 0.0.0.0 10.0.4.4
To delete an entry, use no route:
Router(config)# no route 0.0.0.0 0,0.0 10.0.4.4
6. If everything is set up correctly, all machines can talk to each other. Verify this with ping.
Debug your set up if necessary. Save the content of the routing table and include it in the lab
report.
4
91-414 Data Communications II
Test routes with traceroute
- Start an ethereal session.
- Execute a traceroute command from PC1 to PC4
PC1% traceroute 10.0.3.41
7. Explain the operation of traceroute in the lab report.
8. In your lab report explain how the source and destination MAC addresses are changed (or
not) when a datagram is forwarded by a router.
Default Routes
- On PC1, add a default route with interface eth0 of PC2 as the default gateway.
- On PC2, add a default route with interface Etherent0/0 of Router1 as the default
gateway.
- Start to capture on PC1 (eth0) and PC2 (both eth0 and eth1) with ethereal.
- Ping from PC1, a host that doesn’t exist (ping –c 5 10.0.10.110).
9. What is the output on PC1 when the ping is issued?
10. How far does the ICMP Echo Request travel?
11. Which, if any, ICMP Echo Reply returns to PC1?
Proxy ARP (EXTRA CREDIT)
Routers do not forward ARP Requests (broadcasts), but, if proxy arp is enabled, will respond to
an ARP Request if destination device is on one of its connected networks. So, the sending host
isn’t aware that a datagram is being routed. To turn on proxy ARP at the Cisco router, use
ip proxy-arp. To turn it off, use no ip proxy-arp.
- Erase the ARP table and the routing table of PC4.
- Set the netmask of PC4 to 255.0.0.0, so that it belongs to network 10.0.0.0/8 instead of
10.0.3.0/24.
- Run ethereal on PC4 (eth0), PC2 (eth1), PC1(eth0). Set a display or capture filter to
display on ICMP and ARP packets.
- From PC4 to PC1, ping –c 2 10.0.1.11
- Notice that PC4, even though it didn’t have a default route for Router1, was able to talk to
PC1 and there was no ICMP network unreachable message.
- Disable ARP on both interfaces of Router1. Does the ping still work?
- Reset the network mask of PC4 to 255.255.255.0. Reenable proxy ARP on Router1.
12. Explain what happened in your lab report.
5
Download