FQDN + VPS shared ip confusion how to setup?

Trying to work out the problem.
What I’ve got:
-VPS where Webmin/Virtualmin got set via installation script and running already.
-multiple domains (call them bbb.com ccc.com ddd.com etc)
-one shared IP for all this

Somehow I’ve got confused with FQDN. Hostname of this is set exact same as one of the domain names I have (say ccc.com).
Now when I’m trying to send an email from 3rd party (like hotmail) to ddd.com or bbb.com - it bounces back with “reject” error and mentioning ccc.com as hostname in both cases.
When I’ve done nslookup for the ip I’ve been given by the VPS company it returns two records:
“nslookup 1.2.3.4”

Server: ns1.recursive.dns.com
Address: 8.26.56.26
Name: ccc.com
Address: 1.2.3.4

The question is - what needs to be changed (hostname + maybe anything else?) in order for emails to work for every individual domain on this shared ip without a problem?
Many thanks!

You should change the FQDN of the server to something that’s not equal to any Virtualmin hosted domain. What distro are you using? In Ubuntu/Debian, you do that in the files /etc/hosts, /etc/hostname, /etc/mailname and /etc/postfix/main.cf if I’m not forgetting anything. Otherwise a grep in /etc for the old FQDN and hostname helps. :slight_smile:

In /etc/hosts, you want a line like so, if your IP is 1.2.3.4, and the FQDN is myhost.mydomain.tld:

1.2.3.4 myhost.mydomain.tld myhost

using Centos 6.5
i guess it has to be done in /etc/hosts file for Centos?
does it have to be just like that? “1.2.3.4 myhost.mydomain.tld myhost” (just change ip to real one?)

Eric will certainly barge in here, he’s the one who knows the CentOS zen. :wink:

yes that would be great, the uncertainty is how and what to use for the hostname - I have one of the domain names that is not in use and can be used as FQDN for the this VPS. Or does hostname have to be same as nslookup value? (hostname ns1.recursive.dns.com)? Or do i use that domain name that is not in use and add subdomain like ns1.ccc.com?

Howdy,

Off the top of my head, I don’t recall how to update the CentOS config files to change the hostname.

But it’s possible to do that within Webmin/Virtualmin.

To do that, go into Webmin -> Networking -> Hostname and DNS Client, and there, you can set the hostname. Also, make sure “Update hostname in host addresses if changed?” is checked, which will ensure that the /etc/hosts file is updated to match that.

The only other thing you may need to do is edit /etc/postfix/main.cf, and there, make sure your hostname appears on the “mydestination” line, or else Postfix won’t understand how to deliver emails locally.

-Eric

Thanks, andreycheck
erm, yes it is all exactly like you say it should be in “hostname and dns client” as well as in /etc/postfix/main.cf - all settings are in order.
However, the emails are bouncing back with
"Undelivered Mail Returned to Sender
This is the mail system at host ccc.com.
I’m sorry to have inform you that your message could not be delivered to one or more recipients. It’s attached below.

For further assistance, please send mail to postmaster…


The mail system
reject@ccc.com (expanded from info@ddd.com): unknown user: reject

So the bottom line is - not only mail does not get delivered to this server but also it mixes up the domain names.

I seem to have left out a step – after editing the Postfix config, did you restart Postfix?

You can do that with this command:

/etc/init.d/postfix restart

Without that, those Postfix changes wouldn’t be active.

-Eric

Ok, i found the solution and it’s not what was suggested.
Basically I had to use one of the domains and added subdomain to it. And used it as hostname (FQDN).
Such as “host.ccc.com
No all the mail goes out/in without a problem.
Thanks!