nat-start.sh use interface name passrd as parameter

This commit is contained in:
giomba 2020-03-18 10:56:55 +01:00
parent 45330a58ea
commit d9247826dc

View File

@ -1,6 +1,16 @@
#!/bin/bash #!/bin/bash
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE function echoerr {
>&2 echo $1
}
if [ -z $1 ]; then
echoerr "syntax:"
echoerr "# $0 <iface>"
exit 1
fi
iptables -t nat -A POSTROUTING -o $1 -j MASQUERADE
iptables -P FORWARD ACCEPT iptables -P FORWARD ACCEPT
sysctl -w net.ipv4.ip_forward=1 sysctl -w net.ipv4.ip_forward=1