Skip to content
This repository has been archived by the owner on Sep 30, 2021. It is now read-only.

Commit

Permalink
Improve NATing iptables rule
Browse files Browse the repository at this point in the history
  • Loading branch information
oblique committed Nov 26, 2016
1 parent 317d8b8 commit 0d2f654
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion create_ap
Original file line number Diff line number Diff line change
Expand Up @@ -1695,7 +1695,7 @@ fi
if [[ "$SHARE_METHOD" != "none" ]]; then
echo "Sharing Internet using method: $SHARE_METHOD"
if [[ "$SHARE_METHOD" == "nat" ]]; then
iptables -w -t nat -I POSTROUTING -o ${INTERNET_IFACE} -s ${GATEWAY%.*}.0/24 -j MASQUERADE || die
iptables -w -t nat -I POSTROUTING -s ${GATEWAY%.*}.0/24 ! -o ${WIFI_IFACE} -j MASQUERADE || die
iptables -w -I FORWARD -i ${WIFI_IFACE} -s ${GATEWAY%.*}.0/24 -j ACCEPT || die
iptables -w -I FORWARD -i ${INTERNET_IFACE} -d ${GATEWAY%.*}.0/24 -j ACCEPT || die
echo 1 > /proc/sys/net/ipv4/conf/$INTERNET_IFACE/forwarding || die
Expand Down

0 comments on commit 0d2f654

Please sign in to comment.