solution

advertisement
vFaculty of Arts & Sciences
Department of Computer Science
CMPS 284—Computer Networks
Fall 2004–2005
Charles-Afif Abdul Wahab 200200676
Rabee Saraeeb 200201918
Problem A:
Net 1:
Dotted Decimal
Net 1: 170.60.40.128/25
H 1: 170.60.40.129/25
H2: 170.60.40.130/25
H3: 170.60.40.131/25
I1: 170.60.40.254/25
32-bit Binary Number
10101010.00111100.00101000.10000000
10101010.00111100.00101000.10000001
10101010.00111100.00101000.10000010
10101010.00111100.00101000.10000011
10101010.00111100.00101000.10000110
Net 2:
Dotted Decimal
Net 2: 155.32.0.0/24
H4: 155.32.0.1/24
H5 155.32.0.2/24
I 2: 155.32.0.254/24
32-bit Binary Number
Net 3:
Dotted Decimal
Net 3: 122.50.60.0/29
H6: 122.50.60.1/29
H7: 122.50.60.2/29
H8: 122.50.60.3/29
I3: 122.50.60.6/29
I4: 122.50.60.5/29
32-bit Binary Number
01111010.00110010.00111100.00000000
01111010.00110010.00111100.00000001
01111010.00110010.00111100.00000010
01111010.00110010.00111100.00000011
01111010.00110010.00111100.00000110
01111010.00110010.00111100.00000101
Net 4:
Dotted Decimal
Net 1: 192.60.30.32/28
H9: 192.60.30.33/28
H10: 192.60.30.34/28
H11: 192.60.30.35/28
I5: 192.60.30.46/28
32-bit Binary Number
11000000.00111100.00011110.0010-0000
11000000.00111100.00011110.001-00001
11000000.00111100.00011110.0010-0010
11000000.00111100.00011110.0010-0011
11000000.00111100.00011110.0010-1110
Net 5:
Dotted Decimal
Net 5: 194.62.0.0/16
H12 : 194.62.0.1/16
H13: 194.62.0.2/16
I6 : 194.62.255.254/16
32-bit Binary Number
11000010.00111110.00000000.00000000
11000010.00111110.00000000.00000001
11000010.00111110.00000000.00000010
11000010.00111110.11111111.11111110
Exercise 2:
R1:
Destination Network
Net 1: 170.60.40.128/25
Net 2: 155.32.0.0/24
Net 3: 122.50.60.0/29
Net 4: 192.60.30.32/28
Net 5: 194.62.0.0/16
Mask Address
255.255.255.10000000
255.255.255.0
255.255.255.11111000
255.255.255.11110000
255.255.0.0
Next Hop
Direct
Direct
Direct
I4
I4
R2:
Destination Network
Net 1: 170.60.40.128/25
Net 2: 155.32.0.0/24
Net 3: 122.50.60.0/29
Net 4: 192.60.30.32/28
Net 5: 194.62.0.0/16
Mask Address
255.255.255.10000000
255.255.255.0
255.255.255.11111000
255.255.255.11110000
255.255.0.0
Next Hop
I3
I3
Direct
Direct
Direct
Exercise 3.1:
R1:
I1
IP Address
H1: 170.60.40.129
H2: 170.60.40.130
H3: 170.60.40.131
I4: 122.50.60.5
I6: 155.32.0.254
Hardware Address
h1
h2
h3
i4
i6
I2:
IP Address
H4: 155.32.0.1
H5: 155.32.0.2
I1 : 170.60.40.254
I4: 122.50.60.5
Hardware Address
H4
H5
i1
i2
I3
IP Address
H6: 122.50.60.1
H7: 122.50.60.2
H8: 122.50.60.3
Hardware Address
h6
h7
h8
R2:
I4:
IP Address
H6: 122.50.60.1
H7: 122.50.60.2
H8: 122.50.60.3
I4: 192.60.30.46
Hardware Address
h6
h7
h8
i4
I5:
IP Address
H9: 192.60.30.
H10: 192.60.30.
Hardware Address
h10
h9
H11: 192.60.30.
I6: 194.62.255.254
h11
i6
I6:
IP Address
H12: 194.62.0.1
H13: 194.62.0.2
I5 : 192.60.30.46
Hardware Address
h12
h13
i6
Exercise 3.2:
H1 H13
H1 -> R1
Source
h1
R1 -> R2
Source
i3
Destination
i1
Source IP
170.60.40.129
Destination IP
194.62.0.2/16
Destination
i4
Source IP
170.60.40.129
Destination IP
194.62.0.2/16
Destination
h13
Source IP
170.60.40.129
Destination IP
194.62.0.2/16
Source
h13
Destination
i6
Source IP
194.62.0.2/16
Destination IP
170.60.40.129
R2-> R1
Source
i4
Destination
i3
Source IP
194.62.0.2/16
Destination IP
170.60.40.129
R1 -> h1
Source
i3
Destination
h1
Source IP
194.62.0.2/16
Destination IP
170.60.40.129
R2-> H13
Source
I6
H13 to H1:
H13 R2
Exericse 3.3
Maximum data transmitted = 1018 bytes, Header = 70 bytes Trailer= 4 bytes
Minimum Data Transmitted = 49 bytes
Largest frame = 1018 +70 +4 = 1092 bytes
% over head = 70/1092 x100 = 6.41%
Smallest frame = 49 + 70 +4 = 116
% over head = 70/116 x 100 =60.34 %
Exercise 3.4.1:
Application layer = 16 bits
Tcp layer = 20 bits
Message size = 3096 +16 +20 = 3132
IP datagram overhead = 20 bytes IP header + 18 bytes for frame header and CRC\
Fragments:
Fragment
Length
Offset
MF
1
2
3
4
996
996
996
224
0
122
244
366
1
1
1
0
Exercise 3.4.2:
The TCP header is added only 1 time, and will be treated as IP data in the later frames,
thus it is 36 bytes
Overhead = 20(IP) + 14 (TCP)+4 (CRC)= 38 bytes
For 4 fragments: Overhead = (4*38 +36 )/ (3096+188) = 5.725 %
Problem C
1,A
3, A
5, A
3,
A
2, A
Distance Route: B->C->D->E->F
Problem D
Host A is connected to host B via a single link of m meters and a link bandwidth of R
bps. Suppose thepropagation speed on the link is s meters/sec. Host A is to send a packet
of L bits to host B.
a. Express the propagation delay, dprop, in terms of m and s.
dprop = time taken for packet to travel = m/s
b. Express the transmission time of the packet, dtrans, in terms of L and R.
Bandwidth = R bps Size of packet = L  dtrans =R/L seconds
c. Ignore processing delay and queuing delay, determine the end-to-end delay between
host A and host B.
d end to end =( m / s + L / R ) seconds.
d. Suppose Host A begins to transmit the packet at time t=0. At time t= dtrans, where is
the last bit of the packet.
The bit is just leaving Host A.
e. Suppose dprop is less than ttrans, , where is the first bit of the packet at time t= dtrans.
The first bit has reached Host B.
f. Suppose s = 3x108 meters/sec, L = 1000 bits, and R = 56 Kbps, find the distance m so
that dprop = ttrans.
M= L/R x S = 100 / 56000 x 3x 108 =535714.2857
Problem E
Suppose that host A is connected to a router R1, R1 is connected to another router, R2,
and R2 is connected to host B. Suppose that a TCP message that contains 900 bytes of
Data and 20 bytes of TCP header is passed to the IP code at host A for delivery to B.
Show the total length, Identification, DF (1 bit in flags that stands for don’t fragment),
MF (1 bit in flags stands for more fragment), and fragment offset (in 8 byte units) fields
of IP header in each packet transmitted over the three links. Assume that A-R1 can
support a maximum frame size of 1024 bytes including a 14 byte frame header, link R1R2 can support a maximum frame size of 512 bytes, including an 8 byte frame header,
and link R2-B can support a maximum frame size of 512 including 12 byte frame header.
At A:
Max Frame size = 1024 bytes (<900 +20)
Frame header max size =14
DF bit = 1 don’t fragment
MF =0 no more fragments
Fragment offset is empty
Only 1 frame contains all the necessary data
R1-R2 :
Max frame size = 512 bytes
Frame header max size = 8 bytes
First frame:
DF bit = 0 fragment
MF = 1 more fragments
Fragment offset must be equal to 1 (first fragment)
Fragment 1 is contains 512 bytes with 501 bytes in the data section (11 bytes header, 1
for the FLAG bit which is 0) considering no trailer is needed.
Frame 2:
DF bit = 1
MF = 0 no more fragments
Fragment offset is equal to 2 (second fragment)
Flag is last fragment.
Fragment 2 is contains 512 bytes with 399 bytes in the data section (11 bytes header,
FLAG is set to 1 to signal last fragment) considering no trailer is needed.
The intermediate router does not assemble the fragments but forwards them directly to
the destination.
Problem F
1. Suppose that instead of using 16 bits for the network part of class address originally,
20 bits had been used. How many class B would there have been?
In class B there are 2 unused bits, hence the network part = 14 bits 
212-2 (=4094) possible hosts.
If we exclude the initial two bits, there would be 220-2 (=1048574) possible networks with
210-2 (=1022) possible hosts:
2. Convert the IP address whose hexadecimal representation is C22F1582 to dotted
decimal notation.
194.47.21.130 (Class C)
3. A network on the Internet has a subnet mask of 255.255.240.0 what is the
maximum number of hosts it can handle?
212 = 4094. (2 = broadcast address + router address)
Exercise 4:
2n = H

Host
A
B
C
D
H
4000
7000
8000
9000
N
12
11
12
13
For A, we allocate 12 bits for host number.
Host
A
Subnet
Mask
255.255.240.0 198.16.0.0/20
Start Address
192.16.0.0
End Address
192.16.15.159
B
255.255.240.0 198.16.0.0/21
198.16.16.0
198.16.23.207
C
255.255.240.0 198.16.0.0/20
198.16.24.0
198.16.79.159
For Subnet 255.255.224.0
A
255.255.224.0 198.16.0.0/19
198.16.0.0
198.16.15.159
B
255.255.224.0 198.16.0.0/19
198.16.32.0
198. 16.39.207
C
255.255.224.0 198.16.0.0/19
198.16.64.0
198.16.79.159
D
255.255.224.0 198.16.0.0/19
198.16.96.0
198.16.127.63
5. What is the advantage or disadvantage of using INADDR_ANY instead of the IP
address of the computer running the server?
To allow a server to operate on a multi-homed host, the socket API includes
INADDR_ANY that allows a server to use a specific port at any of the computer’s IP
addresses. The advantage is that the sender doesn’t need to specify the address with each
message. The disadvantage of this is overhead, since each destination should examine the
message and process whether it is destined to it or not (i.e. which IP address should
receive it).
Problem G
A router has the following (CIDR) entries in its routing table:
Address/mask next hop
135.46.56.0/22 interface 0
135.46.60.0/22 interface 1
192.53.40.0/23 router 1
default router 2
For each of the following IP addresses, what does the router do if packet with that
address arrives?
(a) 135.46.63.10
(b) 135.46.57.14
(c) 135.46.52.2
(d) 192.53.40.7
(e) 192.53.56.7
Address/Mask
Binary Address
135.46.56.0/22
1000 0111 0010 1110 0011 10 00 0000 0000
135.46.60.0/22
1000 0111 0010 1110 0011 11 00 0000 0000
192.53.40.0/23
1100 0000 0011 0101 0010 100 0 0000 0000
Hops:
Address
135.46.63.10
135.46.57.14
135.46.52.2
192.53.40.7
192.53.56.7
Binary Equivalent
1000 0111 0010 1110 0011 11 11 0000 1010
1000 0111 0010 1110 0011 10 01 0000 1110
1000 0111 0010 1110 0011 01 00 0000 0010
1100 0000 0011 0101 0010 100 0 0000 0111
1100 0000 0011 0101 0011 100 0 0000 0111
Problem H (from the textbook)
Delivery
Interface 1
Interface 0
Router 2.
Router 1.
Router 2
Chapter 15: 15.6
How much data can be present on an original Ethernet segment at one time? To find out, compute the
delay-throughput product. The original Ethernet operated at 10 Mbps and a segment was limited to 500
meters. Assume the signals propagate down the cable at 66% of speed of light?
Chapter 17: 17.7
Layer 5: Application
Layer 4 : Transport
Layer 3 : Internet
Layer 2: Network
Interface
Layer 1: Physical
Layer 4
Layer 3
Layer 2
Layer 1
Layer 5
Layer 4
Layer 3
Layer 2
Layer 1
20.7:
A datagram with one 8-bit option and one 8-bit data value will have the value 6 in H.Len and the value 25
in Total Length
20.8:
Each router that handles a datagram decrements the TIME TO LIVE by 1, and the value
for TTL is between 1 and 255, so if the counter reaches zero, the datagram is discarded
and an error message is sent back to the source. So, after looping several times the
datagram will die and never reach D.
21.3:
Senders seldom use small datagrams to avoid fragmentation because it is more efficient
to send large datagrams (less processing , less overhead used by packet headers ) Senders
typically depend on routers to use fragmentation only for those datagrams that traverse
networks with small MTUs, rather than for every datagram
21.4 :
Each fragment must contain a multiple of 8 data bytes from the original datagram,
because the fragment offset is shifted right 3 bits before being stred in the FRAGMENT
OFFSET field. Thus, because the most data bytes that can appear in an IP datagram is
65,515 (the TOTAL LENGTH field is limited to 65,535 and the smallest valid header is
20 bytes long), the most fragments that can result from a single datagram is 65,515/8 =
8,190
21.5:
The destination identifies the datagram to which a fragment belongs by the
IDENTIFICATION field and the source address field . All fragments have their
IDENTIFICATION field set to the same value as the original datagram, so all fragments
from a given source with the same value in te IDENTIFICATIOn field must have come
from the same original datagram.
23.2:
When send a ping message to a broadcast address 2 scenarios can occur:
1. The broadcast address will behave normally and forward the ping message to all
host on the network, thus according to ICMP protocol, all hosts must send an echo
reply.
2. The broadcast address will forward the message to all hosts on the network : all
host will send an echo reply, but before the sender of the ping message is able to
process all the echo replies, the TTL of some of the replies will have reached 0
and thus making the sender think that these few host are offline.
24.1 :
The default send buffer size for UDP sockets is 65535 bytes. The default receive buffer
size for UDP sockets is 2147483647 bytes. The UDP software usually allows the sender
and receiver to declare the maximum UDP message size the are each one is willing to
accept.
24.2:
Since the largest common Ethernet frames are of size 1500 bytes, and 6 byte dest addr , 6
byte src addr, 2 byte length/type and 4 byte CRC then the maximum size of a UDP
message in an Ethernet frame is 1500 –(46+4) = 1450 bytes.
24.3:
8k = 8x 1024 bits
Size of UDP frame = 32 bits
# of frames = 8x 1024 /1500 = 516 frames
25.4:
The duplicated FIN message can only affect a new connection if the new connection
reuses the same port numbers on the port and the destination, Otherwise, the FIN
message will not be associated with the TCP for the new connection and will not be
processed as part of the new connection. The host waits two maximum segment lifetimes
before reusing the port from the old connection. This delay time ensures that any
duplicated FIN message will have exceeded the TTL and will have been discarded prior
to reusing the old port number, and the duplicated FIN message cannot affect any new
connections. The probability is extremely low because the new connection would need to
have identical source and destination addresses, protocol port numbers, and TCP
sequence numbers. As long as both computers followed the TCP standard . a new
connection could not be established in which all those items were the same.
Download