Created
November 6, 2014 21:50
-
-
Save daemonp/1fcccaf6cd10f0046a34 to your computer and use it in GitHub Desktop.
redsocks openwrt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.