Skip to content

Instantly share code, notes, and snippets.

@daemonp
Created November 6, 2014 21:50
Show Gist options
  • Save daemonp/1fcccaf6cd10f0046a34 to your computer and use it in GitHub Desktop.
Save daemonp/1fcccaf6cd10f0046a34 to your computer and use it in GitHub Desktop.
redsocks openwrt
# Create new chain
iptables -t nat -X REDSOCKS
iptables -t nat -N REDSOCKS
# Ignore LANs and some other reserved addresses.
iptables -t nat -A REDSOCKS -d 0.0.0.0/8 -j RETURN
iptables -t nat -A REDSOCKS -d 10.0.0.0/8 -j RETURN
iptables -t nat -A REDSOCKS -d 10.10.1.0/22 -j RETURN
iptables -t nat -A REDSOCKS -d 127.0.0.0/8 -j RETURN
iptables -t nat -A REDSOCKS -d 169.254.0.0/16 -j RETURN
iptables -t nat -A REDSOCKS -d 172.16.0.0/12 -j RETURN
iptables -t nat -A REDSOCKS -d 192.168.0.0/16 -j RETURN
iptables -t nat -A REDSOCKS -d 224.0.0.0/4 -j RETURN
iptables -t nat -A REDSOCKS -d 240.0.0.0/4 -j RETURN
iptables -t nat -A REDSOCKS -d ${remote_ip}/32 -j RETURN
iptables -t nat -A REDSOCKS -p tcp -j REDIRECT --to-ports 12345
# Only send port 80 and 443 out over socks
iptables -t nat -I PREROUTING 1 -p tcp --dport 80 -j REDSOCKS
iptables -t nat -I PREROUTING 1 -p tcp --dport 443 -j REDSOCKS
@hillz1
Copy link

hillz1 commented Sep 3, 2015

Can you also provide the redsocks.conf file ? I set up an ssh tunnel on my openwrt with the command: ssh -vND 192.168.8.1:1080 user@server and I want to redirect all my internet traffic through that ssh tunnel. I find that redsocks might help me to do what I want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment