Intelligent Systems Engineering Department
The National School of Artificial Intelligence
3rd Year, Semester 1 — 2024/2025
NETWORKS AND PROTOCOLS
Exercises Sheet 3
Exercise 1
The diagram below shows two residential networks with routers that implement NAT and a
remote server with a public internet address.
Left-hand router Right-hand router
Internal (IP, port) External port Internal (IP, port) External port
The packet header diagrams below are for a packet from a host in the left-hand network,
going to the server. The first shows the header when the packet arrives at the router, the second
shows it when the packet leaves the router.
Source address Destination address Source port Destination port
10.1.1.1 4.3.2.1 5555 3333
3.7.5.7 4.3.2.1 8888 3333
1. Add an entry to the left-hand NAT table that is consistent with these two packet headers.
2. What is the public IP address of the left-hand router?
3. The three header diagrams below are for a packet from a host in the right-hand network,
going to a host in the left-hand network. Fill in the blank fields. Add entries to the two
NAT tables that are consistent with this sequence of packet headers.
Copyright © Prof. A. Bachir, Dr. A. Bensalem, Dr. Djouama, Dr. Lagraa, and Dr. Lounis, 2024/2025.
Source address Destination address Source port Destination port
10.1.1.4 1212 7878
5.3.5.2 5454 7878
5.3.5.2 10.1.1.2 5454 6565
4. What is the public IP address of the right-hand router?
5. In the diagrams below, fill in the header fields that would be used by a response to the
last packet, (the response goes from the right hand network to the left).
Source address Destination address Source port Destination port
Exercise 2
A network address translation system uses a public address to offer Internet access to 15
workstations. What is the maximum number of TCP connections on port 80 of the Web server
128.178.50.137 (which is outside the internal network) that can be supported by the NAT?
Exercise 3
The figure below (Topology 1) illustrates how Network Address Translation (NAT) works.
Consider a similar topology (Topology 2), but suppose that the NAT gateway has external IP
address 24.34.112.235, while the private IP address space is 192.168.1.0/24.
NAT translation table
WAN side LAN side
138.76.29.7 : 5001 10.0.0.1 : 3345
... ...
Copyright © Prof. A. Bachir, Dr. A. Bensalem, Dr. Djouama, Dr. Lagraa, and Dr. Lounis, 2024/2025.
Topology 2:
NAT translation table
WAN side LAN side
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
1. Complete Topology 2 by assigning IP addresses to all interfaces (labels A, B, C, and D)
in the internal (private) network.
2. Suppose that each end-system has two ongoing TCP connections, all to IP 128.119.40.86,
port 80. Provide the six corresponding entries in the NAT translation table.
Exercise 4
Let us assume a router has a single public address 138.76.29.7 which it uses for all communi-
cation with hosts that are not part of the private network. The router multiplexes its public IP
address(es) as needed and keeps track of the multiplexing in a NAT translation table.
Assume that the router multiplexes the public address using ports starting from 8000 and then
incrementing by one. For example, if a host in the private network with address 10.0.0.5:5000
sends a message to 132.239.8.45:80 then the entry in the NAT table would be filled in as below.
The next time the router will use 8001 as the port to establish a new connection and so on.
What would be the entries in the NAT Translation Table at the end of the following events:
• 10.0.0.6:5000 sends a message to 74.125.239.33:80
• 10.0.0.10:6000 sends a message to 204.79.197.200:80
Copyright © Prof. A. Bachir, Dr. A. Bensalem, Dr. Djouama, Dr. Lagraa, and Dr. Lounis, 2024/2025.
• 10.0.1.101:6001 sends a message to 206.190.36.45:80
• 10.0.0.10:6000 sends another message to 204.79.197.200:80
• 10.0.1.101:6001 sends a message to 74.125.239.33:80
• 10.0.0.7:7000 sends a message to 63.245.215.20:80
• 204.79.197.200:80 sends a message to 10.0.0.10:6000
• 206.190.36.45:80 sends a message to 74.125.239.33:80
NAT translation table
WAN side LAN side
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
Copyright © Prof. A. Bachir, Dr. A. Bensalem, Dr. Djouama, Dr. Lagraa, and Dr. Lounis, 2024/2025.