Help configuring mail/web server with a static ip

Hi people.

I think that i lost my memory, because i completely forgot how to accomplish this.

I have a WEB/MAIL server configured to work on a static IP address, lets say 200.11.22.33.

Now I wanna point a domain to that server to get the services up and running, lets say mydom.com

The static IP Address is assigned by my Internet Provider.

I’m lost in the part of connecting the domain with the server.

I have the domain DNS pointing to the ISP name servers, but I don’t remember if this is the correct way, or if I have to setup my own DNS server…

A little help here?

Thanks in advance!

Is this server running on a fixed public ip address or your own private server which on a line that changes every now and then?
If it’s a static public address, you need to get your isp to create the A and MX records. These should then be picked up no matter what dns server is used.
If the ip address is likely to change, then you need an account with one of the dynamic dns services.

If you want your webserver to be accessible from the outside world, use a service like DynDNS (DynDNS.com - Free Domain Name, Managed DNS, Email Services) . Some providers offer similar services.
If you want to be able to send mail (or more exactly if you don’t want your emails to come back to you), you should configure sendmail (Postfix) to use your provider’s smtp as a ‘smarthost’.

I have a WEB/MAIL server configured to work on a static IP address, lets say 200.11.22.33.

Is this your real IP number? If yes, then it does not (yet) resolve on a reverse lookup.

What you have to do:

There must be at least one but normally two DNS servers for a domain name associated with that IP number. This can be set up by your ISP, or you do it yourself with bind. The DNS servers must have at least an A record and an MX record for your domain. Let’s assume your domain is ‘sampledom.com’. Then you would configure the zonefile for bind to resolve:

$ORIGIN .
$TTL 2d
sampledom.com           IN SOA  ns.sampledom.com.    admin.sampledom.com. (
                        2010083001      ; serial
                        3h              ; refresh
                        1h              ; retry
                        1w              ; expiry
                        1d              ; minimum
                        )
                        IN NS   ns.sampledom.com.
                        IN NS   ns.otherdns.com.
                        IN A    200.11.22.33
                        IN MX   10 mail.sampledom.com.
                        IN MX   20 mail.secondarymailserver.com.
$ORIGIN sampledom.com.
ns                      IN A    200.11.22.33
mail                    IN A    200.11.22.33
www                     CNAME   ns

Your secondary slave DNS can copy from the primary. Then you must register your DNS servers with your domain name provider. That’s it.

Now any lookup for ‘www.sampledom.com’ points to your IP. And any mail sent to ‘someone@sampledom.com’ would be sent to ‘mail.sampledom.com’ which again goes to your IP number. In addition, for a perfect setup, your ISP should set the reverse lookup for 200.11.22.33 to return ‘mail.sampledom.com’. Anything else is local configuration of apache and sendmail. Have fun.

To make it clear, there are two methods. Either you setup a DNS server, as vodoo described above, or you get postfix to use your provider’s smtp.
I’ll try to expose the other method :

  1. create the file /etc/postfix/transport with a content similar to the following:
samplehost.sampledom.com          local:
localhost.sampledom.com           local:
sampledom.com                     :
.sampledom.com                    :
*                                 smtp[yourprovidersmtp.com]

  1. run the following command:
/usr/sbin/postmap /etc/postfix/transport
  1. make a copy a the file /etc/postfix/main.cf
cp /etc/postfix/main.cf{,.org}
  1. apply the following changes to /etc/postfix/main.cf, replacing
    192.168.xxx.0 to match your local network.

--- main.cf.orig        2010-08-20 10:43:38.000000000 -0700
+++ main.cf     2010-08-20 10:43:38.000000000 -0700
@@ -699,11 +699,12 @@
 program_directory = /usr/lib/postfix
 inet_interfaces = localhost
 masquerade_domains = 
-mydestination = $myhostname, localhost.$mydomain
+mydestination = $myhostname, localhost.$mydomain, localhost
 defer_transports = 
-mynetworks_style = subnet
+mynetworks = 192.168.xxx.0/24, 127.0.0.0/8
 disable_dns_lookups = no
 relayhost = 
+transport_maps = hash:/etc/postfix/transport
 content_filter = 
 mailbox_command = 
 mailbox_transport = 

  1. start/restart postfix
/etc/rc.d/postfix restart || /etc/rc.d/postfix reload
  1. you should also set SMTPD_LISTEN_REMOTE=“yes” in /etc/sysconfig/mail, whether you use this method or the other one.

This method allows you to send mails directly without having to set up a DNS server.
However if you want to receive emails from the outside world, you have to apply the other method (which is more elegant).