FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > CentOS > CentOS

 
 
LinkBack Thread Tools
 
Old 04-06-2012, 01:18 PM
Jonathan Vomacka
 
Default 6.2 How to change hostname for each individual IP

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?
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 04-06-2012, 03:18 PM
Johnny Hughes
 
Default 6.2 How to change hostname for each individual IP

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.

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 04-08-2012, 07:19 AM
Jonathan Vomacka
 
Default 6.2 How to change hostname for each individual IP

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?
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 04-08-2012, 07:52 AM
John R Pierce
 
Default 6.2 How to change hostname for each individual IP

On 04/08/12 12:19 AM, Jonathan Vomacka wrote:
> 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?

the name of the host is constant, it doesn't change with the IP address
that a specific connection happens to be using.

but, when you say, 'external source does a lookup', what /exactly/ do
you mean?



--
john r pierce N 37, W 122
santa cruz ca mid-left coast

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 04-08-2012, 08:59 AM
Jonathan Vomacka
 
Default 6.2 How to change hostname for each individual IP

On 4/8/2012 3:52 AM, John R Pierce wrote:
> On 04/08/12 12:19 AM, Jonathan Vomacka wrote:
>> 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?
>
> the name of the host is constant, it doesn't change with the IP address
> that a specific connection happens to be using.
>
> but, when you say, 'external source does a lookup', what /exactly/ do
> you mean?
>

One example is an IRC bouncer. I configured the app to bind to a
particular IP to listen on and to connect to the designated IRC servers
with. When I connect the hostname reflects the machine hostname rather
then the hostname I want to come up on the IP address.

Other applications seem to perform the same. Is it impossible to specify
hostnames for IP aliases. Perhaps hostname is the wrong terminology but
I figured RDNS and forward DNS would do the trick..
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 04-08-2012, 09:21 AM
Markus Falb
 
Default 6.2 How to change hostname for each individual IP

On 8.4.2012 10:59, Jonathan Vomacka wrote:
> On 4/8/2012 3:52 AM, John R Pierce wrote:
>> On 04/08/12 12:19 AM, Jonathan Vomacka wrote:
>>> 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?
>>
>> the name of the host is constant, it doesn't change with the IP address
>> that a specific connection happens to be using.
>>
>> but, when you say, 'external source does a lookup', what /exactly/ do
>> you mean?
>>
>
> One example is an IRC bouncer. I configured the app to bind to a
> particular IP to listen on and to connect to the designated IRC servers
> with. When I connect the hostname reflects the machine hostname rather
> then the hostname I want to come up on the IP address.
>
> Other applications seem to perform the same. Is it impossible to specify
> hostnames for IP aliases. Perhaps hostname is the wrong terminology but
> I figured RDNS and forward DNS would do the trick..

I think you are talking about the source ip used when your process is
doing a connect to the bad world outside. Process is listening on IPb
but when it does a connect IPa is used as source adress in the IP header.
?
--
Kind Regards, Markus Falb

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 04-08-2012, 09:54 AM
Johnny Hughes
 
Default 6.2 How to change hostname for each individual IP

On 04/08/2012 03:59 AM, Jonathan Vomacka wrote:
> On 4/8/2012 3:52 AM, John R Pierce wrote:
>> On 04/08/12 12:19 AM, Jonathan Vomacka wrote:
>>> 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?
>> the name of the host is constant, it doesn't change with the IP address
>> that a specific connection happens to be using.
>>
>> but, when you say, 'external source does a lookup', what /exactly/ do
>> you mean?
>>
> One example is an IRC bouncer. I configured the app to bind to a
> particular IP to listen on and to connect to the designated IRC servers
> with. When I connect the hostname reflects the machine hostname rather
> then the hostname I want to come up on the IP address.
>
> Other applications seem to perform the same. Is it impossible to specify
> hostnames for IP aliases. Perhaps hostname is the wrong terminology but
> I figured RDNS and forward DNS would do the trick..
When you assign an IP addresss to a service, you are assigning a
LISTENING address (the IP that the service gets connections from) ... in
most cases, you are not assigning an OUTBOUND address for the service
but only an inbound address.

If you are talking about OUTBOUND connections from the machine to
another machine, then it always uses the "Default Gateway from the Main
IP" to make outbound connections ... so if you have 10 IPs on a Network
Card, it will always use the non-alias IP address to make outbound
connections by default unless you have other static routes set.

You can likely create some special route rules to change that ...
however, I personally do not know of any that work based on the
program/service being run.

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 04-09-2012, 02:11 PM
Lamar Owen
 
Default 6.2 How to change hostname for each individual IP

On Friday, April 06, 2012 09:18:27 AM Jonathan Vomacka wrote:
> 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?

