Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

name resolution problem in local environment

Status
Not open for further replies.

keak

Programmer
Sep 12, 2005
247
CA
Hi there,
I have four boxes, and they are connected to the same router.
The problem I am having is that one of them currently is not reachable by the other 3 boxes. I am pretty new to the name resolution issue, but does anyone know how a linux box unix/linux box obtains its ip.

In /etc/hosts I have the line
127.0.0.1 localhost.localdomain localhost server1

and everything is fine if I do "ping on server1"

Howerver, if I try to ping server1 from the other boxes (server2, server3, server4), I get 100% packet loss. (I can ssh either to server1).

I know this is a rather general question, but any pointer to places I should look at will be of great help.

Thanks
 
Are you attempting to ping by name or by IP?

Do an ifconfig on your linux box and get its IP address (should be eth0 in your case). Then try to ping it by using ping <ip_address> rather than ping <name>.

If you don't have an IP address, then you need to look at your networking configuration.


pansophic
 
I tried pinging from another box for server1 by ip (address for eth0) and I got 100% packet lost. Any ideas where I should look at to further analyze this problem?


When I ping/ssh from the actual box using this same ip, I get correct responses.
 
127.0.0.1 localhost.localdomain localhost

are allways bound to the local machine itself.
It's like the word 'me' or 'I' for humans.

The adress 127.0.0.1 is never reachable from a different host.

You need a real networkadress like

192.168.44.2 server1.mynet server1

on every hosts /etc/hosts -file, corresponding to the number the server1 has as pansophic suggests.

The way to configure your network, if
Code:
ifconfig eth0
doesn't show an IPv4-Adress might differ from distribution to distribution.
Perhaps you may set a fix adress in the router. They often contain an dhcpserver, which randomly chooses an adress.


seeking a job as java-programmer in Berlin:
 
How are you configuring eth0? Is it DHCP or static? What are the addresses of the machines and their netmasks?


pansophic
 
Ok, I am looking at something qutie confusing.

I think what is happening is that a given domain name is directed to two different boxes (I believe its for load balancing).
So I have in one box the /etc/hosts file (I am using a randomly made up ip)
205.16.3.543 server1 server1.domain.com

and on another box, I have
205.16.3.543 server2 server2.domain.com

when I try to ssh locally to server1, I get directed to server2 instead.
Is there anyway I can ssh to server1 ? When I try to ssh server1 from the other boxes (located within the same LAN), it gets directed to server2.
 
I've never seen two boxes with the same IP address for load sharing. AFAIK there is no way to get packets to the other box. Whichever box is highest in the switch's ARP cache will be the one that is reached. Normally load sharing is performed by having a DNS server that passes out alternating IPs based on a name request.

What are you using to do the load sharing?

And are you really using the /etc/hosts file for name resolution? That is so 1980s.


pansophic
 
I don't believe that's your IP: 205.16.3.543
a) The maximum number is 255 for each part.
b) The numbers 205.16.3.xyz don't belong to private adress-space, and therefore it's not very probable you choose them randomly.

@pansophic: What's the problem with /etc/hosts for a small network (4 boxes)?

seeking a job as java-programmer in Berlin:
 
There's nothing wrong with it, it is just old fashioned. And I assume, since he is running load sharing, that it is not a 4 box network. After all, how much load can 2 machines put on a single server? And besides, it is almost as easy to set up a DNS server as to populate an /etc/hosts file. And you only ever have to do it on one box.

If you read the post, he said he made the IP addresses up. I just assumed that it was a clever way of disguising a box that is really 205.16.3.43.


pansophic
 
From "(I am using a randomly made up ip)" I thought of a dial-in connection, and therefore hobby or small-business network.
.543 made this assumption stronger.

"a given domain name is directed to two different boxes" sounds reasonable - not a given hostname.

All in all confusing.

keak: You may give your device a second IP and use that for ssh independent of the public IP:

Code:
ifconfig eth0:1 192.168.4.234 up
Add it to the hostfile on machine x, and ping it, ssh it, ...

seeking a job as java-programmer in Berlin:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top