LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   small question about mail clients on same network as mail server (https://www.linuxquestions.org/questions/linux-server-73/small-question-about-mail-clients-on-same-network-as-mail-server-4175476405/)

psycroptic 09-08-2013 05:12 PM

small question about mail clients on same network as mail server
 
i have postfix/courier-imap running on a local server on my home network. it is behind a router which has a static IP registered with the domainname for which the mail server operates. normally, i would just configure mail clients to use domain.com for the SMTP & IMAP servers, which resolves to this network's external address. since i've forwarded the right ports, this works everywhere in the world, except for on this network, which IS the domain.com network.

the end result is that I have to reconfigure all of my mail clients to use the local email server's IP, and change it back to domain.com whenever I leave here. i've looked around in thunderbird, iOS mail and the android mail client; all of them can use multiple SMTP servers which solves this problem (domain.com as the first, local server IP as the second), but none of them can do this with IMAP.

this seems like it should be easy to get around, maybe by having the local DNS server return a different domain.com MX record ONLY for clients on the LAN that points to the local mail server? or playing with iptables on the router?

any ideas?

descendant_command 09-08-2013 07:51 PM

You just need a local DNS server (dnsmasq is ideal) that returns the local ip, to any queries for domain.com

psycroptic 09-08-2013 08:11 PM

i see.. yeah i've already got bind setup... so adding an A and MX to point to the mail server won't screw up anything? i will try this later on tonight

descendant_command 09-08-2013 10:34 PM

You shouldn't need an MX record, as the clients are simply doing an A lookup on the server name.
Presumably your BIND is only for internal clients, not globally accessible?

psycroptic 09-08-2013 10:57 PM

correct. i actually went ahead and tried to just add "domain.com IN A MAILSERVERNAME" into my local zone file (the domainname locally is actually "domain.site") and BIND complained about it being "out-of-zone data".... so presumably i'm gonna have to create a new zone called "domain.com" on my server for this.... i would imagine i would need to copy the SOA from my DNS registrar.... idk if that sounds like it would work

descendant_command 09-09-2013 01:50 AM

That's why I prefer dnsmasq for local DNS :)
Just plop whatever names you want in a (the) hosts file and you're done.

psycroptic 09-09-2013 03:50 PM

word i will give it a think.

thanks


All times are GMT -5. The time now is 08:40 AM.