Skip to content

Instantly share code, notes, and snippets.

@nyrahul
Created February 7, 2018 09:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nyrahul/a6ba884c9ab67318bd4f9027b9fdbe72 to your computer and use it in GitHub Desktop.
Save nyrahul/a6ba884c9ab67318bd4f9027b9fdbe72 to your computer and use it in GitHub Desktop.
#!/bin/bash
[[ "`whoami`" != "root" ]] && echo "Got to be root. Use sudo." && exit
export LOG_LEVEL=DBG
export OVERRIDE_IP=192.168.100.100
./server_proxy &
sleep 1
sysctl -w net.ipv4.ip_forward=1
iptables -t nat -C POSTROUTING -j MASQUERADE -s $OVERRIDE_IP
if [ $? -ne 0 ]; then
iptables -t nat -A POSTROUTING -j MASQUERADE -s $OVERRIDE_IP
fi
ifconfig mpti0 up
ip route add $OVERRIDE_IP/32 dev mpti0
wait
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment