Discuss Can't ping hostnames, only IPs in the Linux Help forum on Dev Shed. Can't ping hostnames, only IPs Linux Help forum discussing topics including usage, troubleshooting, modules, and distributions. Linux is an open source OS, based on UNIX.
Posts: 51
Time spent in forums: 17 h 5 m 7 sec
Reputation Power: 8
Can't ping hostnames, only IPs
Trying to transition all my machines over from XP to Ubuntu, but I'm running into the same problem on every Ubuntu machine...
Internet works fine, and I can get to places like google.com by name. But when I try to ping hostnames on my home network from Ubuntu, the ping says "ping: unknown host <HOST>". If I ping IPs on the local network (e.g. ping 192.168.1.1), this goes through fine...
This also happens the other way around (pinging Ubuntu machines from other machines). Can't ping hostnames, only IPs.
Posts: 407
Time spent in forums: 2 Days 3 h 9 m 8 sec
Reputation Power: 24
Quote:
Originally Posted by johnnybeem
Trying to transition all my machines over from XP to Ubuntu, but I'm running into the same problem on every Ubuntu machine...
Internet works fine, and I can get to places like google.com by name. But when I try to ping hostnames on my home network from Ubuntu, the ping says "ping: unknown host <HOST>". If I ping IPs on the local network (e.g. ping 192.168.1.1), this goes through fine...
This also happens the other way around (pinging Ubuntu machines from other machines). Can't ping hostnames, only IPs.
Any idea what's wrong??
you might have to add all the IP's into DNS, I don't think unix works the same as windows in regards to DNS, I think that Windows broadcasts all the names around the network, but Im not sure if *nix does.
Posts: 51
Time spent in forums: 17 h 5 m 7 sec
Reputation Power: 8
alright, well I did some google-ing and got it working almost how I want it...
I installed some avahi, mdns, zeroconf packages (forget which ones) and now can ping from Windows <--> Ubuntu by pinging HOSTNAME.local
Still can not ping actual hostnames (e.g. ping HOSTNAME)... However, strange thing is I started a Samba server on one Ubuntu computer and now from Windows I can "ping HOSTNAME". Could *not* do that before I started Samba.
On Ubuntu, I still need to ping everything with .local
Does anyone know if it's possible to ping without requiring the .local extension?? There must be a way
Posts: 1
Time spent in forums: 11 m 53 sec
Reputation Power: 0
a possible solution
Quote:
Originally Posted by fishtoprecords
I'm not exactly sure I understand the problem you are describing, but if you have luck with :
ping foo.local
but
ping foo
fails, then you need to set your "default search domain'
In Debian/Ubuntu, you can add the line:
domain mydomain.com
in your /etc/resolve.conf
Not sure what the equivalent is in Windows
In linux and windows there are host files
in linux /etc/hosts in windows \windows\system32\drivers\etc\hosts + lmhost in those files you add
entries like ip address hostname ( it's kind of an alternative
to setting up a dns) in windows you tell inthe network setting
( the advanced setting to use the host file.
When you ping the hostname of a computer the right
ip address replies the same goes for linux\
Posts: 39
Time spent in forums: 15 h 32 m 28 sec
Reputation Power: 5
Windows also added netbios names which can be resolved by lmhosts, wins server or name query broadcast messages ... which helps any windows computer on the local network be able to find another by name without the help of dns servers, etc.
Posts: 1
Time spent in forums: 23 m 46 sec
Reputation Power: 0
A possible name problem solution.
If your local network is small, you could do the following. Copy a single file /etc/hosts file to each of the machines on your network. This file maps
computer names to IP addresses.
This method becomes little unwieldy if you have a lot of machines on the network, if so then I suggest writing a shell script to automate this process a little bit, using the rcp command, or even better the rsync command.
Another option is that you could run a local name server and have all of the
local machines first try to resolve the ip addresses on the local DNS first, and then use the network DNS provider if there is no name to IP matching.
This way you only have one file to update and transfer one file.
Posts: 2
Time spent in forums: 26 m 33 sec
Reputation Power: 0
Try this little trick....
before you all get too carried away.
when winbind is installed, it's always nice to add "wins" to the hosts: line in /etc/nsswitch.conf.
Code:
hosts: files dns mdns wins
This will allow ordinary TCP/IP programs to resolve hostnames with netbios, so you can, for instance, do "ping <hostname>" instead of "ping 192.168.1.xxx". Of course, ping isn't all that wonderful, but it's a lot easer to do "ftp hostname" or "ssh hostname" or browse to "http://hostname" than using raw IP's for the local machines (assuming of course they are running the given service and the forewall on the target machine allows access to the right ports).
Posts: 407
Time spent in forums: 2 Days 3 h 9 m 8 sec
Reputation Power: 24
Well done - you've dug up a 4 year old thread....
Quote:
Originally Posted by m_drunk
before you all get too carried away.
when winbind is installed, it's always nice to add "wins" to the hosts: line in /etc/nsswitch.conf.
Code:
hosts: files dns mdns wins
This will allow ordinary TCP/IP programs to resolve hostnames with netbios, so you can, for instance, do "ping <hostname>" instead of "ping 192.168.1.xxx". Of course, ping isn't all that wonderful, but it's a lot easer to do "ftp hostname" or "ssh hostname" or browse to "http://hostname" than using raw IP's for the local machines (assuming of course they are running the given service and the forewall on the target machine allows access to the right ports).
Posts: 2
Time spent in forums: 26 m 33 sec
Reputation Power: 0
Quote:
Originally Posted by punkboii
Well done - you've dug up a 4 year old thread....
Yeah well....think Google cares how old it is? Top spot in Google with no answer. And while everything above is right, it's not how the problem is generally solved.
Posts: 407
Time spent in forums: 2 Days 3 h 9 m 8 sec
Reputation Power: 24
Can't really say fairer than that...
Quote:
Originally Posted by m_drunk
Yeah well....think Google cares how old it is? Top spot in Google with no answer. And while everything above is right, it's not how the problem is generally solved.
Posts: 2,108
Time spent in forums: 1 Month 1 Week 1 Day 4 h 48 m 25 sec
Reputation Power: 1485
Yeah, but any question to which the suggested answer is, "let's add WINS ..." is just a wrong question!!! <troll/>
__________________
The moon on the one hand, the dawn on the other:
The moon is my sister, the dawn is my brother.
The moon on my left and the dawn on my right.
My brother, good morning: my sister, good night.
-- Hilaire Belloc