0

So I want to be able to host many FTP servers off port 21 all from one IP address. Here's the setup:

  • If the person connects with ftp1.example.com the internal server address is 10.0.0.1.
  • If the person connects with ftp2.example.com the internal server address is 10.0.0.2.
  • etc...

But the ftp1.eample.com and ftp2.example.com both point to the same external IP address.

What are the ways of going about this?

  • I assume you mean IP address since there are only two current IPs: IPv4 and IPv6. There are load sharing/balancing appliances for the sort of thing which you describe. Do you imagine Google has a single server for any of its IP addresses? Also, ethernet and switching have nothing to do with the upper layer protocols (IP, TCP, UDP, etc.). – Ron Maupin Aug 29 '16 at 2:45
  • @RonMaupin: in the OP's scenario how does the load balancer know which domain the client connected to, and hence which internal server to forward to? – hertitu Aug 29 '16 at 6:16
  • The load balancer can work in many different ways, but usually it's done by matching the URL in the request. This can be done in IIS with the URL rewriter module. Still, this is definitely a Layer 5 or above question. – Stuggi Sep 5 '16 at 9:54
1

This is a common scenario. It is not a question of routing, it is a question of name resolution.

Whether you host your own domains or use a third party, DNS records would need to resolve the domain name to an IP address.

A common approach would be - an A record (also known as a host record) links a domain to the physical IP address of a computer hosting that domain's services.

A CNAME (Alias) record points to an A (Host) record. You can create multiple CNAME records and point them to an A record. The most common CNAME records are the subdomains www and ftp.

With this approach, you can host several services on one machine, using a single IP address.

If the ftp servers resided on separate devices sporting RFC1918 addresses, a reverse proxy could act as a gateway and take requests from the Internet and forwarding them to servers on the internal network.

  • 1
    I think you misread the question (or it was edited after your answer). The question is about using a single ip address that redirects/forwards to multiple machines, not a single machine. I don't think that that is a common scenario. – hertitu Aug 29 '16 at 6:07
  • No, the question does not stipulate multiple machines. The question asks how to host multiple ftp servers from a single IP address and I have given the most practicable answer. – alib_15 Aug 29 '16 at 6:37
  • What are 10.0.0.1 and 10.0.0.2 then? – hertitu Aug 29 '16 at 6:40
5

The functionality you describe is that of a reverse proxy which is relatively common for HTTP, but was not possible for FTP until RFC 7151 introduced the HOST command. So in your scenario, an RFC 7151 compatible FTP client can connect to the public IP address, send a HOST command indicating the name of the server it wants to connect to, and based on that info the reverse proxy running on the public ip address can then connect to the correct internal server.

0

You can do this by using of different tcp ports. you should configure your router with port forwarding like below: ftp1.example.com:3000 ----> 10.0.0.1 ftp2.example.com:3001 ----> 10.0.0.2

If you have cisco router you can use of NAT Outside. If you have DSL modem router you should find the port forwarding section and create those rules.

Not the answer you're looking for? Browse other questions tagged or ask your own question.