Sei sulla pagina 1di 7

Tutorial 8

Review (Deadline: see Moodle)


1. Why is it important to that an IPv4 address have a lease time? This ensures if an IPv4 is not
used, then it can be assigned to another computer.
2. Which logical operator is used extract the network ID part from an IPv4 address? AND
3. What is longest prefix (mask) matching? It is used by a router to determine the best route entry
for a given IPv4 address. The rule is to match the prefix or network ID with the most matching
bits. Note that all bits in the prefix length or netmask must match.
4. What are the main differences between distance vector and link state routing protocols? Link
state requires the map. However, for distance vector routing protocols, nodes only know the
destinations and corresponding cost to these destinations offered by neighbour routers.
5. In the context of routing protocols, define convergence. The state or time in which routing
tables contain the best route to destinations.
6. Why is fast convergence important? To ensure packets always follow the best path to their
destination. If routing tables are not stable, then packets may loop in a network or follow sub-
optimal paths. Hence, they consume network resources unnecessarily.
7. For each of the following IPv6 address, determine whether it is a valid IPv6 address. [Yes | No]
a. 2001:ff21:1c36:3b4c:c394:eb02:97ee:d605:bb2d No (it has 9 16-bits blocks, hence it is more than
128 bits)
b. 2001:5d53::1b64::c7d0:2bae You cannot have two ::
c. 2001:f10f::e9fe Yes
d. 2001:d230:c934:545f:668f:8aaf (it has 6 16-bits blocks, so it is less than 128 bits)
8. IPv4 header has a Time-To-Live (TTL) field. Why is this field needed? To ensure a packet is only
forwarded for a finite number of times. To ensure a packet that cannot reach its destination
does not remain in a network for infinite time.
9. What is gratuitous Address Resolution Protocol (ARP)? A protocol used to update the MAC
address to/from IP address mapping of hosts. For example, if the IP address of a machine has
changed, then it can issue this message to inform other machines on the channel to update their
mapping between its old IP address and MAC address.
Exercises
1. Given a 3000 byte sized datagram with an identification number 422. The maximum transmission
unit (MTU) or frame size of the link layer is 500 bytes. Determine how many fragments will be
generated.
Each frame can only store 480 bytes (the other 20 Bytes is for the IP header). So we have
ceil(3000/480) = 7 fragments. Each has an ID number of 422. The offset will be 0, 60, 120, 180,
240, 300, 360.
2. The value of HLEN in an IPv4 datagram is 7. How many option bytes are present?

The unit of HLEN is 32 bits (4 bytes). If the HLEN value is 7, the header is 28 bytes in length. The
base header (not including the option field) is 20 bytes. So we have 8 bytes of options.

3. An IPv4 packet has arrived with the first few hexadecimal digits as shown.
45 00 00 28
00 01 00 00
01 02 . . .
How many hops can this packet travel before being dropped? The data belong to what upper-
layer protocol?

