why I cannot ping my machines in my LAN with hostname?
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
why I cannot ping my machines in my LAN with hostname?
Hi,
I have a linux server in my LAN. After this server is startup, I can see in my route configure page, that it is registered with the hostname 'mylinux', which is correct. On another machine which runs windows, it cannot ping my linux server with its hostname. On my linux server, it cannot ping any machine in my LAN with their hostname, but it can ping host that is on the Internet. Ex:
ping MyBoxInLan # it reports host unknown
ping www.linuxquestions.org # works alright.
I use dhcpd on my linux server to register it in my LAN. In the /etc/resolve.conf file, it says:
nameserver IP1.Of.MyISP
nameserver IP2.Of.MyISP
I tried to append the IP of my LAN's route at last, and restart dhcpd, but it won't solve my problem.
Edit /etc/nsswitch.conf and change the line that looks like: hosts: files dns to hosts: files dns wins.Post if that's all that you need.
Quote:
Each computer running Windows has a NetBIOS name; you can view/change it on the identification tab in Control Panel -> Network. Various services & client tools, including Network Neighborhood and NET USE, use NetBIOS names. The NetBIOS name is specified when Windows networking is installed/configured. In order to connect to a computer running TCP/IP via its NetBIOS name, the name must be resolved to an IP Address (the NetBIOS name-IP address resolution is often done by WINS - NetBIOS Name Server). A computer's NetBIOS name is often the same as that computer's host name (see below), but it doesn't have to be.A Windows machine's NetBIOS name is not to be confused with the computer's host name. Each computer running TCP/IP (whether it's a Windows machine or not) has a host name (also sometimes called a machine name). You can view/change it on the DNS tab in Control Panel -> Network -> TCP/IP -> Properties Host names are used by applications such as telnet, ftp, web browsers, etc. In order to connect to a computer running the TCP/IP protocol using its HOST name, the host name must be resolved into an IP Address (the host name or FQDN (Fully Qualified Domain Name)-IP address resolution is typically done by something called DNS - Domain Name System/Service). Changing a computer's Host name DOES NOT change its NetBIOS name.
You should add your list of hostnames to each /etc/hosts file on Linuxes - on Windows theres is also a hosts file somewhere with similar intent. Without linking an IP to a hostname a system has no way to guess where to look, unless you maintain your own DNS service and have added each of the hostnames to your DNS configuration. It is not clear from your post if have those hostnames in your DNS - if so, then maybe some error slipped in there.
I dont think your ISP DNS resolve your LAN hostname so you will have to configure local DNS or
As "gergely89" mentioned you can solve this problem
For Linux
vi /etc/hosts
172.16.11.1 host1.domain.com
172.16.11.2 host2.domain.com
like this....
For Windows
C:\WINDOWS\system32\drivers\etc\hosts
ipaddress1 hostname.domain.com
ipaddress2 hostname.domain.com
like this....
of course, my ISP cannot resolve my machines in my LAN. But windows uses WINS to resolve the machine's in a LAN, just as alan_ri suggested. Unfortunately, adding 'wins' to my /etc/nsswitch.conf does now work.
I have been searching the web for a while, but none of the solutions solves my problems...
I am using Gentoo Linux 2008. Not sure if this problem only exist on this distribution.
user@it-lenny:~$ apropos netbios
lmhosts (5) - The Samba NetBIOS hosts file nmbd (8) - NetBIOS name server to provide NetBIOS over IP naming services to clients nmblookup (1) - NetBIOS over TCP/IP client used to lookup NetBIOS names
Post the contents of your nsswitch.conf file. wins will not work if you don't have a WINS server. Samba can do that for you.
The hosts file will work if you have fixed IP addresses. I believe the Windows fallback is still broadcast mode, but you'll need to have that in your nsswitch.conf I think.
I had this issue, but we are running a samba server so I just turned on WINS server in samba, added wins to the nsswitch.conf options and all was well.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.