Running Email Server on a Dynamic IP Address
Email servers are designed to run on a static IP address. Several challenges need to be overcome before you can run it behind a dynamic IP address. You could face problems in both, inbound and outbound, directions if you do not have a static IP address.This article talks about these challenges and how to overcome them.
There are two major hurdles when receiving inbound email:
- Your IP address could change without any notice. This means you will have to constantly update the IP address in your DNS server. Failure to update the address could result in lost emails. Many ISPs, particularly in the United States, use a sticky IP address that seldom changes. Running an email server on connections provided by such ISPs is a bit easier.
- Your ISP could block traffic on port TCP/25. Email delivery occurs on port 25. As a result, servers on the Internet will not be able to delivery their messages to your server if this port is block.
Due to the inherent problem of unsolicited emails, several restrictions are imposed when sending outbound emails:
- Outbound traffic on port 25 is blocked. This will prevent any email server from sending out emails to another servers on the Internet. Some ISPs route port 25 traffic through their own server, which will inspect emails before they are delivered to their final destination.
- Your IP is classified as dynamic. Almost every company filter their email messages before letting them go to the end-user. Even though your ISP could be using a sticky IP address, it is classified as dynamic. Many receiving email servers check the IP classification database and could reject incoming emails if they originate from an IP that is classified as dynamic. This means even though the message will get delivered to the destination email server, it will not reach the user's inbox.
- PTR Record. IP addresses where email come from are supposed to have a PTR record in the DNS server, which is a reverse lookup. For example, if your email IP address is 18.104.22.168, it is expected that the following command returns a valid host name:
nslookup -q=ptr 22.214.171.124
A PTR record in entered in the DNS server of your ISP. Therefore, you will have to ask your ISP to enter the host name in their DNS. ISPs who provide a dynamic address will be reluctant to add this in their DNS unless you upgrade to their static IP package.
- RBL servers. RBL servers provide free IP lookup database containing a list of IP address of known spammers. Several RBL servers contain dynamic IP addresses in their database. As a result, you outbound emails will be
blocked by the receiving server.
There are basically two work-arounds:
- Use a service, such as Dyn or No-IP, which provide a service that can receive and send emails on your behalf. Such services will simply forward incoming traffic for port 25 to an arbitrary port. For example, you could run your email server on port 2500 and have this service provider will forward emails to that port.
These service providers can also accept outbound emails on a non-standard port, which will not be blocked by your ISP and then then finally deliver the messages to their final destination.
- Run your own Virtual Private Server (VPS) somewhere on the cloud. These days you can get a small server for less than $5/month that will allow you to run an email server, which can handle both inbound and outbound emails since they also provide you a static IP address. Consider using Amazon Lightsail, Vultr, or Ionos. Try searching VPS hosting on Google to find other companies.