LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Can't ping linux machine by hostname (https://www.linuxquestions.org/questions/linux-networking-3/cant-ping-linux-machine-by-hostname-47268/)

jdklein1975 02-26-2003 01:29 PM

Can't ping linux machine by hostname
 
The hostname of my linux machine is 'linux1' and the IP address is 192.168.0.169. From my windows machine, I can ping the IP address successfully but when I try to ping 'linux1' I get a message:

Unknown host linux1

I can ping 'linux1' successfully on the 'linux1' box. Do I need to do something to get the hostname registered with my DNS server?

I am running a wireless network with a DLink DI-713P wireless router.

Is there an easy way to register the hostname with DNS? I am assuming that Windows does this automatically since I did not take any manual steps to do this on my Windows machines and they can be pinged by hostname on all other machines.

BaerRS 02-26-2003 01:48 PM

Yes, this is a DNS issue..
Are you running a DNS.. if you are, then you would need to enter the info for your linux1 box, and have all the compuers look to the same DNS server.

Im going to assume your not running your own DNS..
Theirfore, you would need to modify the hosts file on your Windows box...

on my (at work) Win 2k box its located at:
c:\WINNT\system32\drivers\etc\hosts

It may be someplace else on other version of Windows..
and it may have a .sam at the end (for sample)
copy it and rename it to "hosts"


It should look something simular to this:

# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host

127.0.0.1 localhost


just add the following to the end of the file:

192.168.0.169 linux1

ping something stupid...

ping lkjljlkjlh

then ping linux1

and it should work.

rockdw 02-26-2003 01:48 PM

The reason your Windows machines work is because they are probably using netbios to resolve names. This, it itself, has nothing to do with DNS. Unfortunately, you do need to tell the windows machines about non netbios names, either through DNS or with a hostfile. If it's just one or two machines, you can add an entry to %systemroot%\system32\drivers\etc\hosts (this path varies sightly depending on the version of Windows) on the windows machine to tell it about linux1, otherwise, you will need to add it to DNS somewhere.

You do have an option to use netbios with samba and wins if you REALLY want to use the Windows based name resolution, but I would recommend against it if at all possible.

dunkyb 02-26-2003 01:49 PM

windows (xp/2k at least) maintains a list similar to /etc/resolv.conf on linux, named lmhosts...

this can be found in c:\windows\system32\drivers\etc, iirc.

add your linux box's netbios name there, and see if it works :)

HTH,

Duncan


All times are GMT -5. The time now is 10:22 AM.