8 lines
356 B
Bash
8 lines
356 B
Bash
#!/bin/bash
|
|
read -p "Qual a interface de saída para a internet? " IFACE
|
|
nft add table ip nat
|
|
nft add chain ip nat postrouting { type nat hook postrouting priority 100 \; }
|
|
if ! nft list chain ip nat postrouting | grep -q "oifname \"$IFACE\" masquerade"; then
|
|
nft add rule ip nat postrouting oifname "$IFACE" masquerade
|
|
fi
|
|
sysctl -w net.ipv4.ip_forward=1 |