You are on page 1of 6

Solution to the Exercises of Lecture 3

Question 1: What is the total number of class B addresses available for assignment to individual hosts if
no subnetting is used? If subnetting is allowed (assuming a non-zero number of bits for the subnet ID),
what is the maximum number of hosts allowed? What is the value of the subnet mask corresponding to
the point at which this maximum is reached.
14 16
Answer: The number of allowed class B networks is 2 – 2 , with each network having 2 – 2 hosts.
The -2 applies to the all ones number and the all zeros number. These are disallowed. See book on page
42 for the statement that all zeros is disallowed for host IDs. The IP specification states this for net IDs.
By extrapolation, we assume that even subnet IDs cannot be all zeros. The book states that all ones is not
allowed for netid, subnet ID or host ID because this represents the broadcast cases. Therefore the total
number of class B addresses available for assignment to individual hosts if no subnetting is allowed is
14 16
(2 – 2)(2 – 2) .
If subnetting is allowed, let the number of bits dedicated for the subnet ID vary from 1 to 15 (since the
problem states that only non-zero number of bits should be considered for the subnet ID)fs. Only the
number of hosts/subnet and number of subnets is considered for different sizes of the subnet ID since the
number of networks is the same.
One approach to solving this is the brute-force approach as shown in the table determining the number of
addresses available for individual hosts/network. Note that a subnet ID of all ones cannot be used to iden-

Number of addresses available for


Bits for subnet ID
individual hosts/network

1, 15 15
(2 – 2 ) ( 2 – 2 ) =0
2, 14 14 2
(2 – 2 ) ( 2 – 2 ) =32764
3, 13 13 3
(2 – 2 ) ( 2 – 2 ) =49140
4, 12 12 4
(2 – 2 ) ( 2 – 2 ) =57316
5, 11 11 5
(2 – 2 ) ( 2 – 2 ) =61380
6, 10 10 6
(2 – 2 ) ( 2 – 2 ) =63364
7, 9 9 7
( 2 – 2 ) ( 2 – 2 ) =64512
8, 8 8 8
( 2 – 2 ) ( 2 – 2 ) =64516

tify a subnet since it is used for all subnets-directed broadcast to a netid.


A second approach is to determine the maximum point using derivatives. If x is the number of bits for the
x 16 – x
subnet ID, the number of hosts per network is (2 – 2)(2 – 2 ) . Finding the point x at which the
16 – x
d( 2x – 2 )( 2 – 2)
number of hosts is a maximum, -------------------------------------------------- = 0 . Solving this yields x=8. With 8 bits per
dx

1
14 14
subnet ID, the total number of hosts is 64516 × ( 2 – 2 ) since there are 2 – 2 networks.
Question 2: In the network shown below, Host H 1 sends a UDP datagram destined to host H 2 , and
another one to host H 3 , and host H 2 sends a UDP datagram to host H 4 .

135.180.186
.6 .1 (255.255.255.0) .2 H3
135.180.50 R3 Ethernet
(255.255.255.0) .2 135.180.163
.10 (255.255.255.0)
PPP link .3 .1 .2
.25 Ethernet
H4
(low delay) 135.180.193 R4
.43
.34 Ethernet (255.255.255.0)135.180.140 .5 135.158.34
H1 R1 (255.255.255.0) (255.255.255.0)
Ethernet
Ethernet .57 IEEE 802.3/802.2
135.180.64 .59
.23 Ethernet
.21 H2
(255.255.255.0) 135.180.110
.11 R2 .l0
(255.255.255.0) 135.180.103
(255.255.255.0)

The Time-To-Live field is set to 3 for each IP datagram generated. The UDP datagram header
is 8 bytes long and the IP header is 20 bytes long for each datagram. The forwarding data
tables in the four IP routers are shown below :

Table 1: Forwarding database at IP router R1

Destination IP address Next hop IP


Subnet Mask
address
Net ID Subnet ID Host ID

