[CentOS] 6.2 How to change hostname for each individual IP

Sun Apr 8 07:19:46 UTC 2012
Jonathan Vomacka <juvix88 at gmail.com>


On 4/6/2012 11:18 AM, Johnny Hughes wrote:
> On 04/06/2012 08:18 AM, Jonathan Vomacka wrote:
>> Good day,
>>
>> I was wondering if there was a way to change the hostname for each
>> individual IP address allocated to a system. For example if only one NIC
>> card is being used (single port) and the hostname of the machine is
>> "example.example.org", this hostname is being displayed for all
>> applications no matter what IP I set the application to BIND to. My
>> server has multiple IP addresses setup as an ALIAS and ive tried setting
>> up ptr's, A records, and even specifying the new hostname in /etc/hosts.
>> No matter what I do when I connect to the application it read
>> "example.example.org" which is the hostname of the machine rather then
>> the hostname I want it to read on a particular IP. Is this possible to
>> change?
>
> If you are talking about when you ssh to the machine (or for anything
> else that would use the hostname variable that it gets from the machine)
> then I do not know of a way to make it be different based on the IP that
> you connect to.
>
> If you are using something that does DNS names, then if you setup the
> proper forward and reverse records it will work.
>

I am referring to when binding one of the IP alias to an application. 
For example if I take any application installed on my server and tell it 
to connect to another source from a specific IP alias, or listen on a 
specific alias, there are issues with the hostname. When an external 
source does a lookup, it comes with the server's hostname instead of the 
hostname I want to show up for that specific IP. Do you know why this 
happens?

I've already edited /etc/hosts to point the IP to a specific hostname.
I've already added a proper PTR and A record for the IP address which 
match. Is there anything else I need to do at this point?