Webserver and Mail server on seperate Linux machine - How?

Discussion in 'Site & Server Administration' started by m1l, Jan 10, 2008.

  1. #1
    Hi,

    I have a site that the webserver needs to be on one machine but the mail server on another. is this possible and if so, how?

    Thanks in advance.
     
    m1l, Jan 10, 2008 IP
  2. boltok

    boltok Active Member

    Messages:
    257
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    78
    #2
    This is surely possible and quite common. Your website relies on your domain name's A records while mail is delivered according to your MX records.

    Depending on who controls the DNS servers for your domain, you can set both of them to point to different servers. Off course, you will have to setup the appropriate service on those servers (i.e. a mail server and a web server).

    The key here is DNS.
     
    boltok, Jan 10, 2008 IP
  3. m1l

    m1l Active Member

    Messages:
    101
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #3
    Ok, that makes sense.

    So if setup the domain to have 4 nameservers, 2 for server one, 2 for server two. Removed the MX record from server one, the webserver and only added the MX record to server two, that would work?
     
    m1l, Jan 10, 2008 IP
  4. Pwner

    Pwner Peon

    Messages:
    176
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I think that mx shoud be the same for all ns (i'm not sure), just point the mx to the mail server.
     
    Pwner, Jan 10, 2008 IP
  5. boltok

    boltok Active Member

    Messages:
    257
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    78
    #5
    You just need 2 nameservers, one of which is the primary server and the other the secondary, both of them serve exactly the same records.

    Usually, these are already setup by the registrar/domain host, though I prefer to manage my own. These servers contain records for your whole domain so you don't need additional servers if you have more web, mail or FTP servers on the same domain.

    You would configure the servers such that the entries look something like this on both servers (in addition to other parameters like the serial number, timeout settings etc.):

    @ IN MX 10 mail
    @ IN MX 20 backupmail.example.com.
    www IN A 192.168.0.2
    ftp IN A 192.168.0.3
    mail IN A 192.168.0.4


    ... and so on. This is just an example and the MX record with the lowest priority (10 in this case) would be your primary mail server. If you're managing DNS via a web interface, things may be even simpler.
     
    boltok, Jan 10, 2008 IP
  6. matrafox

    matrafox Active Member

    Messages:
    164
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    88
    #6
    You should have the same information on all nameserver.
    Also you may do something like this

    domain.com. 14400 IN MX 0 mail.domain.com.
    mail 14400 IN A Ip_server_mail
    domain.com. 300 IN A ip_server_web
    www 14400 IN A ip_server_web
     
    matrafox, Jan 11, 2008 IP