apt install ufw
vi /etc/default/ufw
- Abilitare default policies
...
DEFAULT_FORWARD_POLICY="ACCEPT"
...
vi /etc/ufw/sysctl.conf
net.ipv4.ip_forward=1
Outbound Nat
- Aggiungere la sezione prima di quella filter
vi /etc/ufw/before.rules
# NAT table rules
*nat
:PREROUTING ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
# Port Forwardings
#-A PREROUTING -i eth0 -p tcp --dport 22 -j DNAT --to-destination 192.168.1.10
# Nat traffic through eth1 - Change to match you out-interface
-A POSTROUTING -s 10.0.1.0/24 -o eth1 -j MASQUERADE
# don't delete the 'COMMIT' line or these nat table rules won't
# be processed
COMMIT
# Don't delete these required lines, otherwise there will be errors
*filter
Attivazione
sudo ufw disable && sudo ufw enable
Riferimenti