LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Adding 2 hostnames to my server?? (https://www.linuxquestions.org/questions/linux-newbie-8/adding-2-hostnames-to-my-server-616714/)

gohard 01-27-2008 09:16 PM

Adding 2 hostnames to my server??
 
I recently bought a new dedicated server thats running
CentOS Linux and I've been searching all day on how to
add an additional hostname to my server?

Right now I only have one hostname. "host.mydomain.com" and it is
responsible for sending all my mail via exim from the
sever under one ip address. (my main ip address)

What i'm trying to figure out is how I can add an additional
hostname with a new ip address so I can use exim to send out
mail through the new hostname I've added. I also need for
this new hostname to send out mail for a specific domain
only, instead of for all mail coming from my server.

But at the same time, keeping the other hostname and using
exim to send out mail through it for the shared accounts.

Does this have to do with my mail servers?

I'm brand new to all of this so I have no clue.

Any thoughts guys? ;-)

j-ray 01-28-2008 02:59 AM

maybe a search on "virtual machine" with metacrawler will help.
vmware.com offers such things among others.
unfortunately i'm not an expert on that...but maybe this is helpful:

http://www.linuxjournal.com/article/8540

Xen may do the job for free and his available as rpm or deb...

farslayer 01-28-2008 08:05 AM

So you want two hostnames and two IP addresses for one machine and you want EXIM to send out using both identities ?

I'm not sure what you are trying to accomplish here, but the host name isn't really related to where the mail comes from on a domain basis. I would suggest using a generic hostname on the server and just let exim do it's thing. I am unaware of any way to truly give a machine 2 hostnames, and if the hostname isn't correct when they do a rDNS lookup, other mail servers will reject mail from you. the mail server passes it's hostname to the other mail server when communicating, the other server may then do a reverse lookup on the IP address of your mailserver ot ensure it is who it claims to be. you servers local hostname and rDNS entries MUST MATCH


If you just want to host mail for multiple domains on one server look into VIRTUAL DOMAINS

DotHQ 01-28-2008 09:19 AM

You can easily add and host multiple virtual domains on one machine, but they all have the same IP address.
Like j-ray said, if multiple IP's are required you should look into xen or vmware. Either will allow you to run virtual hosts on one server. (virtual hosts = multiple IP's) Generally the additional IPs will cost you more from your ISP.

gohard 01-28-2008 06:58 PM

Quote:

Originally Posted by farslayer (Post 3037591)
So you want two hostnames and two IP addresses for one machine and you want EXIM to send out using both identities ?

I'm not sure what you are trying to accomplish here, but the host name isn't really related to where the mail comes from on a domain basis. I would suggest using a generic hostname on the server and just let exim do it's thing. I am unaware of any way to truly give a machine 2 hostnames, and if the hostname isn't correct when they do a rDNS lookup, other mail servers will reject mail from you. the mail server passes it's hostname to the other mail server when communicating, the other server may then do a reverse lookup on the IP address of your mailserver ot ensure it is who it claims to be. you servers local hostname and rDNS entries MUST MATCH


If you just want to host mail for multiple domains on one server look into VIRTUAL DOMAINS

I want exim to send out under different ips and hostnames for certian domains that have a dedicated or shared ip.

I need this done because I resell hosting from my dedicated server and I also manage a mailing list from the same server. So I don't wan't the mail coming from my mailing list mixed up with the peoples mail who are buying hosting from me.

This way... If my main ip address gets blacklisted, my mailing list will not be affected.

I need an additional hostname because Exim is sending out all emails for my mailing list and those hosted on my server all from one main ip address even though I have assigned a new ip address to the domain where my mailing list is located.

I actually found out how to do this and it takes some configing of the exim.conf file but now each mail server still sends out mail from the main hostname in the header file.

So therefore I need to have an additional hostname for the domain i'm using to send emails out to my list.

I know this can be done because I see sites doing it.

For example:

Here are some of awebers mail servers:

mail4.aweber.com
smtp-01.aweber.com
smtp-02.aweber.com
smtp-03.aweber.com
smtp-a-01.aweber.com
smtp-confirmations-i-01.aweber.com
smtp-confirmations-w-01.aweber.com
smtp-corp-01.aweber.com

each of these have a dedicated ip address in which they send
mail out from.



Joe

zoranp 01-29-2008 03:05 AM

Or simply create alias for eth0

http://www.cyberciti.biz/tips/ubuntu...rk-device.html

gohard 01-29-2008 07:01 PM

Quote:

Originally Posted by zoranp (Post 3038544)

hmm...

That doesn't seem to solve my problem. I already have exim
set up to send from my unique ip address instead of the
primary one...

The problem now is that I need to create a new host name
under the dedicated ip i'm using for my mailing list
because exim is still putting the old host name in the
greeting and some email clients are rejecting it because
they cannot find the correct host for my domain.

The ips don't match..

So once again. I would like to know how to add a new
HOSTNAME that has its own ip address.

Thanks guys for your time. ;-)

Ricio 01-29-2008 08:57 PM

Youre best shot at that for what i've been reading here is to use qemu, xen or vmware!

gohard 01-29-2008 10:14 PM

Quote:

Originally Posted by Ricio (Post 3039483)
Youre best shot at that for what i've been reading here is to use qemu, xen or vmware!

Hi Rico,

What do these programs do?

Joe

farslayer 01-29-2008 10:53 PM

Is Google broken ? Trying not to be rude (and probably failing), but couldn't you search the suggestions first ?
If you had at least looked to see what they where, I could understand asking which one someone thought was better, but to not put forth ANY effort on your own part.. :(

http://en.wikipedia.org/wiki/X86_virtualization

personally I wouldn't virtualize a mail server if handles any type of volume and is probably doing AV and spam-filtering.

javaroast 01-29-2008 11:12 PM

This seems like it might be what you are lookng for.

http://servertune.com/kbase/entry/209/

This code works with Exim 4.4.x and 4.6x (currently 4.68)
(adapted from http://forums.cpanel.net/showthread.php?t=65044)

SSH to the server and edit /etc/exim.conf

Find default settings in Main Configuration section of your exim.conf near the top:

smtp_banner = "$ ESMTP Exim $ \
\#$ $ \n\
We do not authorize the use of this system to transport unsolicited, \n\
and/or bulk e-mail."

Replace with:

smtp_active_hostname = ${lookup{$interface_address}lsearch{/etc/ip_hostnames}{$value}{$primary_hostname}}

smtp_banner = "$ ESMTP Exim $ \
\#$ $ \n\
whatever text or message you would like to put in here about UBE or your service\n\"

next in TRANSPORT CONFIGURATION section near end of exim.conf

Find:

remote_smtp:
driver = smtp

Replace or comment out with:

remote_smtp:
driver = smtp
interface = ${lookup{$sender_address_domain}lsearch{/etc/domain_ips}{$value}{$interface_address}}
helo_data = ${lookup{$interface_address}lsearch{/etc/ip_hostnames}{$value}{$smtp_active_hostname}}

Create two files in /etc for the lookups.
domain_ips contains a list of the domains and their IP addresses, eg:
domain1.com 111.111.111.111
domain2.com 222.222.222.222

If Exim can't find the domain in the file, it will use the current IP instead.

ip_hostnames contains a list of the dedicated IPs and their host names, eg:
111.111.111.111 mail.domain1.com
222.222.222.222 mailserver.domain2.com

If Exim can't find the IP in the file, it will use the current host name instead.

gohard 01-29-2008 11:12 PM

Quote:

Originally Posted by farslayer (Post 3039559)
Is Google broken ? Trying not to be rude (and probably failing), but couldn't you search the suggestions first ?
If you had at least looked to see what they where, I could understand asking which one someone thought was better, but to not put forth ANY effort on your own part.. :(

http://en.wikipedia.org/wiki/X86_virtualization

personally I wouldn't virtualize a mail server if handles any type of volume and is probably doing AV and spam-filtering.

LOL yea Farslayer, sorry.

Right after I posted that I went to Google and looked
it up. I'm brand new to all this and I've been spending
the last 4 days straight learning how to config exim
and other programs on my new dedicated server.

So I'm a bit out of it.

Yea but I don't think this would be a good option
for me either being that I do handle a list of over 20k
which I mail to often.

I know there has to be a way I can add an addition
hostname cause right now all mail is being sent by the
main host even though there are different ips sending
out mail for a specific domain.

This is causing a lot of my emails to get refused
from mail providers cause my hostname don't match my
domain ip.

gohard 01-30-2008 01:42 AM

Quote:

Originally Posted by javaroast (Post 3039572)
This seems like it might be what you are lookng for.

http://servertune.com/kbase/entry/209/

This code works with Exim 4.4.x and 4.6x (currently 4.68)
(adapted from http://forums.cpanel.net/showthread.php?t=65044)

SSH to the server and edit /etc/exim.conf

Find default settings in Main Configuration section of your exim.conf near the top:

smtp_banner = "$ ESMTP Exim $ \
\#$ $ \n\
We do not authorize the use of this system to transport unsolicited, \n\
and/or bulk e-mail."

Replace with:

smtp_active_hostname = ${lookup{$interface_address}lsearch{/etc/ip_hostnames}{$value}{$primary_hostname}}

smtp_banner = "$ ESMTP Exim $ \
\#$ $ \n\
whatever text or message you would like to put in here about UBE or your service\n\"

next in TRANSPORT CONFIGURATION section near end of exim.conf

Find:

remote_smtp:
driver = smtp

Replace or comment out with:

remote_smtp:
driver = smtp
interface = ${lookup{$sender_address_domain}lsearch{/etc/domain_ips}{$value}{$interface_address}}
helo_data = ${lookup{$interface_address}lsearch{/etc/ip_hostnames}{$value}{$smtp_active_hostname}}

Create two files in /etc for the lookups.
domain_ips contains a list of the domains and their IP addresses, eg:
domain1.com 111.111.111.111
domain2.com 222.222.222.222

If Exim can't find the domain in the file, it will use the current IP instead.

ip_hostnames contains a list of the dedicated IPs and their host names, eg:
111.111.111.111 mail.domain1.com
222.222.222.222 mailserver.domain2.com

If Exim can't find the IP in the file, it will use the current host name instead.


Hi javaroast,

Wow we actually posted at the same exact time as one another.

Thats probably why I overlooked this. ;-)

The code that you have provided is pretty much
the way I have it set up now but the only thing
different is that this puts the actual hostname
in the greetings/header files.

And thats exactly what I need to be doing. But
the only problem is I still only have 1 hostname.

I need to learn how to add an additional host
name to my dedicated server so my server can
read just like the code above.

Any thoughts on how I would go about that one?

Thanks for everyones help, I really appreciate
it. ;-)

Joe

javaroast 01-31-2008 02:55 AM

Ok, maybe I'm just a little dense and missing something, but if you have an additional IP wouldn't external DNS handle the naming for you. The mail host is going to do lookups to the authoritative DNS server not your box. So with the code above handling the sends from the separate IP's I would think you should be all set.

gohard 01-31-2008 03:27 AM

Quote:

Originally Posted by javaroast (Post 3040823)
Ok, maybe I'm just a little dense and missing something, but if you have an additional IP wouldn't external DNS handle the naming for you. The mail host is going to do lookups to the authoritative DNS server not your box. So with the code above handling the sends from the separate IP's I would think you should be all set.

Hi Java,

Yes this is true and I have an dedicated ip address.
But the problem is that there is only one hostname
for the "external DNS" to handle and that is my
main hostname.

Today when I edited:

PHP Code:

 /etc/host 

I added a second hostname: (host2.mydomain2.com)

PHP Code:

::1        localhost6.localdomain6 localhost6 
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1        localhost 
000.000.00.10        host1
.mydomain1.com host1
000.000.00.11           host2
.mydomain2.com host2 

I then added an a entry in my dns for host2.mydomain2.com
and ip 000.000.00.11 under mydomain2.com's DNS entry.

But now, it seems like the second hostname is taking
over as the primary hostname and thats where all the
mail is sending from now.

I guess that the new host is not set up right
huh??

I'm kinda lost with this whole thing and I think
once I figure out how to add a new host that will
be the solution to my problem being that the script
above has to read the hostnames in order to send the
mail correctly?

QUICK UPDATE: I am now getting an error from DNS STUFF
stating the following...

mydomain2.com claims to be non-existent host hos2.mydomain2.com: <br /> 220-mydomain2.com ESMTP Exim 4.68 #1 Thu, 31 Jan 2008 04:51:07 -0500 220-We do not authorize the use of this system to transport unsolicited, 220 and/or bulk e-mail. <br />

So know for a fact that the new hostname is not set up correctly.

Joe


All times are GMT -5. The time now is 11:44 AM.