Exim: Unrouteable Address

Given the fact that I just moved VPS to XSserver.eu I also had to setup all the domains, email, accounts and etc. Since I used Directadmin on both servers, the back/restore was a blizz. Took a few hours, but that was because of the amount of data.

Today i ran into a problem with exim after i rebooted the server. I couldn't receive mail on my main email account which was a local unix account, and not virtual. 8 hours later i found the problem and solution.

I found alot of information that could point in direction domain or MX not pointing to the server - or user reached daily limit for sending mail. I checked it all, reinstalled config files and other stuff. I disabled spamassassin and reverted all changes i could possible think of I had done the last week since i got the server.

But all along it kept botherring me that i could see in the log files that the issue with "Unrouteable Address" started right after the reboot of the server. Sure, it could be possible that the config file was changed earlier and not read until the reboot, but still...

On one page i found a nice oneline to use when having issues with delivery in exim.

exim -bt -d [email destination] 2>&1

What this will show you, is what exim goes through to find a relevant account for the email. In my case when it reported "Unrouteable Address" i also noticed that it tried to deliver to username@vps5 instead of username@vps5.acoon.net.

I knew the DNS worked and i knew that the host was setup exactly as the old server, but still it pointed me in direction of the host still wasn't completely right.

I then remembered my old days as a system administrator and remembered that there are entries in /etc/hosts that is set automaticly at boot on some OS.

This is how my hosts file looked like:

178.239.57.100 vps5
127.0.0.1 localhost.localdomain localhost
178.239.57.136 vps5.acoon.net vps5

If you look at the first and the last line you will see that vps5 is set to two IP.

Since the first IP is not in my control but part of the VPS of some sort, I decided to remove the first line. After that, I tried to send an email, and it got through with no problem. So, the problem was that when exim was doing a lookup it resolved to a wrong ip. Funny thing is that when I do a "host vps5", it resolve to 178.239.57.136.

Never the less, it's working again after 8 hours of living hell.