x
Различия
Показаны различия между двумя версиями страницы.
| Следующая версия | Предыдущая версия | ||
| x [19.05.2025 09:12] – создано augin | x [20.07.2025 07:44] (текущий) – [Examples for transparent proxy] augin | ||
|---|---|---|---|
| Строка 1: | Строка 1: | ||
| + | ====== зависимости ====== | ||
| + | <code bash>apt install unzip curl nginx nginx-full certbot python3-certbot-nginx sqlite3 jq openssl</ | ||
| ====== nginx ====== | ====== nginx ====== | ||
| Строка 82: | Строка 84: | ||
| } | } | ||
| </ | </ | ||
| + | [[https:// | ||
| + | ====== Examples for transparent proxy ====== | ||
| + | |||
| + | Add a dokodemo-door inbound as below. | ||
| + | |||
| + | <code | download> | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | </ | ||
| + | Configure iptables as below. | ||
| + | |||
| + | <code bash> | ||
| + | # Создаём новую цепь | ||
| + | iptables -t nat -N V2RAY | ||
| + | iptables -t mangle -N V2RAY | ||
| + | iptables -t mangle -N V2RAY_MARK | ||
| + | |||
| + | # Игнорируем адреса серверов V2Ray | ||
| + | # Это ОЧЕНЬ ВАЖНО, будьте внимательны. | ||
| + | iptables -t nat -A V2RAY -d 123.123.123.123 -j RETURN | ||
| + | |||
| + | # Игнорируем адреса локальной сети и любые другие адреса, | ||
| + | # которые не требуется пропускать через прокси-сервер | ||
| + | # См. Википедию и RFC5735 для полного списка зарезервированных сетей. | ||
| + | iptables -t nat -A V2RAY -d 0.0.0.0/8 -j RETURN | ||
| + | iptables -t nat -A V2RAY -d 10.0.0.0/8 -j RETURN | ||
| + | iptables -t nat -A V2RAY -d 127.0.0.0/8 -j RETURN | ||
| + | iptables -t nat -A V2RAY -d 169.254.0.0/ | ||
| + | iptables -t nat -A V2RAY -d 172.16.0.0/ | ||
| + | iptables -t nat -A V2RAY -d 192.168.0.0/ | ||
| + | iptables -t nat -A V2RAY -d 224.0.0.0/4 -j RETURN | ||
| + | iptables -t nat -A V2RAY -d 240.0.0.0/4 -j RETURN | ||
| + | |||
| + | # Всё остальное перенаправляем на локальный порт Dokodemo-door | ||
| + | iptables -t nat -A V2RAY -p tcp -j REDIRECT --to-ports 12345 | ||
| + | |||
| + | # Добавляем правила для UDP | ||
| + | ip route add local default dev lo table 100 | ||
| + | ip rule add fwmark 1 lookup 100 | ||
| + | iptables -t mangle -A V2RAY -p udp --dport 53 -j TPROXY --on-port 12345 --tproxy-mark 0x01/0x01 | ||
| + | iptables -t mangle -A V2RAY_MARK -p udp --dport 53 -j MARK --set-mark 1 | ||
| + | |||
| + | # Применяем правила | ||
| + | iptables -t nat -A OUTPUT -p tcp -j V2RAY | ||
| + | iptables -t mangle -A PREROUTING -j V2RAY | ||
| + | iptables -t mangle -A OUTPUT -j V2RAY_MARK</ | ||
x.1747645967.txt.gz · Последнее изменение: — augin
