Skip to content

Instantly share code, notes, and snippets.

@jaykepeters
Last active March 28, 2019 02:06
Show Gist options
  • Save jaykepeters/71d61de7ebace1e7e1d35e57a0ad338c to your computer and use it in GitHub Desktop.
Save jaykepeters/71d61de7ebace1e7e1d35e57a0ad338c to your computer and use it in GitHub Desktop.
# Plain OLD
iptables -t nat -A PREROUTING -s IP -p udp --dport 53 -j REDIRECT --to-port 5300
ptables -t nat -A PREROUTING -s IP -p tdp --dport 53 -j REDIRECT --to-port 5300
# IP Based DNS Redirection
ipset -N restricted nethash
iptables -t nat -A PREROUTING -m set --match-set restricted src -p udp --dport 53 -j REDIRECT --to-port 5300
iptables -t nat -A PREROUTING -m set --match-set restricted src -p tcp --dport 53 -j REDIRECT --to-port 5300
ipset -A restricted IP
# TRY 2
iptables -t nat -A PREROUTING -m set--match-set restricted src -p udp --dport 53 -j DNAT --to 192.168.1.4:5300
iptables -t nat -A PREROUTING -m set--match-set restricted src -p tcp --dport 53 -j DNAT --to 192.168.1.4:5300
# Mac Based DNS Redirection
TBD
# Listing and removing PREROUTING table Rules
https://www.svennd.be/remove-iptables-prerouting-nat-rule/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment