Networks and the web · A level · AQA 7517 4.9.4.3 · about 30 min
Network and host identifiers, subnet masks with AND, IPv4 and IPv6, public and private addresses.
[1 mark]A host has the address 192.168.10.200 with subnet mask 255.255.255.224. What is its network address?
[1 mark]What does this program print?
address = 0b10110110 mask = 0b11110000 print(address & mask)
[1 mark]How many usable host addresses does a /27 subnet have?
[1 mark]Why was IPv6 introduced?
[1 mark]Which of these are private (non-routable) IPv4 addresses? Choose all that apply.
Tick every answer that is true.
[1 mark]A host with address 10.1.1.5/24 wants to send to 10.1.2.9. What does it do?
The robot has the address 192.168.4.70 with prefix length 26.
Write to_int(address), which turns a dotted IPv4 string into one integer from 0 to 2<sup>32</sup> − 1, and to_dotted(value), which turns such an integer back into a dotted string. Work the mask out from the prefix length, not by typing it. Then print, one per line:
- mask: <dotted mask>
- network: <dotted network address>, the robot's address AND the mask
- broadcast: <dotted broadcast address>, the network address with every host bit set to 1
- hosts: <n>, the number of usable host addresses
Then for each of 192.168.4.100, 192.168.4.130, 172.20.1.9, 8.8.8.8 and 192.168.4.65, in that order, print <address> <where> <kind>: where is local if it is on the robot's subnet and router if not; kind is private if it lies in one of the three private blocks and public otherwise. Use & to find network addresses. That is 9 lines in all. The robot does not drive.
# the two lines every program starts with: the commands, then the robot
from bugbot import *
connect()
def to_int(address):
return 0
def to_dotted(value):
return "0.0.0.0"
robot, bits = "192.168.4.70", 26Plan your program here, then type it in and press Run.
172.16.200.9/21, then check with your program.shorten(ipv6) that removes leading zeros from each group of a full IPv6 address.