Computer Networks: cram pack

Formula sheets, the key method steps for every topic and 6 practice problems, with full solutions at the back.

New problemsBack to the course

In the print window, choose “Save as PDF” to keep a copy on your device.

1Formulas and methods

IPv4 subnetting

Hosts per subnet
2(32 − prefix) − 2 (/31: 2, /32: 1)
Block size
256 − (mask octet)
Network address
IP AND mask
Broadcast address
IP OR (NOT mask): all host bits set to 1
Subnets from n borrowed bits
2n

Number systems

Place values
binary 2k, octal 8k, hex 16k
To decimal
Σ dk·bk
From decimal
divide by the base, read the remainders bottom-up
Hex ↔ binary
one hex digit = 4 bits
Two’s complement
invert the bits and add 1

2Practice problems

1.IPv4 subnettingMedium
255.255.255.22411111111111111111111111111100000network bitshost bits

A subnet uses the mask 255.255.255.224. How many usable host addresses H does it have?

255.255.255.224
H =
2.IPv4 subnettingHard

The network 192.168.55.0/24 is split with VLSM for these LANs: A: 26 hosts, B: 21 hosts, C: 6 hosts, D: 5 hosts, E: 11 hosts. Subnets are allocated from .0 upwards, the LAN with the most hosts first, each with the smallest subnet that fits. What is the fourth octet x of the network address of LAN E?

A: 26B: 21C: 6D: 5E: 11
x =
3.Computer networksMedium

What is the IPv6 loopback address?

  1. Afe80::1
  2. B::1
  3. C::
  4. Dff02::1
4.Computer networksHard

A student runs a game server on a PC behind a home NAT router. Friends on the internet cannot connect. What is the usual fix?

  1. AConfigure port forwarding on the router to the PC's private address
  2. BTurn off the PC's DNS client
  3. CChange the PC's subnet mask to /32
  4. DGive the PC a different MAC address so the router can find it from outside
5.Number systemsMedium
place values in two's complement1−12816403211608141211

The 8-bit pattern 1101 0111 stores a signed integer in two's complement. What is its value N in decimal?

1101 01118 bit
N =
6.Number systemsHard
4996 codes, b = ? bits?2ᵇ⁻¹…?4?2?1

A system must give every one of 4996 items its own binary code of the same length. What is the smallest number of bits b needed?

4996
b = bit

3Solutions

1.IPv4 subnetting

Answer: H = 30

IPv4 subnetting: an address has 32 bits. The prefix /p says how many leading bits identify the network; the remaining 32 − p bits number the hosts. A subnet has 2³²⁻ᵖ addresses, but the first (network address) and last (broadcast address) cannot be given to hosts, so 2³²⁻ᵖ − 2 hosts fit. Exceptions: a /31 (point-to-point link, RFC 3021) uses both of its 2 addresses for hosts, and a /32 is one single address (a single host or a loopback).

Prefix length

255.255.255.224 = /27

Usable hosts

25 − 2 = 30

Answer

H = 30
2.IPv4 subnetting

Answer: x = 64

VLSM: each LAN gets the smallest subnet with 2ʰ − 2 ≥ its host count, i.e. prefix 32 − h. Allocating the largest subnets first keeps every block aligned on a multiple of its own size, so the network addresses follow by adding up the block sizes.

Block size per LAN

A: 26 hosts → 25 = 32 (/27)
B: 21 hosts → 25 = 32 (/27)
E: 11 hosts → 24 = 16 (/28)
C: 6 hosts → 23 = 8 (/29)
D: 5 hosts → 23 = 8 (/29)

Allocation, largest first

A: .0 – .31
B: .32 – .63
E: .64 – .79
C: .80 – .87
D: .88 – .95

Answer

x = 64

LAN E: 192.168.55.64/28.

3.Computer networks

Answer: B · ::1

Why this is the answer

::1 is the loopback address. :: is the unspecified address, fe80::/10 is link-local and ff02::1 is the all-nodes multicast group.

Answer

B · ::1
4.Computer networks

Answer: A · Configure port forwarding on the router to the PC's private address

Why this is the answer

NAT creates mappings only for connections started from inside. A port-forwarding rule maps a public port to the internal host so inbound connections can reach it.

Answer

A · Configure port forwarding on the router to the PC's private address
5.Number systems

Answer: N = −41

Positional number systems: each digit is worth its value times a power of the base. In binary the places are worth 1, 2, 4, 8, 16, …; in hexadecimal 1, 16, 256, …, with A–F standing for 10–15. In 8-bit two's complement the leftmost bit is worth −128 instead of +128, which is how negative numbers are stored.

Add the place values

The other bits keep their normal positive values.

−128 + 64 + 16 + 4 + 2 + 1 = −41

Answer

N = −41
6.Number systems

Answer: b = 13 bit

Positional number systems: each digit is worth its value times a power of the base. In binary the places are worth 1, 2, 4, 8, 16, …; in hexadecimal 1, 16, 256, …, with A–F standing for 10–15. In 8-bit two's complement the leftmost bit is worth −128 instead of +128, which is how negative numbers are stored.

Powers of two

212 = 4096 < 4996
213 = 8192 ≥ 4996

Answer

b = 13

ExamProblems · examproblems.com/courses/computer-networks