com-208: computer networks - homework 5 · 2017. 12. 12. · com-208: computer networks - homework...

3
COM-208: Computer Networks - Homework 5 1. (P11) Consider a datagram network using 8-bit host addresses. Suppose a router uses longest-prefix matching and has the following fowarding table: Prefix Match Interface 00 0 01 1 100 2 otherwise 3 For each of the four interfaces, give the associated range of destination host addresses, and the number of addresses that correspond to that range. 2. You have to use 1.2.3.0/27 to allocate IP addresses for 3 subnets, A, B and C that contain 10, 5, 3 hosts respectively. Use the following ordering to try to allocate the addresses. (a) A, B, C (i.e., largest to smallest) (b) C, B, A (i.e., smallest to largest) (c) B, A, C (Note: you will see that it is not feasible to allocate the address in that order) In the context of this exercise, the order means that if Subnet X comes before Subnet Y, the IP addresses for Subnet X should be arithmetically smaller than the IP addresses for Subnet Y (in the sense that IP address 1.2.3.4 is arithmetically smaller than IP address 1.2.3.5). While assigning addresses, you can make the following assumption: For each subnet, the network address (the first address in a subnet; e.g., the first address in 10.0.0.0/24 is 10.0.0.0) and the broadcast address (the last address in a subnet; e.g., the last address in 10.0.0.0/24 is 10.0.0.255) can be assigned to an interface. Recall that when allocating IP addresses, the following rules are important: Routers forward packets using longest-prefix matching. Thus, all IP addresses in a subnet must be part of the same prefix. If the length of the network mask is L, then the first L bits for every IP address in the same subnet must be identical. The number of IP addresses in a subnet is always a power of 2. Specifically, there are 2 32-L addresses in a subnet with network mask length L. For example, a /24 subnet has 2 32-24 = 256 IP addresses. Subnets must not overlap with each other. 1

Upload: others

Post on 22-Jan-2021

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: COM-208: Computer Networks - Homework 5 · 2017. 12. 12. · COM-208: Computer Networks - Homework 5 1.(P11) Consider a datagram network using 8-bit host addresses. Suppose a router

COM-208: Computer Networks - Homework 5

1. (P11) Consider a datagram network using 8-bit host addresses. Suppose a router uses longest-prefix matchingand has the following fowarding table:

Prefix Match Interface00 001 1100 2

otherwise 3

For each of the four interfaces, give the associated range of destination host addresses, and the number ofaddresses that correspond to that range.

2. You have to use 1.2.3.0/27 to allocate IP addresses for 3 subnets, A, B and C that contain 10, 5, 3 hostsrespectively. Use the following ordering to try to allocate the addresses.

(a) A, B, C (i.e., largest to smallest)

(b) C, B, A (i.e., smallest to largest)

(c) B, A, C

(Note: you will see that it is not feasible to allocate the address in that order)

In the context of this exercise, the order means that if Subnet X comes before Subnet Y, the IP addresses forSubnet X should be arithmetically smaller than the IP addresses for Subnet Y (in the sense that IP address1.2.3.4 is arithmetically smaller than IP address 1.2.3.5).

While assigning addresses, you can make the following assumption:

• For each subnet, the network address (the first address in a subnet; e.g., the first address in 10.0.0.0/24is 10.0.0.0) and the broadcast address (the last address in a subnet; e.g., the last address in 10.0.0.0/24is 10.0.0.255) can be assigned to an interface.

Recall that when allocating IP addresses, the following rules are important:

• Routers forward packets using longest-prefix matching. Thus, all IP addresses in a subnet must be partof the same prefix. If the length of the network mask is L, then the first L bits for every IP address inthe same subnet must be identical.

• The number of IP addresses in a subnet is always a power of 2. Specifically, there are 232−L addressesin a subnet with network mask length L. For example, a /24 subnet has 232−24 = 256 IP addresses.

• Subnets must not overlap with each other.

1

Page 2: COM-208: Computer Networks - Homework 5 · 2017. 12. 12. · COM-208: Computer Networks - Homework 5 1.(P11) Consider a datagram network using 8-bit host addresses. Suppose a router

a

b c

f

g

R1

R3R2d

A

B C

D E

e

Figure 1: Problem 3 topology

3. (P17) Consider the topology shown in Figure 1. There are three subnets (A, B and C) which contain somenetwork hosts, and two subnets (D and E) which contain no network hosts. The green boxes (a, b, c. . . h)denote network interfaces (ports) for routers R1, R2 and R3.

(a) Assign network addresses to each of these six subnets. Your allocation of addresses must adhere to thefollowing constraints:

i. All addresses must be allocated from 214.97.254/23.

ii. Subnet A should have enough addresses to support 250 interfaces.

iii. Subnet B should have enough addresses to support 120 interfaces.

iv. Subnet C should have enough addresses to support 60 interfaces.

v. For the remaining subnets (D and E), each should have enough addresses to support 2 interfaces.

For each subnet, the assignment should take the form a.b.c.d/x.

While assigning addresses, you can make the following assumption:

• For each subnet, the network address (the first address in a subnet; e.g., the first address in10.0.0.0/24 is 10.0.0.0) and the broadcast address (the last address in a subnet; e.g., the last addressin 10.0.0.0/24 is 10.0.0.255) can be assigned to an interface.

(b) Using your answer to part (a), provide the forwarding tables (using longest prefix matching) for eachof the three routers (R1, R2, R3). Each table should contain two columns which show (i) the addressprefix, and (ii) the corresponding outgoing interface (port).

(c) Using the address allocation you provided in part (a), create forwarding tables for routers R1, R2 andR3, such that the new forwarding tables contain the minimum number of rules.

2

Page 3: COM-208: Computer Networks - Homework 5 · 2017. 12. 12. · COM-208: Computer Networks - Homework 5 1.(P11) Consider a datagram network using 8-bit host addresses. Suppose a router

4. (P19) Consider sending an IP payload of 1,600-byte into a link that has an MTU of 500 bytes. Suppose theoriginal datagram is stamped with the identification number 291. How many fragments are generated? Whatare the values in the various fields in the IP datagram(s) generated related to fragmentation?

Figure 2: Problem 5 topology

5. (P21) Consider the network setup in Figure 2. Suppose that the ISP, instead, assigns address 24.34.112.235 tothe router, and that the network address of the home network is 192.168.1.0/24 (this is a private IP addressspace).

(a) Assign addresses to all interfaces in the home network while following the next rule:

• The first and last address in each IP subnet must be reserved for the network and broadcast address,respectively. These two addresses cannot be assigned to any interface.

(b) Suppose each host has two ongoing TCP connections, all to port 80 at host 128.119.40.86. Provide thesix corresponding entries in the NAT translation table.

3