Network Lab Report

Published on 2016 - 12 - 07

Zuyang Liu

Basic operations

To start the lab

  • start any (working) machine from IAO, Candix or DAO room on Fedora;

  • log in using your UCL account;

  • open a terminal and write:

oasis/elec2920-login
  • close and open the terminal again;

  • write the following command lines:

netkit // this will now take up to one minute the first time
lab1   // if you did not do it already today or forgot to write
       // "oasis/elec2920-logout" at the end of your session today
cd elec2920/lab-161028
lstart

To end the lab

  • at the end of your session, to end the lab: lhalt lkill // (if the previous one didn't work) cd; oasis/elec2920-logout
  • you can then log out from your machine.

LAB1 Static Routing

201612052117581000.jpg-182.3kB

The network topology is shown above, we have to manually configure the network using static routing. Forst, let's 'explore' the network and see what we should do.

Configuring pcs

Setup Interfaces

Check the interfaces on pc1:

# ifconfig // show interfaces

There is only one interface: Loopback, so proper interface should be added, the ip address of pc1 is 192.168.0.1/27, so we type:

# ifconfig eth0 192.168.0.1/27 

Now that the interface has been added, we can see it:

# ifconfig
eth0      Link encap:Ethernet  HWaddr 82:cb:d5:43:d0:e6  
          inet addr:192.168.0.1  Bcast:192.168.0.15  Mask:255.255.255.240
          ......

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          ......

We can see that the ip address of eth0 is 192.168.0.1 and the mask being 225.225.225.240, the interface is corrent. We do the same thing on pc2 and pc3, but with different ip addresses and masks of course.

Adding gateway

Also we need to add the gateway in every pc, since every pc is connected to only one router, the only gateway needed to be add is the default gateway.

In pc1:

# netstat -rn // display routing table, #route works the same
# route add default gw 192.168.0.30 // add route configuration

Do the same thing on pc2 and pc3 with different gateway ip address.

Now verything is correct, those pcs should be ready for this network.

Configuring Routers

First, Check the interfaces and routes on the closest router to pc1: r2

# telnet localhost zebra
// Type the password zebra
> show interface
Interface eth0 is up, line protocol detection is disabled
  inet 10.0.1.2/30 broadcast 10.0.1.3
  ......
Interface eth1 is up, line protocol detection is disabled
  inet 192.168.0.30/27 broadcast 192.168.0.31
  ......
Interface lo is up, line protocol detection is disabled
  inet 127.0.0.1/8
  ......
> show ip route
    ......
C>* 10.0.1.0/30 is directly connected, eth0
C>* 127.0.0.0/8 is directly connected, lo
C>* 192.168.0.0/27 is directly connected, eth1

3 interfaces and 3 routes are found, judging from the result, r2 can reach network 10.0.1.0/30 and 192.168.0.0/27. To verify that, we can:

# ping 192.168.0.65  // can not reach 192.168.0.65
connect: Network is unreachable
# ping 10.0.1.1
PING 10.0.1.1 (10.0.1.1) 56(84) bytes of data.
64 bytes from 10.0.1.1: icmp_seq=1 ttl=64 time=0.357 ms
......

Now, pc1 can ping r2, r2 can ping r1, so pc1 should be able to reach r1. However, if we # traceroute from pc1 to r1:

# traceroute 10.0.1.1
traceroute to 10.0.1.1 (10.0.1.1), 30 hops max, 60 byte packets
 1  192.168.0.30 (192.168.0.30)  0.227 ms  0.119 ms  0.186 ms
 2  * * *
 ......

We can see that the request 'stuck' at r2, but in r1, we can see the packages sent by pc1:

# tcpdump -i eth0                                                                               
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
23:09:52.537993 IP 192.168.0.1.60078 > 10.0.1.1.33437: UDP, length 32
23:09:52.538430 IP 192.168.0.1.53413 > 10.0.1.1.33438: UDP, length 32
......

But there was nothing sending back. Because on r1, pc1 is unreachable, we need to configure the routes on r1:

# telnet localhost zebra  
// Type the password
> show ip route  // should see 4 routes connecting to network A. B and C, which do not cover the whole network
> enable
# config terminal
# ip route 192.168.0.0/27 10.0.1.2
# ip route 192.168.0.64/26 10.0.1.6
# ip route 192.168.0.32/27 10.0.1.10

Now, pc1 can ping r1.

There are 4 routers and 6 subnets, if we add them one by one, that would be too much work to do. So in r2, r3 and r4, we can 'cheat' a little by using 0.0.0.0/0. In my configuration, I added:

On r2:

ip route 0.0.0.0/0 10.0.1.1

on r3:

