forked from abdoxfox/HTTP-CUSTOM-HEADERS-VPN
-
Notifications
You must be signed in to change notification settings - Fork 2
/
proxification
30 lines (24 loc) · 1.14 KB
/
proxification
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# create new chain
iptables -t nat -N PROXY
iptables -t nat -I OUTPUT -j PROXY
# exclude local traffic, see: http://manpages.org/ss-redir
iptables -t nat -A PROXY -d 127.0.0.0/8 -j RETURN
iptables -t nat -A PROXY -d 192.168.0.0/16 -j RETURN
iptables -t nat -A PROXY -d 0.0.0.0/8 -j RETURN
iptables -t nat -A PROXY -d 10.0.0.0/8 -j RETURN
iptables -t nat -A PROXY -d 169.254.0.0/16 -j RETURN
iptables -t nat -A PROXY -d 172.16.0.0/12 -j RETURN
iptables -t nat -A PROXY -d 224.0.0.0/4 -j RETURN
iptables -t nat -A PROXY -d 240.0.0.0/4 -j RETURN
#start downloading some traffic to fix the glitch
curl -x "socks5://127.0.0.1:1080" -O -k http://speedtest.tele2.net/10MB.zip &
sleep 0.5
# socksify whole TCP traffic
iptables -t nat -A PROXY -p tcp -j REDIRECT --to-ports 8123
iptables -t nat -A PROXY -p tcp -j REDIRECT --to-ports 8124
# socksify only DNS UDP traffic
iptables -t nat -A PROXY -p udp --dport 53 -j REDIRECT --to-ports 7300
iptables -t nat -A PROXY -p udp --dport 53 -j REDIRECT --to-ports 8125
trap "iptables -t nat -D OUTPUT -j PROXY; iptables -t nat -F PROXY; iptables -t nat -X PROXY" EXIT
# run socksifier
/usr/sbin/redsocks -c redsocks.conf