Skip to content

Lab 3: Networking Fundamentals

Field Value
Tier 1 — Foundations
Estimated Time 30 minutes
Prerequisites Docker, basic Linux networking
Auto-Grade Yes

Scenario

Your company runs a microservices stack using Docker Compose on a staging server. After a weekend maintenance window, the networking between services is completely broken. The frontend cannot reach the API server. The API server cannot resolve the database hostname. There is a firewall rule blocking traffic on a critical port. One container has an MTU mismatch causing packet fragmentation and timeouts. And the routing table on one container has a blackhole route eating traffic.

The developers are blocked and cannot deploy to staging until you fix the network. The services are: a web frontend (nginx), an API server (Node.js), and a PostgreSQL database. They should all communicate over a shared Docker bridge network, but right now, almost nothing works.

Objectives

  • Create the Docker bridge network lab-net if it does not exist
  • Ensure all three containers are attached to lab-net
  • Fix DNS resolution between containers (API can resolve db hostname)
  • Remove the iptables rule blocking port 5432 on the db container
  • Fix the MTU on the api container to match the network (1500)
  • Remove the blackhole route on the frontend container

Setup

./setup.sh

Creates three containers with broken networking under Docker.

Hints

Hint 1: Docker networks Use `docker network create lab-net` and `docker network connect lab-net `. Check with `docker network inspect lab-net`.
Hint 2: DNS between containers Docker's embedded DNS only works on user-defined networks, not the default bridge. Containers must be on the same user-defined network to resolve each other by name.
Hint 3: Checking iptables rules Use `docker exec iptables -L -n` to see rules, and `docker exec iptables -D INPUT -p tcp --dport 5432 -j DROP` to remove.
Hint 4: MTU settings Check MTU with `docker exec ip link show eth0`. Change with `docker exec ip link set eth0 mtu 1500`.
Hint 5: Routing blackholes Check routes with `docker exec ip route`. Remove a blackhole with `docker exec ip route del blackhole `.

Grading

./grade.sh

Solution

See the solution/ directory for step-by-step network repair commands.