NAT (Network Address Translation) lets many devices with private IPs share one public IP to access the internet.
NAT Types
| Type | Direction | Use Case |
|---|---|---|
| SNAT/Masquerade | Outbound | LAN internet access |
| DNAT | Inbound | Port forwarding |
iptables NAT Setup
# Enable IP forwarding
echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward
# Masquerade (LAN → internet)
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
# Port forwarding (DNAT)
sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination 192.168.1.10:80
💡 ZevsHost VDS: All VDS servers come with a dedicated public IPv4 — essential for mail servers, VPN, and game servers.