iptablesの事前ルーティングは機能しません


0

このコマンドブロックを80から8080へのルーティングに使用しますが、現在は機能しません。

sudo sysctl -w net.ipv4.ip_forward=1
sudo iptables -t nat -A PREROUTING -i wlp8s0 -p tcp --dport 80 -j REDIRECT --to-port 8080
sudo iptables -P FORWARD ACCEPT

そして iptables -L -vt nat 出力は

Chain PREROUTING (policy ACCEPT 3 packets, 236 bytes)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 REDIRECT   tcp  --  wlp8s0 any     anywhere             anywhere             tcp dpt:http redir ports 8080

Chain INPUT (policy ACCEPT 2 packets, 184 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain OUTPUT (policy ACCEPT 2 packets, 128 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain POSTROUTING (policy ACCEPT 2 packets, 128 bytes)

そして最後に、 cat /proc/sys/net/ipv4/ip_forward output => 1

出力をunameします。

Linux 4.9.0-3-amd64 #1 SMP Debian 4.9.30-2+deb9u3 (2017-08-06) GNU/Linux

何が悪いの?


1
あなたが得ていた行動、現在得ている行動、そしてその時から現在までに何が変わったのかを説明してください。
G-Man

私は自分のIPアドレスを変更するだけで、コマンドを変更することはありません。
ibrahim

すべてのクライアントは私の新しいIPアドレスを知っているので、ゼロとは異なるiptables.normally prekouting pktsとbytesセクション(iptables -L -vt nat)の問題を考えています。
ibrahim

回答:


0

による Frozentux リダイレクト ターゲットは、パケットとストリームをマシン自体にリダイレクトするために使用されます。言い換えれば、これは転送されるパケット、または同様のもののために宛先アドレスを私たち自身のホストに書き換えます。」

代わりに試すことができます(コマンドを https://stackoverflow.com/questions/242772/using-iptables-to-change-a-destination-port ):

iptables -t nat -A OUTPUT -p tcp --dport 80 -j DNAT --to-destination <proxy_ip>:8080


さて、あなたに書いてみましょう。
ibrahim
弊社のサイトを使用することにより、あなたは弊社のクッキーポリシーおよびプライバシーポリシーを読み、理解したものとみなされます。
Licensed under cc by-sa 3.0 with attribution required.