Using dynamic DNS both in and out of your LAN

The place to post if you need help or advice

Moderators: ChrisThornett, LXF moderators

Using dynamic DNS both in and out of your LAN

Postby fede » Mon Mar 25, 2013 3:23 am

OK, here's my setup: I have a Debian box that acts as a mail and file server in my LAN (one day it will do more, but that's already enough for now). I use it to sync all my computers' main directories, and it also collects (via fetchmail) my mail from my various accounts, so my work computers have their mail clients pointing to my server, and they all get the mail from everywhere.

Now, the problem is to access the server in one way only, whether I am on the LAN or I am out in the wild. Right now, I use hamachi, and it allows me to use their VPN whether I am in or out of my LAN (it's a bit strange to use it from within the LAN, but the point is that it works).

I would like to wean myself from hamachi and use my dynamic DNS address, and port-forwarding (which is active for POP and SSH, for now) to do the same. The problem is that trying to access my public IP from within my LAN does not work, and if I use my LAN address when I am in, and my public IP when I am out, all my computers think I am accessing a different server, so my mail get downloaded twice to my mail clients, which is both a waste of time, and of space.

Is there some kind of workaround for this that is escaping me? Basically, I believe, I would need my mail clients to be able to query my POP server from inside the LAN using the public IP, or something that would emulate this behavior.

Thanks for any ideas!
fede
 
Posts: 56
Joined: Thu Sep 01, 2005 3:23 am

Postby nelz » Mon Mar 25, 2013 8:46 am

This is quite simple to do, if you are running a local DNS server (and if you are not, read the dnamasq tutorial in LXF 170).

All you do is add the mail server's hostname, along with its LAN IP address to /etc/hosts on the box running dnsmasq. That way the hostname will resolve to the LAN address when at home and the public address when out and about.

That's exactly what I do here, and its worked well for many years.
"Insanity: doing the same thing over and over again and expecting different results." (Albert Einstein)
User avatar
nelz
Site admin
 
Posts: 8545
Joined: Mon Apr 04, 2005 11:52 am
Location: Warrington, UK

using a DNS server

Postby fede » Wed Apr 10, 2013 6:00 pm

Thanks! I waited until I got LXF 170 in the mail (I downloaded the PDF version, but I am lazy about reading on a screen :( )

Just one question (which I should be able to answer myself by experimenting): is it OK if the computer running dnamsq and the mail server are one and the same? I would think so, but I might be missing something.
fede
 
Posts: 56
Joined: Thu Sep 01, 2005 3:23 am

Postby nelz » Wed Apr 10, 2013 6:14 pm

It's not only OK, it's how I've been doing it for many years.
"Insanity: doing the same thing over and over again and expecting different results." (Albert Einstein)
User avatar
nelz
Site admin
 
Posts: 8545
Joined: Mon Apr 04, 2005 11:52 am
Location: Warrington, UK


Return to Help!

Who is online

Users browsing this forum: Dutch_Master and 3 guests