Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
# Ref:
# Steps :
# ./
# ./create_ap wlan0 eth0 AccessPoint -g
killall hostapd
killall dnsmasq
# First, delete all existing rules
iptables --flush
iptables --delete-chain
iptables --table nat --delete-chain
iptables --table nat -F
iptables --table nat -X
# Captive Portal
# - Replace `` to `` to access remove server
iptables -t mangle -N localhost
iptables -t mangle -A PREROUTING -i wlan0 -p udp --dport 53 -j RETURN
iptables -t mangle -A PREROUTING -i wlan0 -j localhost
iptables -t mangle -A localhost -j MARK --set-mark 1
iptables -t nat -A PREROUTING -i wlan0 -p tcp -m mark --mark 1 -j DNAT --to-destination
sysctl -w net.ipv4.ip_forward=1
iptables -A FORWARD -i wlan0 -j ACCEPT
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.