LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-27-2008, 10:16 PM   #1
gohard
LQ Newbie
 
Registered: Jan 2008
Posts: 7

Rep: Reputation: 0
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? ;-)

Last edited by gohard; 01-27-2008 at 10:18 PM.
 
Old 01-28-2008, 03:59 AM   #2
j-ray
Senior Member
 
Registered: Jan 2002
Location: germany
Distribution: ubuntu
Posts: 1,532

Rep: Reputation: 132Reputation: 132
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...

Last edited by j-ray; 01-28-2008 at 08:51 AM.
 
Old 01-28-2008, 09:05 AM   #3
farslayer
LQ Guru
 
Registered: Oct 2005
Location: Willoughby, Ohio
Distribution: linuxdebian
Posts: 7,232
Blog Entries: 5

Rep: Reputation: 190Reputation: 190
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
 
Old 01-28-2008, 10:19 AM   #4
DotHQ
Member
 
Registered: Mar 2006
Location: Ohio, USA
Distribution: Red Hat, Fedora, Knoppix,
Posts: 542

Rep: Reputation: 33
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.
 
Old 01-28-2008, 07:58 PM   #5
gohard
LQ Newbie
 
Registered: Jan 2008
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by farslayer View Post
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
 
Old 01-29-2008, 04:05 AM   #6
zoranp
Member
 
Registered: Nov 2007
Location: Belgrade, RS
Distribution: Mandriva 2009.0 X86_64
Posts: 44

Rep: Reputation: 15
Or simply create alias for eth0

http://www.cyberciti.biz/tips/ubuntu...rk-device.html
 
Old 01-29-2008, 08:01 PM   #7
gohard
LQ Newbie
 
Registered: Jan 2008
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by zoranp View Post
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. ;-)
 
Old 01-29-2008, 09:57 PM   #8
Ricio
Member
 
Registered: Sep 2003
Location: Colombia
Distribution: Debian
Posts: 220

Rep: Reputation: 30
Youre best shot at that for what i've been reading here is to use qemu, xen or vmware!
 
Old 01-29-2008, 11:14 PM   #9
gohard
LQ Newbie
 
Registered: Jan 2008
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Ricio View Post
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
 
Old 01-29-2008, 11:53 PM   #10
farslayer
LQ Guru
 
Registered: Oct 2005
Location: Willoughby, Ohio
Distribution: linuxdebian
Posts: 7,232
Blog Entries: 5

Rep: Reputation: 190Reputation: 190
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.
 
Old 01-30-2008, 12:12 AM   #11
javaroast
Member
 
Registered: Apr 2005
Posts: 131

Rep: Reputation: 19
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.
 
Old 01-30-2008, 12:12 AM   #12
gohard
LQ Newbie
 
Registered: Jan 2008
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by farslayer View Post
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.
 
Old 01-30-2008, 02:42 AM   #13
gohard
LQ Newbie
 
Registered: Jan 2008
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by javaroast View Post
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
 
Old 01-31-2008, 03:55 AM   #14
javaroast
Member
 
Registered: Apr 2005
Posts: 131

Rep: Reputation: 19
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.
 
Old 01-31-2008, 04:27 AM   #15
gohard
LQ Newbie
 
Registered: Jan 2008
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by javaroast View Post
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

Last edited by gohard; 01-31-2008 at 04:58 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
adding ip to server thok Linux - Networking 1 10-24-2007 06:28 PM
Adding a New client to the server sachin_shetty Linux - Server 2 01-06-2007 12:00 AM
My Server.... resolving hostnames! SyncMaster Linux - Networking 2 06-25-2005 01:56 AM
Allowing DHCP server access only to certain hostnames TVH Linux - Networking 3 11-23-2004 01:50 AM
Adding a second website to the server mithras Linux - Newbie 1 01-17-2004 01:22 PM


All times are GMT -5. The time now is 06:40 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration