Linux Labs

Networking / Stage 7 of 14

Allow what is needed, keep the block

Not running Starting usually ~20 s
Leave the lesson

Step 7 of 8 · lab · 25 minmedium

Firewall: open the site to the office

The server's site must open from the office and stay closed to everyone else, yet the office waits until the timeout. Find the cause and fix the persistent nftables configuration.

Situation

The server runs a site: nginx on port 80. It must open from the office, from the address 192.0.2.20, and stay closed to every other address on the network. The office complains: the site does not open, the request hangs. On the server itself curl http://127.0.0.1/ answers.

The office is the lab-client network namespace, and its interface has two addresses: 192.0.2.20 (the office) and 192.0.2.30 (another address on the same network). The server's address on this network is 192.0.2.10. A request from the right address:

sudo ip netns exec lab-client curl -sS --connect-timeout 3 \
  --interface 192.0.2.20 http://192.0.2.10/

The server's firewall is loaded by the nftables service from /etc/nftables.conf.

Task

  1. From 192.0.2.20, the site http://192.0.2.10/ answers HTTP 200.
  2. From 192.0.2.30, the site does not open.
  3. The rules in the kernel are the ones in /etc/nftables.conf, and the nftables service is enabled, so everything stays the same after a reboot.
  4. The drop policy of the input chain and the SSH permission on port 22 are in place.

The tools you need are already installed. There's no internet on this machine.

Lab · on your own

No commands are given in this lab: type them in the terminal yourself. Goals are checked on the machine after every command.

Goals

0 of 4
  • From the office address 192.0.2.20 the site http://192.0.2.10/ answers HTTP 200 — not done yet
  • From the address 192.0.2.30 the site does not open — not done yet
  • The rules are loaded from /etc/nftables.conf, and the nftables service is enabled — not done yet
  • The drop policy and the SSH permission are in place — not done yet
Ctrl+Enter
Starts the machine node1 · Ubuntu 24.04

The machine is starting

Hints

0 of 3

Lab goals

0 of 4
  • From the office address 192.0.2.20 the site http://192.0.2.10/ answers HTTP 200 — not done yet
  • From the address 192.0.2.30 the site does not open — not done yet
  • The rules are loaded from /etc/nftables.conf, and the nftables service is enabled — not done yet
  • The drop policy and the SSH permission are in place — not done yet
node1 Ubuntu 24.04

Lab goals

0 of 4
  • From the office address 192.0.2.20 the site http://192.0.2.10/ answers HTTP 200 — not done yet
  • From the address 192.0.2.30 the site does not open — not done yet
  • The rules are loaded from /etc/nftables.conf, and the nftables service is enabled — not done yet
  • The drop policy and the SSH permission are in place — not done yet
Loading…