Design an address plan that survives a merger
Task
Choose an address range for three environments in two regions, plus room for a partner network you may one day have to peer with. The constraint that makes this hard is the one from the lesson: overlapping ranges cannot be peered, and the decision is effectively permanent.
Steps
- In
lab/addressing.md, allocate a range for production, staging and development, in two regions each -- six virtual networks. State the CIDR for each and the number of usable addresses. Also list the six, plus the partner reserve from step 4, inlab/ranges.txt: one per line asname CIDR, for exampleprod-east 10.20.0.0/16. - Inside the production network, carve public and private subnets across three availability zones. Remember the provider reserves several addresses per subnet and show the usable count AFTER that reservation.
- Deliberately avoid
10.0.0.0/16, and write the sentence explaining why the most popular default is the worst choice for a network you may need to peer. - Reserve a range for a future partner or acquisition, and state what you would do if their network overlapped yours anyway.
- Calculate how many more instances each production subnet can hold before address exhaustion, and note that this is the number to monitor.
Verify
grep -Ec '/(1[6-9]|2[0-8])' lab/addressing.md
grep -Eci 'reserv' lab/addressing.md
python3 - <<'EOF'
import ipaddress
rows = [l.split() for l in open('lab/ranges.txt') if l.strip()]
nets = [(r[0], ipaddress.ip_network(r[1])) for r in rows] # ValueError: host bits set
print(len(nets), "range(s) -- need 7: six networks and the partner reserve")
default = ipaddress.ip_network('10.0.0.0/16')
for i, (a, x) in enumerate(nets):
if x.overlaps(default):
print("OVERLAPS 10.0.0.0/16:", a, x)
for b, y in nets[i + 1:]:
if x.overlaps(y):
print("OVERLAP -- these two could never be peered:", a, x, b, y)
EOF
Seven ranges and no OVERLAP line. The overlap is the check that matters: two networks sharing addresses cannot be peered, and grepping for the text 10.0.0.0/16 would not notice a 10.0.1.0/24 that sits inside it anyway. A ValueError means a range was written with host bits set (10.1.0.1/16) -- the network address is the first one in the block.
This is an independent study companion for CompTIA Cloud+ CV0-004 and is not produced by or endorsed by CompTIA.