Home > OS >  Centos7 iptables port forwarding for help ChongXie ChongXie
Centos7 iptables port forwarding for help ChongXie ChongXie

Time:09-20

Server A (IP1) launched the HTTP request (the source of the HTTP request iptables is mounted on the machine)
Server (IP2) original destination B
After the server C (IP3) forward destination

Server is installed on A iptables


Execute commands on server A: curl ip2: port2

Hope to receive the request server C

So I did the following:

Command 1: iptables -t NAT - A OUT - d ip2 -p TCP -- dport 8105 - j DNAT - to - destination ip3:8105

The result error
The iptables: No chain/target/match by that name.




Replace the command is: (OUT - & gt; The PREROUTING)
2: command iptables -t NAT - A PREROUTING - d ip2 -p TCP -- dport 8105 - j DNAT - to - destination ip3:8105
There is no error

So I perform, curl ip2: port2, not forwarded to the ip3: port3



Question:
A: what is the command 1 error reason?

2: error solution?

3: how to set up the destination IP and port forwarding?


Due to special needs, iptables can only be installed on A server, can't change the iptables installation machine



CodePudding user response:

The iptables rules OUT;
A - server & gt; Server - B & gt; Server C, then the server must B for transit server;
"Due to the special needs, iptables can only be installed on A server" and functional components can realize forward so much, even the SSH and firewall can achieve forward, why not use iptables?
  • Related