Well, it probably isn't. Hostnames should not be confused with FQDN's that map to IP addresses; they are different (even though CentOS will by default grab its hostname from reverse DNS if it gets its main interface's IP address by DHCP (in the case of multiple interfaces, there is a preferred interface that will assign the hostname)).

Hostnames belong to the host OS. FQDN's belong to their respective IP addresses; and IP addresses belong to their respective interfaces, not to the host. I know that's splitting hairs, but you're hitting the very corner case that splits this particular hair. The host itself does not have an IP address. Even in the case of a non-localhost-addressed loopback, the IP address belongs to the loopback interface, not to the host.

This has been true for a very long time; I've run multiple alias interfaces since kernel 2.0 days on Red Hat Linux 4.1 (not RHEL, but old RHL), and this has been the behavior for at least that long.

A host can only have one name (this is true for basically any IP host, whether it's a Linux system, a BSD system, a Windows system, or a Cisco router. Especially on a router with a lot of interfaces (broadband aggregation routers, for instance, can have thousands of interfaces with each one having a unique IP) you don't want the name of the IP associated with the interface to override the hostname. And the hostname does not have to match what DNS says about the FQDN that belongs to any interface on the system (I have a few of those, too).

Now, I can't quote RFC 'chapter and verse' on this, but I have never seen a system where you could do what you're describing. (that doesn't mean they don't exist, just that I've not seen one in my limited experience of AT&T Unix SVR2, Xenix V7 and SIII, Apollo DomainOS, and Solaris).
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 04-09-2012, 02:17 PM
 
Default 6.2 How to change hostname for each individual IP

Lamar Owen wrote:
> On Friday, April 06, 2012 09:18:27 AM Jonathan Vomacka wrote:
>> 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?
<snip>
> A host can only have one name (this is true for basically any IP host,
> whether it's a Linux system, a BSD system, a Windows system, or a Cisco
> router. Especially on a router with a lot of interfaces (broadband
> aggregation routers, for instance, can have thousands of interfaces with
> each one having a unique IP) you don't want the name of the IP associated
> with the interface to override the hostname. And the hostname does not
> have to match what DNS says about the FQDN that belongs to any interface
> on the system (I have a few of those, too).
>
> Now, I can't quote RFC 'chapter and verse' on this, but I have never seen
> a system where you could do what you're describing. (that doesn't mean
> they don't exist, just that I've not seen one in my limited experience of
> AT&T Unix SVR2, Xenix V7 and SIII, Apollo DomainOS, and Solaris).

A thought just hit me as I browsed this: Jonathon, do you want to do this
to allow for load balancing?

mark

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 04-10-2012, 03:32 PM
Blake Hudson
 
Default 6.2 How to change hostname for each individual IP

Lamar Owen wrote the following on 4/9/2012 9:11 AM:
> On Friday, April 06, 2012 09:18:27 AM Jonathan Vomacka wrote:
>> 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?
> Well, it probably isn't. Hostnames should not be confused with FQDN's that map to IP addresses; they are different (even though CentOS will by default grab its hostname from reverse DNS if it gets its main interface's IP address by DHCP (in the case of multiple interfaces, there is a preferred interface that will assign the hostname)).
>
> Hostnames belong to the host OS. FQDN's belong to their respective IP addresses; and IP addresses belong to their respective interfaces, not to the host. I know that's splitting hairs, but you're hitting the very corner case that splits this particular hair. The host itself does not have an IP address. Even in the case of a non-localhost-addressed loopback, the IP address belongs to the loopback interface, not to the host.
>
> This has been true for a very long time; I've run multiple alias interfaces since kernel 2.0 days on Red Hat Linux 4.1 (not RHEL, but old RHL), and this has been the behavior for at least that long.
>
> A host can only have one name (this is true for basically any IP host, whether it's a Linux system, a BSD system, a Windows system, or a Cisco router. Especially on a router with a lot of interfaces (broadband aggregation routers, for instance, can have thousands of interfaces with each one having a unique IP) you don't want the name of the IP associated with the interface to override the hostname. And the hostname does not have to match what DNS says about the FQDN that belongs to any interface on the system (I have a few of those, too).
>
> Now, I can't quote RFC 'chapter and verse' on this, but I have never seen a system where you could do what you're describing. (that doesn't mean they don't exist, just that I've not seen one in my limited experience of AT&T Unix SVR2, Xenix V7 and SIII, Apollo DomainOS, and Solaris).

Lamar is correct that the system only allows one hostname. However, many
server applications can identify themselves with a user configurable
name instead of the machine hostname - the hostname is often a fallback
when nothing else has been configured.

For example, Apache allows you to use the name of the virtualhost
instead of the server hostname. We run postfix on multiple IPs and it
allows you to specify a hostname per listener; proftpd, cyrus, and
several others allow the same. Check your application to see if it
allows a per host or ip configuration. This may involve defining
multiple instances if you want to listen on different IP addresses and
have a unique configuration per IP.

--Blake
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 

Thread Tools




All times are GMT. The time now is 08:46 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org