0

A bit of background info, first:

I have a domain that is configured to run a mail server, iRedadmin, postfix, etc. I can receive and send email and everything works great. The problem lies in the fact that after I decided to sign up for an online portfolio hosting service, they wanted me to change my domain's A @ entry in the DNS to point to their server IP, so that I could use my own "custom domain" instead of their generic subdomains, so that instead of going to sub.domain.com/portfolio, I could go to my-domain.com/portfolio to visit my site, which is in fact hosted on their servers.

After changing my A @ entry to point to their IP, everything worked fine, I could send email but not receive any. The problem lied in the fact that when someone tried sending email to, say, user@domain.com, all the mail was really directed to their IP rather than my one, so in theory, they should have received all my mail.

I have solved the problem by creating a subdomain that points to my domain, e.g. webmail.domain.com and creating an MX entry that points to webmail.domain.com. Email works fine, however, now I have problems with ssh connection. I can connect to my domain by using its IP address, but if I use the domain, it actually connects to the portfolio hosting service's IP. Sad face.

My question: is it possible to create a DNS entry that applies only to certain ports? So I could ssh/FTP through port 22/21,etc... and use my local IP instead of theirs?

Thanks for helping, this is really important!

0

DNS entries has nothing to do with ports. They are simply a registry for domain names to IP address translation.

When you ssh into a server say domain.com then first DNS lookup for domain.com is done. The IP returned is then used by you ssh client to connect to the server. SSH client knows that your server's SSH works on port 22 so it tries to connects to that IP address on port 22.

In your case if your domain.com points to your portfolio hosting service's IP then that is what will be resolved by your ssh client.

Maybe you can add another subdomain which points to your server and then use it to login. Or use you subdomain for email, if email is on the same server.

An another way would be to add an entry to /etc/hosts (for linux) with your domain. DNS resolution first looks up hosts file first and then DNS so if you have an entry there then your ssh client will resolve it as you server.

You can check out ways to add hosts entries for Linux and other OS here

  • Thank you very much for your detailed response! Will check out my hosts file and do some tweaking about. And yes, I'm also thinking of using a simple subdomain for FTP and ssh connections if all fails. – Nick Feb 10 '15 at 13:17
  • I am glad I could help. If my response solved you problem then do accept it as the answer. – Get Splashed Feb 10 '15 at 15:51
  • Ended up with using a subdomain for connecting to my local installation. I don't know, the hosts not really working out for me, yet; I inserted my IP, then a space and my domain. Don't know what's the problem, really. – Nick Feb 10 '15 at 19:28
  • try a single tab instead of space – Get Splashed Feb 10 '15 at 19:58
  • I don't think syntax is the case, but I'll try. – Nick Feb 10 '15 at 20:36

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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