LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   hostname resolution locally (https://www.linuxquestions.org/questions/linux-networking-3/hostname-resolution-locally-742404/)

adevendra 07-24-2009 02:01 AM

hostname resolution locally
 
I have two IP's configured on same port eth0-169.254.100.10 and eth0:1 - 169.254.100.110.

I would like to assign two hostnames to them say tinku.myhost.com and tinku-secondry.myost.com and two processes using them.

I would like to get 169.254.100.10 when using host tinku.myhost.com and 169.254.100.110 when using hostname tinku-secondry.myhost.com.

Is there a way apart from setting up a local dns server.

Simon Bridge 07-24-2009 02:08 AM

You can enter the resolution in each computers /etc/hosts file

kirukan 07-24-2009 02:10 AM

add it on your /etc/hosts
ip address1 hostname1
ip address2 hostname2

from where you are accessing these servers you will have to add these entries on each servers /etc/hosts file

adevendra 07-24-2009 09:58 AM

Thank you simon and kirukan. I did that b4 posting but didn't help. :-( I am using rhel 4.6

Simon Bridge 07-24-2009 10:16 AM

what do you mean "didn't work", what is in /etc/hosts and how did you test it?

You have two IPs for the same nic?
There are several ways to do this - which did you use?

adevendra 07-24-2009 10:52 AM

added following in /etc/hosts

169.254.100.10 tinku-myservertinku.myhost.com
169.254.100.110 tinku-secondary.myhost.com

And then restarted network service and ran
$>host tinku-secondary.myhost.com
Host tinku-secondary.myhost.com not found: 3(NXDOMAIN)

I get similar error with host tinku.myhost.com.

When i run hostname i get tinku.myhost.com

Suncoast 07-24-2009 01:04 PM

Quote:

Originally Posted by adevendra (Post 3619026)
added following in /etc/hosts

169.254.100.10 tinku-myservertinku.myhost.com
169.254.100.110 tinku-secondary.myhost.com

And then restarted network service and ran
$>host tinku-secondary.myhost.com
Host tinku-secondary.myhost.com not found: 3(NXDOMAIN)

I get similar error with host tinku.myhost.com.

When i run hostname i get tinku.myhost.com

Try this
Code:

169.254.100.10      tinku-myservertinku  tinku-myservertinku.myhost.com.
169.254.100.110    tinku-secondary  tinku-secondary.myhost.com.

Note the dot at the end of the full name.

Simon Bridge 07-24-2009 10:16 PM

In addition to Suncoast...

you did not soy how you set up the interface to have two IPs.
you did not provide the rest of the hosts file ... is tinku.myhost.com an alias for loopback?

properly set up, this host should present two IPs to the network. Have you tried altering the hosts file for other hosts on the network? See if you can, thus. ping by hostname?


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