Added command commandline argument to the interface masquerading script

This commit is contained in:
Pedro Alvarez 2018-01-18 14:10:15 +00:00
parent 3af13f4f2e
commit 6945ac697c
1 changed files with 9 additions and 2 deletions

View File

@ -23,8 +23,15 @@
#Check for sudo rights
sudo -v || exit
echo "Masquerading Interface"
#Check if outbound interface was specified
if [ ! $# -eq 1 ]
then
echo "Usage :'sudo ./if_masq.sh <Interface Name>' "
exit
fi
echo "Masquerading Interface "$1
echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward 1>/dev/null
sudo iptables -t nat -A POSTROUTING -o wlp58s0 -j MASQUERADE
sudo iptables -t nat -A POSTROUTING -o $1 -j MASQUERADE