Update configs

This commit is contained in:
2025-07-19 14:20:31 +03:00
parent 1fd27fe36e
commit 5374bf9cc1
2 changed files with 105 additions and 93 deletions

View File

@@ -0,0 +1,25 @@
#!/bin/bash
# Очистка старой цепочки
iptables -t nat -F CLASH_REDIR 2>/dev/null
iptables -t nat -X CLASH_REDIR 2>/dev/null
# Создание пользовательской цепочки
iptables -t nat -N CLASH_REDIR
# Исключаем loopback и локальные подсети
iptables -t nat -A CLASH_REDIR -d 127.0.0.0/8 -j RETURN
iptables -t nat -A CLASH_REDIR -d 10.0.0.0/8 -j RETURN
iptables -t nat -A CLASH_REDIR -d 172.16.0.0/12 -j RETURN
iptables -t nat -A CLASH_REDIR -d 192.168.0.0/16 -j RETURN
# Всё остальное TCP → REDIRECT на Clash
iptables -t nat -A CLASH_REDIR -p tcp -j REDIRECT --to-ports 7892
# Исключаем трафик Clash по UID
iptables -t nat -C OUTPUT -m owner --uid-owner clash -j RETURN 2>/dev/null || \
iptables -t nat -I OUTPUT -m owner --uid-owner clash -j RETURN
# Применяем CLASH_REDIR ко всем TCP
iptables -t nat -C OUTPUT -p tcp -j CLASH_REDIR 2>/dev/null || \
iptables -t nat -A OUTPUT -p tcp -j CLASH_REDIR