135.180 135.180.50.6
135.180 50 255.255.255.0 135.180.50
135.180 64 255.255.255.0 135.180.64
135.180 110 255.255.255.0 135.180.110

Table 2: Forwarding database at IP router R2

IP address Next hop IP


Subnet Mask
address
Net ID Subnet ID Host ID

135.180 103 255.255.255.0 135.180.103


135.180 110 255.255.255.0 135.180.110
135.180 193 255.255.255.0 135.180.193
135.180 140 255.255.255.0 135.180.140
Default 135.180.110.23

2
Table 3: Forwarding database at IP router R3

IP address
Subnet Mask Next hop IP address
Net ID Subnet ID Host ID

135.180 50 255.255.255.0 135.180.50


135.180 193 255.255.255.0 135.180.193
135.180 186 255.255.255.0 135.180.186
135.180 163 255.255.255.0 135.180.163
135.180 103 21 255.255.255.0 135.180.193.57
Default 135.180.163.3

Table 4: Forwarding database at IP router R4

IP address Next hop IP


Subnet Mask
address
Net ID Subnet ID Host ID

135.180 50 255.255.255.0 135.180.163.2


135.180 163 255.255.255.0 135.180.163
135.180 140 255.255.255.0 135.180.140
135.158 34 255.255.255.0 135.158.34
Default 135.180.140.59

Answer the following questions:


a. What route do the three datagrams take (list the hosts and routers through which the
datagrams pass)?

Host H 1 to host H 2 datagram does not reach its destination. It starts by taking the
route H 1 – R1 – R 3 – R 2 , however it will be dropped at R 2 because the TTL becomes
1 and any router drops datagrams with TTL of 0 or 1 (see page 98 of your textbook).

Host H 1 to host H 3 datagram takes the route H 1 – R1 – R3 – H 3 .

Host H 2 to host H 4 datagram also does not reach its destination. It starts by taking the
route H 2 – R 2 – R1 , but will get dropped at R1 because R 1 has no routing data for
the destination host.

3
b. Is the routing data provided loop-free? Are there any “unreachable addresses” for dat-
agrams generated by any of the hosts shown in the figure, i.e., is it possible that one of
the hosts sends a datagram to some destination that will never reach the destination.
Assume a TTL of 16 to answer this question.

The routing data has a loop for all 135.180 subnets other than subnets of this netid
shown in the figure. Trace the path for 135.180.xx generated by a host attached to any
router and test this. Also test datagrams generated for the 135.180 subnets shown in
the figure. They should get through loop free.

Besides the above described unreachable addresses resulting from loops, other
unreachable addresses are addresses with any netid other than 135.180. This is
because there is no default entry at R1 , and default for R3 leads to R 4 which leads to
R2 which leads to R 1 , at which point all such datagrams will be dropped.

Question 3: Assume Host H 1 sends a UDP datagram to host H 2 whose payload is 2000 bytes long. List
IEEE 802.3/802.2 PPP link
LAN (low delay) ethernet
H1 R1 .5 135.180.21 .3 R2 .3 .1 H2
.2 135.180.20 .5 135.180.22

the total length, identification, more bit of the flags, fragment offset, source and destination IP addresses
and TTL fields in the IP header, the length of the UDP header and the length of the IP payload for each of
the datagrams carried on each of the three links in the figure above. Use MTUs listed in Figure 2-5 of
your textbook (page 30) for the various LANs and assume that the IP header size is 20 bytes long and the
UDP header is 8 bytes long, and that host H 1 places a TTL of 16 on its datagrams. (Hint: Don’t forget all
the headers involved).
Answer:
MTU for the IEEE 802.3/802.2 link is 1492 bytes, MTU for the PPP link (low delay) is 296 bytes and
MTU for ethernet is 1500 bytes.
The fragment offset is in 8-byte units - see page 149 of textbook. Since the MTU for 802.3/802.2 link is
1492, remove 20 bytes for IP header, this leaves 1472 for IP payload (of which 8 bytes are UDP header).
Since the first IP payload is 1472 bytes long this is equal to 184 in 8-byte units, which the fragment offset
in the second fragment. The UDP header is only present in the first IP fragment. In the subsequent frag-

Table 5: List of IP datagrams

IP header (20 bytes) UDP IP


header Payload
Total More Fragment Source IP Destination (size in (size in
Identification
length bit offset address IP address bytes) bytes)

From H 1 to R1 :

1492 1 1 0 135.180.20.2 135.180.22.1 8 1472

4
Table 5: List of IP datagrams

IP header (20 bytes) UDP IP


header Payload
Total More Fragment Source IP Destination (size in (size in
Identification
length bit offset address IP address bytes) bytes)

556 1 0 184 135.180.20.2 135.180.22.1 0 536

From R1 to R 2 :

First, we list the fragments created from the first IP datagram (of 1492 bytes) received at R 2

292 1 1 0 135.180.20.2 135.180.22.1 8 272


292 1 1 34 135.180.20.2 135.180.22.1 0 272
292 1 1 68 135.180.20.2 135.180.22.1 0 272
292 1 1 102 135.180.20.2 135.180.22.1 0 272
292 1 1 136 135.180.20.2 135.180.22.1 0 272
132 1 0 170 135.180.20.2 135.180.22.1 0 112

Next, we list the fragments created from the second IP datagram (of 556 bytes) received at R 2

292 1 1 184 135.180.20.2 135.180.22.1 0 272


284 1 0 218 135.180.20.2 135.180.22.1 264

From R2 to H 2 , the same number of datagrams with the same fields are sent as from R 1 to R2
because once a datagram is fragmented, it is not put together until the destination is reached. Also,
since the ethernet MTU is 1500, which is larger than 296, no further fragmentation occurs.

ment, it is not present and hence has been shown as 0 bytes. Since the first fragment only has 1464 of data
payload, the remaining 2000-1464=536 is in the second fragment. The total length field in the IP header
is 536+20 = 556 bytes.
For the PPP link, the MTU 296 - 20 bytes for IP header yields an IP payload of 276. This is not divisible
by 8 and since the data portion of fragments have to be multiple of 8-byte units, the IP payload can only
be 272 bytes for all but the last fragment. The size of the IP payloads in the fragments for the first IP dat-
agram should add up to 1472 bytes.
In the second set of fragments on the PPP link, the identification is 1, since these are fragments of the
same datagram sent by the sender. The ID field needs to be the same to allow for reassembly. Also, the
fragment offset needs to be relative to the original datagram and hence the fragment offset of the frag-
ments resulting from further fragmentation of the second fragment need to start with 184. The UDP
header is 0 bytes since the UDP header bytes were sent in first fragment of the first datagram received at
R1 .
Question 4: Is the subnet mask 255.255.0.255 valid for a class A address?
Answer:

5
It is valid and is called a noncontiguous subnet mask since the 16 bits for the subnet mask are not contig-
uous. The RFCs, however, recommend against using noncontiguous subnet mask.
Question 5: Consider the IP address 115.190.134.45 with a subnet mask of 255.255.192.0. Identify the
class of this IP address. How many bits are in the netID, subnetID, hostID? What are the values of these
three, netID, subnetID, hostID, expressed in binary notation?
Answer: It is a class A address since the first byte is 115 (less than 128; see page 8 of textbook).
netID: 7 bits; subnet ID: 10 bits (the second byte and the first two bits of the third byte, since the third
byte of the subnet mask is 192); hostID: 14 bits (the last six bits of the third byte and the fourth byte).
netID = 111 0011 (equal to 115).
subnetID = 1011 1110 10 (the first 8 bits is equal to 190, and the last two bits are 10 since the first two
bits of 134 are 10).
subnet ID = 00 0110 0010 1101 (the first 6 bits are the last six bits of 134, and the last byte is 45).

You might also like