ПЕРЕНАПРАВИТЬ порт в ip6tables

Как я могу перенаправить один порт на другой локальный порт с помощью ip6tables? например примерно так: ip6tables -t nat -A PREROUTING -j REDIRECT -p tcp --dport 443 --to-ports 8443


person Changming Sun    schedule 29.11.2010    source источник


Ответы (2)


ip6tables не поддерживает REDIRECT. (Обычно люди используют это в среде NAT, а NAT обычно не поддерживается с IPv6.)

Если все, что вам нужно сделать, это привязаться к низкому порту как обычный пользователь, почему бы не попробовать обходной путь, описанный в этот ответ? Конечно, в случае Tomcat это звучит так, как будто это означало бы наделить любой Java-процесс такой возможностью.

person mpontillo    schedule 06.02.2011
comment
Очевидно ip6tables v1.4.18 и ядро ​​Linux v3.8 поддерживают REDIRECT: sector7g. быть / posts / ipv6-nat-pre-routing-with-iptables - person TRS-80; 10.03.2014

Что ж, это старый вопрос, но поскольку мне нужно сделать то же самое ... Вот что я нашел:

TPROXY

This target is only valid in the mangle table, in the PREROUTING chain and user-defined chains which are only called from this chain. It redirects the packet to a local socket without changing the packet header in any way. It can also change the mark value which can then be used in advanced routing rules. It takes three options:
--on-port port
    This specifies a destination port to use. It is a required option, 0 means the new destination port is the same as the original. This is only valid if the rule also specifies -p tcp or -p udp. 
--on-ip address
    This specifies a destination address to use. By default the address is the IP address of the incoming interface. This is only valid if the rule also specifies -p tcp or -p udp. 
--tproxy-mark value[/mask]
    Marks packets with the given value/mask. The fwmark value set here can be used by advanced routing. (Required for transparent proxying to work: otherwise these packets will get forwarded, which is probably not what you want.)

Конечно, это действительно только для ip6tables. Итак, я полагаю, что это действительно так:

ip6tables -t mangle -A PREROUTING -p tcp --dport 443 -j TPROXY --on-port 8443

Однако пока не пробовал.

person Adrien Clerc    schedule 18.06.2012
comment
Вам будет сложнее, чем REDIRECT в IPv4 ... TPROXY имеет особое поведение в таблице mangle, поэтому вам нужно использовать метки на нем и расширенную маршрутизацию. - person Adrien Clerc; 19.06.2012
comment
какая версия netfilter необходима для --on-ip? ip6tables v1.4.8 (в пакете Debian Squeeze) не работает. Заранее спасибо ! - person int2000; 16.12.2012
comment
После короткого поиска в /usr/share/doc/iptables/changelog.Debian.gz в моем тестовом окне оказалось, что он был включен в 1.4.11.1-1, как упоминалось в bugs.debian.org/cgi-bin/bugreport.cgi?bug=529954 - person Adrien Clerc; 16.12.2012