[CentOS] Forward all traffic from public IP A to public IP B?

John R Pierce pierce at hogranch.com
Mon Nov 3 22:29:24 UTC 2008

Morten Sundstrøm wrote:

> Im trying to forward all traffic to a public server(A) to another 
> public server(B) except traffic to port 22. Found this on google but 
> cant get it to work. Could someone help me please.
> Server A has one NIC server B has one NIC. Do i need 2 NICS in server A. 

> Server B is not behind server A, two different machines on different 
> public networks.

Offhand, I'd suggest setting up a VPN between the two servers, perhaps 
using OpenVPN, configured so server "A" is masquerading the VPN's 
private addresses, and use ip masquerade style port forwarding to server 
B's private VPN address. 

this still leaves some questionable scenarios...  for instance, assuming 
server B has its own default gateway (which, indeed, it needs for 
various reasons), if a FTP connection request comes in via server A's 
port forwarding and NAT, the handling of the FTP dynamic 'data' port 
will get messy.    the same applies to any other protocol that 
genereates dynamic requests.

for that matter, server "B" generated outbound traffic, like for 
instance, email... is that to be forwarded out through A ?

More information about the CentOS mailing list