Я в iptables v1.4.13 обнаружил баг, когда маркированные пакеты пытаешься пропустить через DNAT, то почему-то непулучается.
Вот правила:
root@wifi-master:~# iptables -t filter -L -n
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
ACCEPT all — 0.0.0.0/0 192.168.1.0/24 mark match 0x88
ACCEPT all — 0.0.0.0/0 192.168.2.0/24 mark match 0x88
ACCEPT all — 0.0.0.0/0 192.168.3.0/24 mark match 0x88
DROP udp — 0.0.0.0/0 0.0.0.0/0 mark match 0x88
DROP icmp — 0.0.0.0/0 0.0.0.0/0 mark match 0x88
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
root@wifi-master:~# iptables -t mangle -L -n
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
NATISP all — 192.168.42.243 0.0.0.0/0
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
Chain LASTROUTING (0 references)
target prot opt source destination
Chain NATISP (1 references)
target prot opt source destination
MARK all — 192.168.1.0/24 0.0.0.0/0 MARK set 0x89
MARK all — 192.168.2.0/24 0.0.0.0/0 MARK set 0x89
MARK all — 192.168.3.0/24 0.0.0.0/0 MARK set 0x89
MARK all — 192.168.42.0/24 0.0.0.0/0 MARK set 0x89
Chain SHAPER (0 references)
target prot opt source destination
MARK all — 0.0.0.0/0 192.168.3.0/24 MARK set 0x89
MARK all — 192.168.3.0/24 0.0.0.0/0 MARK set 0x89
MARK all — 0.0.0.0/0 192.168.2.0/24 MARK set 0x89
MARK all — 192.168.2.0/24 0.0.0.0/0 MARK set 0x89
MARK all — 0.0.0.0/0 192.168.1.0/24 MARK set 0x89
MARK all — 192.168.1.0/24 0.0.0.0/0 MARK set 0x89
IMQ all — 0.0.0.0/0 0.0.0.0/0 mark match 0x89IMQ: todev 0
Chain TOR (0 references)
target prot opt source destination
MARK all — 0.0.0.0/0 0.0.0.0/0 MARK set 0x88
root@wifi-master:~# iptables -t nat -L -n
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
ACCEPT all — 0.0.0.0/0 192.168.3.0/24 mark match 0x88
ACCEPT all — 0.0.0.0/0 192.168.2.0/24 mark match 0x88
ACCEPT all — 0.0.0.0/0 192.168.1.0/24 mark match 0x88
DNAT tcp — 0.0.0.0/0 0.0.0.0/0 mark match 0x88 to:192.168.1.1:9040
DNAT udp — 0.0.0.0/0 0.0.0.0/0 mark match 0x88 udp dpt:53 to:192.168.1.1:53
DNAT udp — 0.0.0.0/0 0.0.0.0/0 mark match 0x89 udp dpt:53 to:192.168.1.1:53
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
MASQUERADE all — 0.0.0.0/0 0.0.0.0/0 mark match 0x89
Если делать, как указано выше в правилах, то всё работает.
Однако, если перед первым правилом сделать вот так:
iptables -t mangle -I PREROUTING -s 192.168.2.11 -d 91.209.124.11 -j TOR
то не работает. Трафик идёт почему-то мимо правила в dnat.


Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.
Похожие темы
- Форум Что не так с IPTABLES? (2018)
- Форум port forwarding (2010)
- Форум Не понятные правила в iptables (2018)
- Форум iptables: Политика по умолчанию для пользов цепочки (2007)
- Форум iptables DNAT (2013)
- Форум Port forwarding [openwrt][iptables] (2011)
- Форум iptables не пропускает разрешённый трафик (2012)
- Форум ipv6 открыть порт 8082 (2021)
- Форум IPTABLES ингнорирует пакеты на 445 порт (2013)
- Форум voip через iptables (2006)