2010-11-29 1 views
15

ip6tables를 사용하여 한 포트를 다른 로컬 포트로 리디렉션 할 수 있습니까? 예 : 이 같은 : 하여 ip6tables -t NAT -A PREROUTING -j REDIRECT -p TCP --dport 443 --to-포트ip6tables에서 포트 리디렉션

답변

4

ip6tables 8443 REDIRECT를 지원하지 않습니다. 일반적으로 사람들은 NAT 환경에서 이것을 사용하며 NAT는 일반적으로 IPv6에서 지원되지 않습니다.

낮은 포트에 일반 사용자로 바인드하면됩니다. this answer에 설명 된 해결 방법을 시도해보십시오. 물론, Tomcat의 경우, 이는 Java 프로세스에 해당 기능을 제공한다는 의미입니다.

+7

분명히'ip6tables' v1.4.18과 리눅스 커널 v3.8은'REDIRECT'를 지원합니다 : https://sector7g.be/posts/ipv6-nat-pre-routing-with-iptables –

5

음이 오래된 질문이지만, 내가 같은 일을 할 필요가 있기 때문에 ... 여기 내가 찾은 것입니다 :

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 

그러나 아직 시도하지 않았습니다.

+0

당신은 더 어려울 것입니다 IPv4에서 REDIRECT보다 ... TPROXY는 mangle 테이블에서 특별한 동작을합니다. 따라서 TPROXY에는 mangle 테이블에 마크를 사용하고 고급 라우팅이 필요할 것입니다. –

+0

"--on-ip"에 대해 netfilter-Version이 필요합니까? ip6tables v1.4.8 (Debian Squeeze로 패키지 됨)이 작동하지 않습니다. 미리 감사드립니다! – int2000

+1

내 테스트 상자에서 /usr/share/doc/iptables/changelog.Debian.gz를 짧게 검색 한 결과 http : //bugs.debian에있는 1.4.11.1-1에 포함 된 것처럼 보입니다. org/cgi-bin/bugreport.cgi? bug = 529954 –