DNS records for both FTP/HTTP server

20,017

I would recommend using different IP for different services, even when running them in the same machine.

If it is possible, of course. Otherwise you can use another CNAME record for the ftp service, but:

  • the IP will be the same for both names
  • the web server can manage diferent web services for diferent names even when using the same IP (configuration depends on the server you are using)
  • ftp protocol does not know about domain names, just the IP it is listening, so it will work the same way for every domain name (ftp://ftp.foo.tk, ftp://www.foo.tk and ftp://foo.tk).

So the DNS entries would look like this.

|NAME | TYPE  |      TARGET      |
----------------------------------
| www |   A   |   99.99.99.99    |
| ftp | CNAME |   www.foo.tk     |
|     | CNAME |   www.foo.tk     |
Share:
20,017

Related videos on Youtube

just me
Author by

just me

Updated on September 18, 2022

Comments

  • just me
    just me over 1 year

    I just registered a free domain using Freenom, that I plan to use for my single device which is both FTP and HTTP server. I have set these DNS records (not using real names):

    |NAME | TYPE  |      TARGET      |
    ----------------------------------
    | www |   A   |   99.99.99.99    |
    |     | CNAME |   www.foo.tk     |
    

    When i type either foo.com or www.foo.tk, i can access website running on my server. But when I want to access the FTP server, I always have to type ftp://foo.tk or ftp://www.foo.tk.

    Now what I would like to do is that I could access my FTP server by typing for example ftp.foo.tk and HTTP server by typing web.foo.tk

    Is it possible ? And if so, how can it be done ?

    • ceejayoz
      ceejayoz almost 8 years
      Protocol (FTP vs HTTP/HTTPS) has nothing to do with DNS. In the past, some browsers have handled ftp.example.com by attempting an FTP connection by default if HTTP doesn't respond, but I'm not sure how widely supported that is (or even if it is at all these days). FTP is mostly on its way out for anything non-anonymous, anyways, as it's highly insecure.
    • NickW
      NickW almost 8 years
      Possibly you could get apache to do a rewrite..
  • just me
    just me almost 8 years
    Thanks for replies, I think now I understand a bit more. I can have only one public IP, so that's the problem. I thought that maybe it is possible to somehow use DNS to translate one domain name to ftp port and another to http port on the same IP, but now I see it probably won't work that way. Seems like the only way is to do some tweaking at my server.
  • Ryan Bolger
    Ryan Bolger almost 8 years
    HTTP and FTP already use different ports. Regardless of the names you use, you can use both services on the same IP.
  • just me
    just me almost 8 years
    That wasn't exactly my question, but thank you I will fix it