2010-11-29 3 views
15

में एक बंदरगाह को पुनर्निर्देशित करें ipptables का उपयोग कर मैं एक बंदरगाह को किसी अन्य स्थानीय बंदरगाह पर कैसे रीडायरेक्ट कर सकता हूं? उदा। कुछ इस तरह: ip6tables आयकर नेट -एक PREROUTING -j पुनर्निर्देशन -p टीसीपी --dport 443 --to-बंदरगाहों 8443ip6tables

उत्तर

4

ip6tablesREDIRECT समर्थन नहीं करता। (आम तौर पर लोग इसे एनएटी पर्यावरण में उपयोग करते हैं, और एनएटी आम तौर पर आईपीवी 6 के साथ समर्थित नहीं है।)

यदि आपको सामान्य उपयोगकर्ता के रूप में निम्न बंदरगाह से बांधना है, तो this answer में वर्णित वर्कअराउंड का प्रयास क्यों न करें? बेशक, टॉमकैट के मामले में, ऐसा लगता है कि इसका मतलब यह होगा कि किसी भी जावा प्रक्रिया को क्षमता देनी होगी।

+7

स्पष्ट रूप से 'ip6tables' v1.4.18 और लिनक्स कर्नेल v3.8 समर्थन 'रेडियरेक्ट': 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

आपको इसे और अधिक कठिन लगेगा आईपीवी 4 में रेडियरेक्ट की तुलना में ... TPROXY में मैंगल टेबल में एक विशेष व्यवहार है, इसलिए आपको इसके लिए अंक और उन्नत रूटिंग का उपयोग करना होगा। –

+0

"--on-ip" के लिए netfilter-version की आवश्यकता है? ip6tables v1.4.8 (डेबियन निचोड़ के साथ पैक किया गया) काम नहीं करता है। अग्रिम में धन्यवाद ! – int2000

+1

मेरे परीक्षण बॉक्स पर /usr/share/doc/iptables/changelog.Debian.gz में एक छोटी सी खोज के बाद, ऐसा लगता है कि इसे 1.4.11.1-1 में शामिल किया गया है, जैसा http: //bugs.debian में उल्लेख किया गया है। org/cgi-bin/bugreport.cgi? बग = 529,954 –