-1

My ISP has given me 1 static IP address, however, I need to run multiple internal IP addresses (from VPS's) under that 1 public IP address. I have enough network connections to my router, but not public IP's.

So, basically have something that forwards all traffic from certain domains to the specific internal ip address.

From my searches on ServerFault, I've found the following to solve my problem for apache purposes:

<VirtualHost *:80>
    ServerName      www.example.com
    ProxyRequests Off
    <Proxy *>
            Order deny,allow
            Allow from all
    </Proxy>
    ProxyPreserveHost On
    ProxyPass / http://192.168.254.197/
    ProxyPassReverse / http://192.168.254.197/

</VirtualHost>
<VirtualHost *:80>
        ServerName      www.other_example.com
        ProxyRequests Off
        <Proxy *>
                Order deny,allow
                Allow from all
        </Proxy>
        ProxyPreserveHost On
        ProxyPass / http://192.168.254.198/
        ProxyPassReverse / http://192.168.254.198/

</VirtualHost>

But this only forwards web requests, not everything (such as FTP, SSH, email, etc).

There has got to be something out there that can solve this!

I'm using CentOS 5.

sman591
  • 131
  • 1
  • 7
  • 3
    You can use simple iptables port forwarding. But you can only forward each port to _one_ host--you cant host multiple FTP servers (on the standard port) using a single IP that way. If you need that, you'll need to buy more IPs from your ISP. – Flimzy Jun 22 '11 at 05:36

2 Answers2

2

HTTP as a protocol has virtual hosts built-in. This is what you set as a server name and is sent by the client in each request in the Host header. Other protocols like SSH or FTP don't have this capability. You could forward port 22 (for SSH) to a single box/VM and use it as a hopping station to reach other hosts.

FTP on he other hand is a much more unfriendly protocol. There are proxies available but they are kinda strange mostly. There is support inside of stock iptables for forwarding FTP connections. But again, this is only easily possible to one host.

For email, you can install an SMTP server like Postfix or Exim and forward mails to the internal hosts using rules inside that SMTP server.

Holger Just
  • 3,325
  • 1
  • 17
  • 23
0

On your edge device, you can configure port forwarding or iptables redirect rules to the different hosts, but you will likely end up needing to use some non-standard ports for the services besides HTTP/HTTPS.

For example, if you're using a standard consumer router, you can set up port forwarding so that connections coming in on :23 to go to 192.168.254.198:22, on :24 to 192.168.254.197:22, etc. Depending on the device you have at the edge, different configurations/solutions apply.

Jesse K
  • 186
  • 5