Skip to content

Instantly share code, notes, and snippets.

@jivoi
Created September 6, 2019 14:47
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 jivoi/51d3b57ac719cd14e8ac7401fc39c7be to your computer and use it in GitHub Desktop.
Save jivoi/51d3b57ac719cd14e8ac7401fc39c7be to your computer and use it in GitHub Desktop.
#!/bin/bash
IF_IN="eth0"
IF_OUT="wlan0"
SUB="192.168.100"
echo "[+] Bringing interface ${IF_IN} down"
ip addr del ${SUB}.1/24 dev ${IF_IN}
ip link set dev ${IF_IN} down
echo "[+] Removing iptable rules"
iptables -t nat -D POSTROUTING -s ${SUB}.0/24 -j MASQUERADE
iptables -D FORWARD -o ${IF_IN} -i ${IF_OUT} -s ${SUB}.0/24 -m conntrack --ctstate NEW -j ACCEPT
iptables -D FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
echo "[+] Stopping DHCP server"
killall dhcpd
echo "[+] Done"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment