Labs / Internetwork / NAT: port forwards, static, pools & traversal

Lab 2 of 3 · NAT: port forwards, static, pools & traversal

Static NAT, address pools and overload

NAT explained on a Linux router: static for a server, then a pool, then overload.

Open this lab Pro 5 steps

The idea

NAT explained: edgeRouter, the company's router, rewrites the inside addresses of a web server and three PCs to outside ones that an outside server sees: one to one for the server, from a pool, or everyone on one address told apart by port.

Local is inside, global is outside
Local is inside, global is outside
One address, told apart by port
One address, told apart by port

Steps

  1. Static NAT for the web server

    The ISP's routes lead to the company's block 10.0.4.0/24, never to its private 10.0.1.0/24. The web server (10.0.1.10) gets 10.0.4.10 for good: a server needs one fixed outside address, or nobody outside could find it.

    edgeRouter:~# iptables -t nat -A POSTROUTING -s 10.0.1.10 -j SNAT --to-source 10.0.4.10
    webServer:~# curl -s -m 3 10.0.3.10
    edgeRouter:~# iptables -t nat -A PREROUTING -d 10.0.4.10 -j DNAT --to-destination 10.0.1.10
    outsideServer:~# curl -s -m 3 10.0.4.10
  2. Four addresses, one conversation

    The web server just called out again. edgeRouter keeps each translated connection in its connection tracking table. A reply arrives addressed to 10.0.4.10, so the router needs an entry to turn it back into one for 10.0.1.10.

    edgeRouter:~# conntrack -L -p tcp

Pro

3 more steps in the app

  1. A pool for the PCs
  2. Overload: one address for everyone
  3. Overload does not open the door
Get Pro

Learn it on real machines.

Every lab is a small network of real Linux machines in your browser. Start with a free account: Google or email, no card.

Open this lab