ip route 0.0.0.0/0 10.0.1.5

On r4:

ip route 0.0.0.0/0 10.0.1.9

After that, the network is working perfectly, everything can ping everything.

LAB2 Dynamic Routing

lab3.jpg-232kB

In this lab, we are going to set up dynamic routing using OSPF(Open Shortest Path First). Network topology is as shown above, The pcs are correctly configured but the routers are not.

  1. Set routers to ospf In a router (r1, r2 ,r2 r4), configure ospf For example, in router1: # telnet localhost ospfd > enable # configure terminal # router ospf # network 192.168.0.0/24 area 0.0.0.0 # network 10.0.0.0/29 area 0.0.0.0 // Press Ctrl + D // Examine OSPF configure: > show ip ospf > show ip ospf neighbor > show ip ospf route

Also, we can see the packages sent in the network, for example, in r3, we run:

# tcpdump -i eth1

And then configure ospf on r2, we can see:

15:16:54.167509 IP 10.0.0.11 > 224.0.0.5: OSPFv2, Hello, length 44
15:16:54.177703 IP 10.0.0.11 > 224.0.0.22: igmp v3 report, 1 group record(s)
15:16:54.550855 IP 10.0.0.11 > 224.0.0.22: igmp v3 report, 1 group record(s)
15:16:57.729542 IP 10.0.0.9 > 224.0.0.5: OSPFv2, Hello, length 52
15:16:57.729570 IP 10.0.0.10 > 224.0.0.5: OSPFv2, Hello, length 52
15:16:57.733063 ARP, Request who-has 10.0.0.10 tell 10.0.0.11, length 28
15:16:57.733111 ARP, Reply 10.0.0.10 is-at f2:22:24:d2:0f:f6, length 28
15:16:57.733160 IP 10.0.0.11 > 10.0.0.10: OSPFv2, Database Description, length32
15:16:57.733250 ARP, Request who-has 10.0.0.9 tell 10.0.0.11, length 28
15:16:57.733264 ARP, Reply 10.0.0.9 is-at 56:ac:2b:c5:af:c3, length 28
15:16:57.733325 IP 10.0.0.11 > 10.0.0.9: OSPFv2, Database Description, length 32
15:16:57.733952 IP 10.0.0.10 > 10.0.0.11: OSPFv2, Database Description, length32
15:16:57.734147 IP 10.0.0.10 > 10.0.0.11: OSPFv2, Database Description, length152
15:16:57.734820 IP 10.0.0.11 > 10.0.0.10: OSPFv2, Database Description, length52
15:16:57.735281 IP 10.0.0.10 > 10.0.0.11: OSPFv2, Database Description, length32
15:16:57.735467 IP 10.0.0.10 > 10.0.0.11: OSPFv2, LS-Request, length 36
15:16:57.735504 IP 10.0.0.9 > 10.0.0.11: OSPFv2, Database Description, length 32
15:16:57.735661 IP 10.0.0.9 > 10.0.0.11: OSPFv2, Database Description, length 152
15:16:57.736212 IP 10.0.0.11 > 10.0.0.10: OSPFv2, LS-Request, length 96
15:16:57.736677 IP 10.0.0.10 > 224.0.0.5: OSPFv2, LS-Update, length 296
15:16:57.736790 IP 10.0.0.11 > 224.0.0.6: OSPFv2, LS-Update, length 64
15:16:57.737294 IP 10.0.0.11 > 10.0.0.9: OSPFv2, Database Description, length 52
15:16:57.738052 IP 10.0.0.11 > 224.0.0.6: OSPFv2, LS-Update, length 64
15:16:57.738233 IP 10.0.0.9 > 10.0.0.10: OSPFv2, LS-Ack, length 144
15:16:57.739231 IP 10.0.0.9 > 224.0.0.5: OSPFv2, LS-Update, length 64
15:16:57.739534 IP 10.0.0.10 > 224.0.0.5: OSPFv2, LS-Update, length 88
15:16:57.739836 IP 10.0.0.9 > 10.0.0.11: OSPFv2, Database Description, length 32

When OSPF is sucessfully configured, if we disable one router, or disable one link, as long as there are still avaliable links in the system, the system will still work (in theory).

Now we do some nasty things, we bring one or more interface down

On pc1, we keep pinging pc2

On r3, if we use # ifconfig, we can see there are 4 interfaces, lo, eth0(10.0.0.2), eth1(10.0.0.9) and eth2(10.0.0.17)

Now we disable interface eth0

# ifconfig eth0 down

Ping form pc1 to pc2 continues

Disable eth1 on r4

Ping from pc1 to pc2 continues, then stopped, weird enough.