F
F
FlipWho2018-03-05 12:20:54
linux
FlipWho, 2018-03-05 12:20:54

IPTABLES rules as server proxy?

There is a server, it is planned as a proxy. From it you need to wrap traffic from a specific port to another server and another port. How to make IPTABLES on CentOS7 redirect traffic to different server and different port?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
F
falsebyte, 2018-03-05
@falsebyte

Something like this:

iptables -A PREROUTING -i eth0 -p tcp -m tcp --dport PORT -j DNAT --to-destination IP:PORT

S
Sanes, 2018-03-05
@Sanes

It won't work on another server.

K
krosh, 2018-03-07
@krosh

1. DNAT iptables, as written above. And don't forget about reverse SNAT rules in FORWARD.
2. haproxy in general, can work the way you want, although it is not designed for this. The setup is simple, give it a try.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question