Skip to content

Instantly share code, notes, and snippets.

@mcrmonkey
Last active August 11, 2018 00:14
Show Gist options
  • Save mcrmonkey/9080e0b5e87ce291df0596fa04248cfe to your computer and use it in GitHub Desktop.
Save mcrmonkey/9080e0b5e87ce291df0596fa04248cfe to your computer and use it in GitHub Desktop.
do nat stuff quickly
#!/bin/bash
echo -ne "\n\n\n Your interfaces: \n\n"
ip link sh
echo -ne "\n---------------------\n\n"
echo -ne "\n Enter interface name:\n"
read -r -p "Internet Interface: " INET
read -r -p "Private Interface: " PNET
echo " /sbin/iptables -t nat -A POSTROUTING -o $INET -j MASQUERADE"
echo " /sbin/iptables -A FORWARD -i $INET -o $PNET -m state --state RELATED,ESTABLISHED -j ACCEPT"
echo " /sbin/iptables -A FORWARD -i $PNET -o $INET -j ACCEPT"
echo 1 > /proc/sys/net/ipv4/ip_forward
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment