#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2012
    Posts
    3
    Rep Power
    0

    Local mail server on unnumbered network


    I am trying to set up a mail server (Linux) on a local, unnumbered (192.168.n.n) network so that local users can send mail to one another without having to send up and down a DSL link to the web-hosted server.

    In effect I want to end up with 2 mail servers: one is local and the other is the 'proper' mail server, which has a static/shared IP and is hosted by a web-host service provider.

    I'm sure this has been done before, but cannot find the right search terms to find the answer...
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2012
    Posts
    3
    Rep Power
    0

    Postfix might work for this


    Some more info...

    So far I have set up a local DNS and Sendmail on the local server.

    The clients are able to send and receive local mail when their incoming (pop3) and outgoing (smtp) servers are set to localmail.mydomain.com

    The clients can also receive mail from the web-host incoming (pop3) server simply by configuring a second incoming mail account (mail.mydomain.com)

    Outgoing mail finds its way to both local and remote recipients if sent through the upstream mail server.

    BUT...

    Outgoing mail sent to remote recipients through the local mail server is rejected (invalid address in header). Clearly we have to fudge the header...

    Looks like postfix can do this (see postfix.org)...
  4. #3
  5. No Profile Picture
    Grumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Posts
    14,443
    Rep Power
    4539
    I'd probably want my clients to use a mail client that supports multiple account profiles to segregate the different mail servers. I use thunderbird to handle mail for a couple different external and internal mail systems by creating different thunderbird profiles, and within the profiles create multiple mail accounts. I use only IMAP, using pop causes problems because the first profile to hit the mail server downloads all the messages.

    Oh, with Thunderbird you can specify different outgoing SMTP servers for different mail accounts.
    ======
    Doug G
    ======
    Bartender to Rene Descartes "have another beer?" Descartes: "I think not" and he vanished.
    --Alfred Bester
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2011
    Posts
    289
    Rep Power
    45
    When trying to access a local server of any type, the simplest implementation is to use a slightly different name for the local host and enter that into the hosts file on each computer. Say you want to send a local only message, you would call your local server anything you like, and enter the information into the hosts file. For example, if you call your local outbound SMTP server "outbound.local.net", the hosts file entry would be:
    192.168.1.28 outbound.local.net
    The hosts file takes precedence over DNS. I use this feature to access local Web sites all the time.

    J.A. Coutts
  8. #5
  9. No Profile Picture
    Grumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Posts
    14,443
    Rep Power
    4539
    For example, if you call your local outbound SMTP server "outbound.local.net", the hosts file entry would be:
    192.168.1.28 outbound.local.net
    But this won't help with mail clients, you can't set a MX record in a hosts file, you need dns for mail to work properly. You're not going to be able to successfully use IP address as the name of the local mail server, although you could most likely use webmail via just the ip address if you have a webmail interface to your mail server.

    For myself, I set up linux ispconfig3 servers on my local network which works well for internal and external email.
    ======
    Doug G
    ======
    Bartender to Rene Descartes "have another beer?" Descartes: "I think not" and he vanished.
    --Alfred Bester
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2011
    Posts
    289
    Rep Power
    45
    Originally Posted by Doug G
    But this won't help with mail clients, you can't set a MX record in a hosts file, you need dns for mail to work properly. You're not going to be able to successfully use IP address as the name of the local mail server, although you could most likely use webmail via just the ip address if you have a webmail interface to your mail server.

    For myself, I set up linux ispconfig3 servers on my local network which works well for internal and external email.
    If I understand the poster's situation correctly, everything works fine if he uses the outside mail server to send outbound emails. But when he uses the local server, it gets rejected because the private address in the header isn't recognized as a legitimate sender by the relaying server. The outside server appears to be checking the entire header for the originating sender, and doesn't like the private address. The only way around that is to modify the behaviour of the local server so that it doesn't use the originating private address. I can't see DNS settings changing that, and unfortunately I don't know how to make SendMail not use the private address.
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2011
    Posts
    289
    Rep Power
    45
    A thought just occurred to me that a NAT router does not have to use the default private addresses that it comes with. You can use any sub net you want to. Everything that goes through the NAT router gets translated to the public address anyway. For example, you might try the auto configure addresses [169.254.x.x]. This particular range may conflict with DHCP, but the advantage of this range is that some public routers will route them and some won't. All public routers will not route the designated private numbers. If you are lucky, the outside mail server will accept them.

    J.A. Coutts
  14. #8
  15. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2012
    Posts
    3
    Rep Power
    0
    Thanks for the great suggestions everyone. I'm using the "two different mail-servers" solution for now, which is working well.

    Out of curiosity I'm still investigating if there's a way to make the process completely invisible to users.

IMN logo majestic logo threadwatch logo seochat tools logo