Networking Concepts and Protocols: Homework Solutions

HW 2

1. Why Does UDP Exist?

UDP provides a lightweight transport layer for sending messages without the overhead of TCP’s connection setup, error checking, and flow control.

  • Uses port numbers for multiplexing/demultiplexing, allowing multiple processes to receive data uniquely.
  • Includes a checksum field to detect errors, which raw IP packets do not.
  • Foregoes connection setup and retransmission, making it ideal for latency-sensitive applications like gaming or video streaming.

2. TCP Round-Trip Time (RTT) Estimation

If the TCP round-trip time (RTT) is currently 30 msec and the following acknowledgments come in after 26, 32, and 24 msec, respectively, what are the new RTT estimates? Use α = 0.1.

Formula: Estimated RTT = (1 − α) × Previous RTT + α × Sample RTT

  • After 26 ms: 29.6 ms
  • After 32 ms: 29.84 ms
  • After 24 ms: 29.256 ms

3. TCP Segment Sequence and Acknowledgment Numbers

Suppose Host A sends two TCP segments back to back to Host B over a TCP connection. The first segment has sequence number 90; the second has sequence number 110.

a. How Much Data is in the First Segment?

Sequence numbers: 110 – 90 = 20 bytes.

b. Acknowledgment Number After Lost Segment

Suppose the first segment is lost but the second segment arrives at B. In the acknowledgment that Host B sends to Host A, what will be the acknowledgment number?

The acknowledgment number will be 90. TCP expects data in order and will request the missing segment.

4. Multiple TCP Connections Between the Same Ports

A process on Host 1 has been assigned TCP port p, and a process on Host 2 has been assigned TCP port q. Is it possible for there to be two or more TCP connections between these two ports at the same time?

Yes. TCP connections are identified by: Source IP and port number, Destination IP and port number.

Unique combinations of these values allow multiple simultaneous connections.

5. Converting Hexadecimal IP Address to Dotted Decimal Notation

Convert the IP address whose hexadecimal representation is C22F1582 to dotted decimal notation.

  • Split into bytes: C2, 2F, 15, 82.
  • Rule: A = 10, B = 11, C = 12, D = 13, E = 14, F = 15.
  • Convert to decimal: Multiply rightmost digit by 16^0, next by 16^1, and so on. Sum values.
  • C2 = 12 × 16^1 + 2 × 16^0 = 194
  • 2F = 2 × 16^1 + 15 × 16^0 = 47
  • 15 = 1 × 16^1 + 5 × 16^0 = 21
  • 82 = 8 × 16^1 + 2 × 16^0 = 130

Final Dotted Decimal Notation: 194.47.21.130

6. Maximum Number of Hosts in a Subnet

A network on the Internet has a subnet mask of 255.255.240.0. What is the maximum number of hosts it can handle?

  • Convert to binary:
  • 255 = 11111111
  • 240 = 11110000
  • Binary representation: 11111111.11111111.11110000.00000000
  • Network bits: Count the 1’s (20).
  • Host bits: Remaining bits (32 – 20 = 12).
  • Hosts formula: 2^(Host bits) – 2
  • 2^12 – 2 = 4094

7. Distance Vector Routing

Consider the network in the figure below (nodes are ordered alphabetically). Distance vector routing is used, and the following vectors have just come in to router C:

  • From B: (5, 0, 8, 12, 6, 2)
  • From D: (16, 12, 6, 0, 9, 10)
  • From E: (7, 6, 3, 9, 0, 4)

The cost of the links from C to B, D, and E are 6, 3, and 5, respectively. What is C’s new routing table? Give both the outgoing line to use and the cost.

Step 1: Add link costs to each vector.

  • Via B: (11, 6, 14, 18, 12, 8)
  • Via D: (19, 15, 9, 3, 12, 13)
  • Via E: (12, 11, 8, 14, 5, 9)

Step 2: Take the minimum for each destination (excluding C).

Final costs: (11, 6, 0, 3, 5, 8)

Step 3: Assign outgoing lines for each destination.

Outgoing lines: (B, B, –, D, E, B)

HW 3

1. Aggregating IP Addresses

Question: A router has received the following IP addresses: 57.6.96.0/21, 57.6.104.0/21, 57.6.112.0/21, and 57.6.120.0/21. If all use the same outgoing line, can they be aggregated? If so, to what?

Step-by-Step Solution:

  • Each /21 subnet covers 2^11 = 2048 addresses.
  • The first three octets determine the starting point, and the fourth octet increments in blocks of 2048.
  • Verify contiguity of subnets: These subnets are consecutive because each starts immediately after the previous one ends.
  • Combine four consecutive /21 subnets: 4 x 2048 = 8192 addresses total.
  • 8192 = 2^13, so the new prefix length is 32 – 13 = 19 (/19).

Result: Aggregated prefix is 57.6.96.0/19.

2. Parity Bit Detection

Question: Will a block of n rows of k bits using parity bits detect all single errors, double errors, or triple errors?

Step-by-Step Solution:

  • Single Errors: If one bit changes, the parity of its row and column will fail, detecting the error.
  • Double Errors: If errors occur in the same row, the column parity will detect at least one error. If errors are in different rows and columns, both row and column parity will fail.
  • Triple Errors: Most patterns of triple errors will cause parity inconsistencies, but certain patterns (e.g., forming a triangle) may evade detection.

