0:00–0:15
Recap
0:15–1:50
Lab 1B
1:50–2:00
Debrief
0:00 – 0:15 Recap · 15 min

Verify Day 1 work and set up NAT theory before touching the VMs

0:15 – 1:50 Lab 1B · 95 min

Install S2 and S3, configure static IPs on all servers, enable NAT on S1

Task 1 — Install Ubuntu Server on S2 and S3 (30 min)

Task 2 — Configure static IPs on S1 using Netplan (25 min)

Instructor note: Netplan YAML indentation errors are the most common cause of failed network config. If a student's netplan apply produces errors, show them how to read the error message — it always includes the line number. A quick netplan try (which reverts after 120 seconds if not confirmed) is safer than netplan apply when experimenting.

Task 3 — Configure static IPs on S2 and S3 (15 min)

Task 4 — Enable IP forwarding on S1 (10 min)

Task 5 — Configure iptables MASQUERADE on S1 (15 min)

Lab 1B complete when: All three VMs are installed and running. S1 has correct static IPs on LAN1 and LAN2. S2 pings S1 (192.168.50.1) successfully. S3 pings S1 (192.168.51.1) successfully. Both S2 and S3 can ping 8.8.8.8 through S1's NAT. iptables-persistent is installed.
1:50 – 2:00 Debrief · 10 min

NAT verification and preview of Day 3

Learning outcomes — by end of Day 2, students can…

Configure Netplan static IPsWrite a valid Netplan YAML with multiple interfaces, apply it with netplan apply, and verify with ip addr and ip route
Enable kernel IP forwardingLocate and uncomment the ip_forward setting in sysctl.conf and verify it took effect
Configure NAT masqueradeAdd an iptables MASQUERADE rule on the correct outbound interface and verify internet access from internal VMs
Persist iptables rulesInstall iptables-persistent and confirm rules survive a reboot

Common issues and fixes

IssueLikely causeFix
netplan apply fails with YAML errorTab characters used instead of spaces, or wrong indentation depthUse cat -A /etc/netplan/*.yaml to reveal tabs (shown as ^I). Replace all tabs with spaces. Indentation must be consistent — 2 spaces per level
Interface name not eth0/eth1/eth2Ubuntu uses predictable interface naming on some hardwareRun ip link show to find actual names (may be enp2s0, ens3, etc.). Update Netplan YAML with correct names
S2 pings S1 but cannot ping 8.8.8.8IP forwarding not enabled, or MASQUERADE rule on wrong interfaceCheck cat /proc/sys/net/ipv4/ip_forward returns 1. Check sudo iptables -t nat -L -n — MASQUERADE rule should show with the correct interface
NAT works but stops after rebootiptables-persistent not installed, or rules not savedInstall iptables-persistent: sudo apt install iptables-persistent. Save rules: sudo netfilter-persistent save
S3 can ping S1's LAN2 IP but not internetMASQUERADE rule only covers LAN1 subnet, not LAN2The MASQUERADE rule covers all outbound traffic on eth0 regardless of source — this should work for both subnets. Verify with iptables -t nat -L POSTROUTING -n -v
← Day 1 Lab 1B Handout Day 3 →