# resolving remote names works - names on lan not

## jameskearney

Hi,

My ethernet card and settings seem to be set up correctly (the ip address / gateway / netmask are all correct) 

and I can ping www.google.co.uk for example...

but when I try to ping another computer on the lan - I get an unknown host error.

hostname gives me the name that I had set in /etc/hostname

my /etc/resolv.conf has a domain entry on the first line and a nameserver on the second line. The ip address of the nameserver is correct.

~ hostname 

gives me the hostname that I have set

but 

~ hostname --fqdn

gives me a "hostname: Host name lookup failure"

my /etc/hosts file has

127.0.0.1             localhost

192.168.254.99    hostname.domain.com

followed by some ipv6 stuff.

I also get a temporary failure in name resolution when booting up the computer...

can't think of any other information that I could give that would help diagnose the problem, but please let me know if there is anything else I can check...

thanks very much in advance

james

----------

## gnuageux

Can you post the contents of your hosts file? To make sure that Ive got this correct, in /etc/hosts you have:

192.168.50.253                  someserveronmylan

From bash (or the shell of your choice)

$ping someserveronmylan fails with a hostname lookup failure?

----------

## jameskearney

james@box jk $ cat /etc/hosts

gives 

127.0.0.1             localhost

192.168.254.99    busybox.somedomain.com

# more ipv6 of localhost follow here

fyi, 192.168.254.99 is the ip address of my linux box, and the name of my linux box is "busybox" (according to `hostname`) and "somedomain.com" is the domain that i have put into /etc/dnsdomainname.

pinging google.com gets a response - so I am I right in thinking the gateway that I have put in /etc/conf.d/net is correct (I know the ip address of the router)

thanks very much

james

----------

## jameskearney

sorry - extra information I think you wanted:

doing "ping busybox.somedomain.com" gets a response, but doing "ping busybox" does not get a response (ping: unknown host busybox).

hope that helps

james

----------

## davidblewett

 *jameskearney wrote:*   

> 192.168.254.99    busybox.somedomain.com
> 
> 

 

Should be:

```
192.168.254.99    busybox.somedomain.com    busybox
```

 I believe.

----------

## jameskearney

thanks very much - that does indeed fix the resolution of the actual linux box (ie when i do "ping busybox" it now gets a response)

however - i am more concerned with resolving the names of other machines on the lan...

for example there is another machine called "wibble" and doing "ping wibble" results in an unknown host error.

I would prefer not to have to manually type the ip address of each machine vs name on the network into the /etc/hosts file - especially since i would guess that some of the ip-addresses against names would change - because it is dhcp. Rather I want to be able to say "ping machine" where "machine" is on my network and have the dns server return the correct ip address. Strangley ping hosts such as google do not result in this error. There are also windows boxes on the network that are able to do "ping machine" - so I would think that it is not the fault of the machine doing dns - but rather something i have done wrong - which is highly likely  :Smile: 

any help much appreciated!

thanks guys

----------

## davidblewett

If you have control over the DNS/DHCP system used on the LAN, you can switch to dnsmasq. It does exactly what you want, keeping track of hostnames and IP addresses based on dhcp requests. I'm not sure if you have many options otherwise.

----------

## jameskearney

is dnsmasq something that i would install on the linux box so that it can keep track of what name maps to what ip address?

could you tell me why the windows boxes seem to be able to do "ping machine" ok - but the linux box does not? Is it not the dns server providing the ip address of the requested machine on the lan?

apologies for all the questions, but I want to get the linux box working without changing the configuration of the lan, as I would not want to risk breaking anything for the hundred windows users, as the only nix user  :Very Happy: 

thanks

----------

## DaveArb

 *jameskearney wrote:*   

> could you tell me why the windows boxes seem to be able to do "ping machine" ok - but the linux box does not?

 

Do you have a Windows Server providing DNS on that network? There is a dynamic DNS component in that OS, that I'm not sure is compatible with non-Windows OSs.

 *jameskearney wrote:*   

> Is it not the dns server providing the ip address of the requested machine on the lan?

 

Assuming the earlier, is your Linux box pointing at the Windows Server for name resolution?

Dave

----------

## davidblewett

dnsmasq is a Unix utility. It would have to be installed on the server that hosts the current DNS/DHCP services. It sounds like that is not an option. DaveArb is on the right track about name resolution. I believe it's called NetBIOS. In order to use it, I think you would need to install samba on your machine and point the server to the correct WINS server for you network. See this for more info:

http://www.oreilly.com/catalog/samba/chapter/book/ch07_03.html

----------

## jameskearney

I think that there is a windows box providing dns - i am not sure what protocol it is using maybe wins or something i guess.

where should the dns server be configured anyway? The conf.d/net is for the ipaddress of the box and the netmask and gateway - should it go in there as well? Or is it the /etc/hosts file - or is that just a list of ip-addresses versus names?

>> Assuming the earlier, is your Linux box pointing at the Windows Server for name resolution? 

not sure - where do I check this...

is it me, or am I getting more confused the further I go along   :Shocked: 

thanks v much

----------

## DaveArb

 *davidblewett wrote:*   

> I believe it's called NetBIOS.

 

No, what I'm think of is RFC 2136 dynamic DNS. An old but pretty good overview is at http://www.winntmag.com/Articles/Index.cfm?ArticleID=7187 .

Dave

----------

## jameskearney

thanks david - yes I am reading about getting wins going under samba at the moment... hopefully this will result on being able to just "ping wherever" on the network and have it resolve.

I will let you know whether the samba route resolves the issue...

thanks again everyone for all the help

----------

## DaveArb

 *jameskearney wrote:*   

> where should the dns server be configured anyway?

 

We have some overlapping responses going on...  :Wink: 

Your nameserver goes in /etc/resolv.conf, as in:

```
nameserver 192.68.0.1
```

Where the IP is the address of the DNS box.

Dave

----------

## jameskearney

haha as for the conflicting replies I seem to be doing well with the "thanks dave" option at the moment  :Very Happy: 

the nameserver - the windows machines are set up to use a windows domain controller as the primary dns - so i assume this is WINS.

i have tried both the ip address of the router, and of the windows machine providing DNS to the other windows machines in the /etc/resolv.conf file - both to no-avail... should I have to reload/restart/reboot anything before attempting pings in between these changes.

In which case since both of these ip addresses failed to allow resolution of machines on the network, I guess my last option is samba once again (which I doing at the moment).

thanks

j

----------

## think4urs11

Hi!

i think by adding

```
search somedomain.com
```

 to your /etc/resolv.conf your problem should bes solved.

Thereby if you use a hostname only in e.g. ping the domain is added automatically.

HTH

T.

----------

## nobspangle

 *jameskearney wrote:*   

> the nameserver - the windows machines are set up to use a windows domain controller as the primary dns - so i assume this is WINS.

 

DNS is not WINS, if you have a Windows domain then you will have a WINS server installed on each domain controller and a DNS server as well. Names on new Windows domains 2k or 2k3 are resolved using DNS as well as WINS on older domains (NT4) names are resolved using WINS.

Install samba and set 

wins proxy = yes

wins server = ip.of.domain.controller

then put 127.0.0.1 as your nameserver in resolv.conf and you should be able to resolve netbios names over dns.

----------

## DaveArb

As nobspangle wrote, WINS is different than DNS. If the Windows boxen have a Windows DC for DNS, it is in fact serving DNS.

Comment to crowd: I wonder if the Linux box will work by simply using that DC as its nameserver, forgetting about WINS entirely? My network doesn't use Windows DNS, so I can't check that.

Dave

----------

## jameskearney

Hi everyone,

thanks very much for the help with this, I have now pretty much resolved it (most machines are now "pingable" just using the hostname.

Unfortunately throughout the different changes I was trying to "ping fnord" - which has turned out to be a machine that I cannot resolve to an ip address for some reason - but pinging other windows machines - although did not work at first - now does work - but I cannot say exactly at which stage it started working.

To benefit anyone else reading this thread, I did the following,

- Added the windows domain controller machines as nameserver entries to the /etc/resolv.conf

- Changed the line in resolv.conf that specified my own machine from "ipaddress name" to "ipaddress name name.somedomain.com"

- Added a "search somedomain.com" entry to the /etc/resolv.conf file (see post above).

- Installed, and configured samba with "wins server = ipaddress", where ip address was the ip address of the domain controller.

These steps have enabled me to see other machines on the network, bar only a couple.

I then tried adding "127.0.0.1" to the resolv.conf as per the previous post, to see if it would make a difference, but the few machines that i still cannot ping, remain unresolvable - although are pingable from other windows boxes.

I hope that helps,

thank you everyone so much for the help, 

james

----------

## think4urs11

 *jameskearney wrote:*   

> ...but the few machines that i still cannot ping, remain unresolvable - although are pingable from other windows boxes.
> 
> ...

 

check the dns settings of these boxes, especially their dns domain - it should differ.

If thats the case simply add the new domain to your searchlist

----------

## jameskearney

I checked the tcp/ip settings for the adapter on one of the machines i could not reach from the gentoo box - it is on the same internal ip space (192.168.etc.etc) and has the same gateway / dns settings as other machines.

the advanced tcp/ip settings have the option "Register this connections addresses in dns" checked, if that makes any difference.

ipconfig for the unreachable box gives:

--8<--

Host Name . . . . . . . . . . . : barbaz

Primary DNS suffix . . . . . : 

IP Routing Enabled . . . . . : No

WINS Proxy enabled . . . . : No

--\--

so it seems WINS is not enabled for the machine, and it doesn't have a DNS suffix - which might make the difference??

Although if this is the case, I would wonder how the other windows machines can resolve it, but my little linux box can't.

I will make this work, and I will convert the rest of the network.   :Laughing: 

maybe

----------

## davidblewett

I think what Think4UrS11 meant was to check the DNS settings for the machines that *can* ping the ones that you can't. I.e., they may be using a different DC, or have a different search domain.

----------

## think4urs11

no i didn't mean that  :Wink: 

the cause for the win boxes beeing able to resolve the name but the linux boxes can't is IMHO because Win uses WINS/broadcast/whatever if the default name resolution fails.

the search domain is just a little helper for beeing able to resolve names which are in annother domain than the linux box without the need to type the FQDN.

If your DNS is setup properly you should be able to do an reverse lookup - which then should give you the domain for the boxes  - host/nslookup 'ip address'

----------

## jameskearney

aaah, I see - well my linux box doesn't seem to have a 'host' command, and I also tried dig, but it doesn't seem to be on there by default.

From a windows box 'nslookup 192.168.254.4'  (the ip address of the machine I cannot resolve from linux box) gives:

"can't find 192.168.254.4: Non-existent domain"

I tried to "dig" from cygwin on the windows box as well - but it doesn't seem to have it either...

from the windows machine doing "ping wibble" gets a response, but doing "nslookup wibble" is unresolved.

I think this is going to be some strange way that windows is getting the address and linux can't... 

so I think my best attempt was enabling WINS on samba and setting "nameserver = 127.0.0.1" as one of the name servers - but I have tried this - and it doesn't seem to have worked.

Is there some way that I can check that samba\wins is working properly?

thanks everyone for the help, if I run out of options then I can still get to most of the machines on the lan now, so I can live without getting to these few (although wouldn't you know it "wibble" just happens to be the pop server, so I will have to hard code the ip into my mail client now... yes I know - its a hard life).

james

----------