3. CRC Remainder Calculation

Question: For a generator G = 10011 and data D = 1010101010, what is the remainder R?

Step-by-Step Solution:

  • Append Zeros to D: Add four zeros to D since G has 5 bits: New D = 10101010100000.
  • Perform Mod-2 Division (Binary Division):
  • Start with the leftmost 5 bits of D: 10101. Perform XOR with G = 10011: 10101 XOR 10011 = 00110.
  • Bring down the next bit from D (0), making it 001100. Repeat until all bits are processed.

Result: The remainder is R = 0100.

4. CSMA/CD Protocol Wait Time

Question: For K = 100, how long does the adapter wait for 10 Mbps and 100 Mbps broadcast channels?

Step-by-Step Solution:

  • Calculate Wait in Bits: Wait = K x 512 = 100 x 512 = 51200 bits.
  • For 10 Mbps: Bit time = 1 / (10 x 10^6) = 0.1 microseconds. Total time = 51200 x 0.1 = 5120 microseconds = 5.12 ms.
  • For 100 Mbps: Bit time = 1 / (100 x 10^6) = 0.01 microseconds. Total time = 51200 x 0.01 = 512 microseconds = 0.512 ms.

5. ARP Table and MAC Address Legitimacy

Question: Is it legitimate for the same MAC address to appear in both ARP tables of a router?

Step-by-Step Solution:

  • Each subnet is independent, and the router connects them using distinct interfaces. Each interface has a unique MAC address.

Result: It is not legitimate for the same MAC address to appear in both tables.

6. Extended LAN Packet Forwarding

Question: In an extended LAN connected using switches, determine packet forwarding for the given transmissions.

Step-by-Step Solution:

  • Start with empty hash tables: Switches flood packets to all ports except the incoming port.
  • a. A sends to C: B1 forwards to ports 2, 3, and 4. B2 forwards to ports 1, 2, and 3.
  • b. E sends to F: B2 forwards to ports 1, 3, and 4. B1 forwards to ports 1, 2, and 3.
  • c. D sends to A: B2 forwards to port 4. B1 forwards to port 1.

HW 1

1. Advantages and Disadvantages of Layered Protocols

What are two reasons for using layered protocols? What is one possible disadvantage of using layered protocols?

  • Modularity: Each layer in the protocol is designed to perform a specific task independently. This modularity allows developers to focus on one layer without worrying about the complexity of other layers (also known as abstraction, as the implementation details are hidden and don’t affect layers).
  • Compatibility: Layered protocols allow diverse networks and software to communicate. By having standard protocols at each layer, multiple different systems can be compatible.
  • Disadvantage: Overhead. Each layer in a protocol adds its own processing and coding requirements, resulting in more overhead. This can lead to inefficiencies as data can be encapsulated multiple times, increasing the size and time for transmission.

2. Propagation Delay and Transmission Delay

This problem explores propagation delay and transmission delay in data networking. Consider two hosts, A and B, connected by a single link of rate R bps. Suppose that the two hosts are separated by m meters, and suppose the propagation speed along the link is s meters/sec. Host A is to send a packet of size L bits to Host B.

Answer:

a) Propagation Delay

Propagation Delay (time it takes for a signal to travel from sender to receiver):

Propagation Delay = m / s

Where:

  • m = Distance
  • s = Speed

b) Transmission Time

Transmission Time (time it takes to push all packets onto the link):

Transmission Time = L / R

Where:

  • L = Size of packets
  • R = Transmission Rate

c) End-to-End Delay

End-to-End Delay (total time for a packet to travel from host A to host B):

End-to-End Delay = m / s + L / R

d) Example Calculation

Given:

  • s = 2.5 x 10^8 m/s
  • L = 120 bits
  • R = 56 x 10^3 bits/second (56 kbps)

Step 1: Transmission Time

L / R = 120 / (56 x 10^3) = 2.14 ms

Step 2: Propagation Delay

m = s x t = (2.5 x 10^8) x (2.14 x 10^-3) = 536 km

3. Same Origin Policy

Which of the URLs meet the same origin policy against http://www.example.com/local/index.html?

  1. http://help.example.com/local/index.html
  2. http://www.example.com/dir/index.html?q=100
  3. ftp://www.example.com/dir/index.html
  4. http://www.example.com:8080/local/index.html

Answer:

  1. Does not meet the same origin policy because the subdomain “help.example.com” is different from “www.example.com“.
  2. Meets the same origin policy because the scheme (http), host (www.example.com), and port (default 80) are the same.
  3. Does not meet the same origin policy because the scheme (ftp) is different from http.
  4. Does not meet the same origin policy because the port (8080) is different from the default port 80.

4. A-type Record and TTL of cs.utdallas.edu

Find the value of the A-type record of the domain cs.utdallas.edu and its TTL in the authoritative answer. Briefly explain how you find the answers.

Answer:

A-type Record (IP Address):

  • 3.133.32.155
  • 3.21.250.42

TTL (Time-to-Live):

3600 (time that a packet will move through the network before being discarded).

Explanation:

To find these, I used the command dig cs.utdallas.edu in my terminal. It output the two IPs and the TTL. I also used an online DNS lookup tool to double-check the values for accuracy.