Each digit is 4 bits. I’ve re-arranged the digits to match each row of the header. The packet has
a TTL=1. The protocol field has value 02, which corresponds to IGMP
(https://en.wikipedia.org/wiki/List_of_IP_protocol_numbers)

4. In an IPv4 datagram, the M bit is zero, the value of HLEN is 5, the value of total length is 200, and
the offset value is 200. What is the number of the first byte and the number of the last byte in the
datagram? Is this the last fragment, the first fragment or a middle fragment?
Data size is Total Length – Header Length = 200- (4x5) = 180 bytes. Recall that the HLEN is unit
of 4 bytes.

The offset field has value 200. This number is in units of 8 bytes. So the actual offset is 1600
bytes.
The number of last byte is 1600+180-1 = 1779

M=0, offset not zero means it is the last fragment.

5. An IPv4 datagram has arrived with the following information in the header (in hexadecimal):

45 00 00 84
02 03 78 00
11 06 50 11
2B 3E 0F 01
A2 1E 03 03.

Answer the following questions.

(a) What is the length of header? 5x4 = 20 Bytes.


(b) What is the size of the data? 0x84= 132 Bytes. Minus the header length we have 132-
20=112 Bytes.
(c) Are there any options? No options. The header length is exactly 20 bytes (smallest
possible).
(d) Is this datagram fragmented? Can this datagram be fragmented into smaller datagrams?
0x78 0x00 in binary is 01111000 00000000. We have DF=1, means ‘Don’t Fragment’. Not
fragmented because DF=1. If a packet is a fragment, the DF=0 and M will be 1 for the first
fragment and M=0 for the last fragment.
(e) What is the maximum number of routers that this datagram can travel to? 17
(f) Determine whether the header of this datagram is corrupted or not by using checksum.
Show the procedures.
Add all 16 bits as below (row by row), and add any carry. Also, we take the 1s-complement
to get the final result. Note: the header checksum field is zero; i.e., we don’t include the
checksum in the checksum calculation.

4 5 0 0
0 0 8 4
0 2 0 3
7 8 0 0
1 1 0 6
2 B 3 E
0 F 0 1
A 2 1 E
+ 0 3 0 3
1 A F E D

Add the 1 to the sum, we get 0xAFEE. Take the 1s-complement (XOR the sum with 0xFFFF),
we get 0x5011. This matches the value in the checksum field. It is not corrupted.
6. Draw a flow chart of the steps involved when a router receives a distance vector
message from a neighbor. Assume all link cost is 1.

Answer

Receive an update with


multiple route entries from
Rc

Update all cost to include


link cost to Rc

Extract a Route Entry

No
Add entry to Table Destination
Network in Table?

Yes

Yes Update Cost


Next Hop the Same?

No

Yes No
Does Rc offer a lower cost
route to destination?
7. router Ra has the following routing table (assume each link cost is 1)

Network ID Cost Next-Hop


Net1 4 Rb
Net2 2 Rc
Net3 1 Rf
Net4 5 Rg
What happens when Ra receives the following update from Rc.
Net1 2
Net2 1
Net3 3
Net4 7
Now consider Ra with the following table,
Network ID Cost Next-Hop
Net2 6 Ra
Net3 4 Re
Net4 3 Rc
Net6 2 Rb
Net7 8 Rb

What happens when Ra receives the following update from Rc.

Net2 4
Net4 3
Net7 3

Assume all link cost is one. Only Net1 needs to be updated; Net1  3  Rc

Second example, Ra will have to update three route entries:

(i) N2  5  Rc,

(ii) Net7  4  Rc
8. Consider a router with the following routing table. If an IP address 130.130.16.207
arrives, what is the outgoing port?

Network ID Netmask Out Port


130.130.0.0 255.255.0.0 1
130.130.16.0 255.255.255.0 2
130.130.16.192 255.255.255.192 3
130.130.1.0 255.25.255.0 4

Port-3 because it matches more bits (26 bits in total).

9. Consider the following network topology. Describe how the count-to-infinity problem
occurs if nodes use the Bellman-Ford routing protocol. All links have a cost of 1.

A B C D

a. What causes this problem to occur? What’s the solution?


b. How do link-state algorithms solve the count-to-infinity problem?

At time t, node-B and C have the following routing table for node-A. (A, A, 1), and ( A, B, 2)
(destination, next-hop, cost).

Assume that at time t+1, link A—B dies, and causes node-B to delete its route entry A—A—1.
Shortly after, node-C sends a route update which contains (A, 2); i.e., (destination, cost). As a
result, node-B adds this ‘new’ route entry to its table; i.e., (A, C, 3). It accepts this route
because node-B does not know that node-C’s next-hop to A is node-B itself.

Node B then sends a route update containing (A, 3). This is received by node-C, which then
updates its route entry to (A, B, 4). In its next route update, it’ll have (A, 4). Node-B will in turn
update its route entry to (A, 5). The process is repeated and you’ll see that the cost to node-A
slowly counts to infinity.

The reason why this occurs is because nodes do not inform their neighbors the next-hop route
which they used for a given destination.

Link state protocols do not have this problem as every node has a complete map of the
topology, and hence node-B will know that node-C does not have an ‘alternative’ route to
node-A.
10. Using the Dijkstra Algorithm, compute the shortest path tree from node-1.

1 4
2 3
2

3 1
5
2
4 6
5
7
8
4
7

Describe the process which routers use to build a network topology – e.g., how do routers in the
above figure learn the network topology?

T L(2) L(3) L(4) L(5) L(6) L(7)


1 4 Inf Inf 3 Inf Inf
1,5 4 Inf 10 3 Inf Inf
1,5,2 4 6 9 3 Inf Inf
1,5,2,3 4 6 9 3 7 Inf
1,5,2,3,6 4 6 9 3 7 11
1,5,2,3,6,4 4 6 9 3 7 11

1,5,2,3,6,4,7 4 6 9 3 7 11

4 2 3
1 1
2
3 5
6

5 4 4