Networks and the web · A level · AQA 7517 4.9.4.7 · about 30 min
How a device gets its address, and how a router shares one public address with a whole network.
[1 mark]Put the DHCP messages in the order they are sent.
Number the lines 1 to 4 to put them in the right order.
OfferAcknowledgeDiscoverRequest[1 mark]Which settings does a DHCP server typically give a device? Choose all that apply.
Tick every answer that is true.
[1 mark]When a packet leaves a home network through a router using NAT, what does the router change?
[1 mark]Why is NAT used? Choose all that apply.
Tick every answer that is true.
[1 mark]A student runs a game server at 192.168.1.40 on their home network. What lets friends on the Internet connect to it?
[1 mark]What does this program print?
table = {}
next_port = 50000
for socket in ['192.168.1.5:3000', '192.168.1.6:3000', '192.168.1.5:3000']:
if socket not in table:
table[socket] = next_port
next_port = next_port + 1
print(socket, '->', table[socket])The Router on this mat is a DHCP server that talks over the radio in a simplified form of DORA. Messages are words separated by single spaces.
1. Send DISCOVER.
2. The Router replies OFFER <address> <mask> <gateway> <lease seconds>. Print offered <address>.
3. Send REQUEST <address>, using the address from the offer.
4. The Router replies ACK <address> <mask> <gateway> <lease seconds>. From the ACK, print address: <address>, then gateway: <gateway>, then lease: <hours> hours, where hours is the lease in seconds divided by 3600 as a whole number.
Check messages() every 0.1 s while you wait for each reply. Read every value from the replies; the robot does not drive.
# the two lines every program starts with: the commands, then the robot
from bugbot import *
connect()
send("DISCOVER")
wait(1)
print(messages())Plan your program here, then type it in and press Run.