Created
May 14, 2020 05:26
-
-
Save jj11hh/14cb273f2a06a683a4be6371f00cc98a to your computer and use it in GitHub Desktop.
Transparent proxy with v2ray
This file contains hidden or 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
| # Generated by xtables-save v1.8.2 on Mon Feb 24 19:24:15 2020 | |
| *mangle | |
| :PREROUTING ACCEPT [0:0] | |
| :INPUT ACCEPT [0:0] | |
| :FORWARD ACCEPT [0:0] | |
| :OUTPUT ACCEPT [0:0] | |
| :POSTROUTING ACCEPT [0:0] | |
| :V2RAY - [0:0] | |
| :V2RAY_MASK - [0:0] | |
| -A PREROUTING -j V2RAY | |
| -A OUTPUT -j V2RAY_MASK | |
| -A V2RAY -d 127.0.0.1/32 -j RETURN | |
| -A V2RAY -d 224.0.0.0/4 -j RETURN | |
| -A V2RAY -d 255.255.255.255/32 -j RETURN | |
| -A V2RAY -d 192.168.0.0/16 -p tcp -j RETURN | |
| -A V2RAY -d 192.168.0.0/16 -p udp -m udp ! --dport 53 -j RETURN | |
| -A V2RAY -p udp -j TPROXY --on-port 12345 --on-ip 0.0.0.0 --tproxy-mark 0x1/0xffffffff | |
| -A V2RAY -p tcp -j TPROXY --on-port 12345 --on-ip 0.0.0.0 --tproxy-mark 0x1/0xffffffff | |
| -A V2RAY_MASK -d 224.0.0.0/4 -j RETURN | |
| -A V2RAY_MASK -d 255.255.255.255/32 -j RETURN | |
| -A V2RAY_MASK -d 192.168.0.0/16 -p tcp -j RETURN | |
| -A V2RAY_MASK -d 192.168.0.0/16 -p udp -m udp ! --dport 53 -j RETURN | |
| -A V2RAY_MASK -m mark --mark 0xff -j RETURN | |
| -A V2RAY_MASK -p udp -j MARK --set-xmark 0x1/0xffffffff | |
| -A V2RAY_MASK -p tcp -j MARK --set-xmark 0x1/0xffffffff | |
| COMMIT | |
| # Completed on Mon Feb 24 19:24:15 2020 |
This file contains hidden or 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
| [Unit] | |
| Description=Tproxy rule | |
| After=network.target | |
| Wants=network.target | |
| [Service] | |
| Type=oneshot | |
| ExecStart=/sbin/ip rule add fwmark 1 table 100 ; /sbin/ip route add local 0.0.0.0/0 dev lo table 100 ; /sbin/iptables-restore /etc/iptables/rules.v4 | |
| #ExecStop=/sbin/ip rule delete fwmark 1 table 100 ; /sbin/ip route delete local 0.0.0.0/0 dev lo table 100 ; /sbin/iptables -t mangle -F | |
| [Install] | |
| WantedBy=multi-user.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment