Solved

How to ping a windows computer

Posted on 2004-08-17
21
488 Views
Last Modified: 2010-04-20
What is the correct syntax to ping local Windows XP computer from a Linux box?
0
Comment
Question by:Axter
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 6
  • 3
  • +3
21 Comments
 
LVL 38

Expert Comment

by:yuzh
ID: 11827438
Use:

ping IP-add

eg:
ping 10.5.0.1

or
send 1 package only (good for programming, scripting etc)
ping 10.5.0.1 -c 1

If your WinXP PC have defined in DNS, or it is defined in your Linux box's /etc/hosts
file, you can ping by name

man ping
to learn more details
0
 
LVL 1

Expert Comment

by:ekukiela101
ID: 11827758
Hi,

I will go over many different things in ping.

First, if you want to do a normal ping, you should do as yuzh said:

ping 192.168.0.XX (assuming your network is 192.168.0.x)

However, if you would like to send an ICMP 8 (ping) 3 times, you should use:

ping -c 3 192.168.0.XX

If you would like to change the packet length (no, I didn't give this out for packet kiddies), use:

ping -s 25 192.168.0.XX

Hope it helps,
Eddie
0
 
LVL 30

Author Comment

by:Axter
ID: 11828096
I'm sorry, I guess I wasn't specific in my question.
I know how to ping using the IP address.

What I want to do is to ping using the name of the machine.
From my windows computer, I can ping the Linux box using it's name, and I don't have to modify my hosts file.

So I'm trying to accomplish the same thing in the Linux box.

How can I ping my Windows XP machine via name (NOT IP) without having to add XP machine to my hosts file?
0
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
LVL 38

Expert Comment

by:yuzh
ID: 11828188
If you WinXP box has a DNS entry definded in the DNS server and your Linux box is
setup as DNS client which has the correct DNS server infor in it, then you can use ping by name.

see my comment in http:#11827438
0
 
LVL 22

Expert Comment

by:pjedmond
ID: 11828445
One other little problem ...perhaps? is that XP has a built in firewall. This firewall may prevent it from answering pings if configured. Assumming that it responds to a ping to the ip then the firewall is no problem. If it doesn't respond, then:

Start->Control Panels

Network Connections

Right click on the interface, and select properties

Select the advanced tab, and click settings. Check that either the firewall is set to on, and allows exceptions, or that the firewall is switched off.

Note that various other 'security suites', Zone Alarm and other firewall type products mmay prevent pinging from occurring, and will need to be correctly configured, or disabled for you o ping successfully.

Note that disabling any firewall reduces your PCs protection from the nasties on the net - Umbrella up, and arse covered;)
0
 
LVL 30

Author Comment

by:Axter
ID: 11828531
>>Linux box is setup as DNS client which has the correct DNS server infor in it, then you can use ping by name.

How can I verify that my Linux box has the correct DNS setup as a client?
0
 
LVL 20

Expert Comment

by:Gns
ID: 11829262
Check your /etc/resolv.conf file. Do you have your nameservers IP address in a "nameserver x.x.x.x" entry? If not, add it there.

-- Glenn
0
 
LVL 20

Expert Comment

by:Gns
ID: 11829270
Oh, and checking that name lookups work can be done by one of the tools host, dig or (old and deprecatied) nslookup ...

-- Glenn
0
 
LVL 30

Author Comment

by:Axter
ID: 11829352
>>Check your /etc/resolv.conf file. Do you have your nameservers IP address in a "nameserver x.x.x.x" entry? If not, add it there.

Yes, I already have it there.
0
 
LVL 30

Author Comment

by:Axter
ID: 11829356
>>Oh, and checking that name lookups work can be done by one of the tools host, dig or (old and deprecatied) nslookup ...

Don't understand this.  Please explain.
0
 
LVL 20

Expert Comment

by:Gns
ID: 11829374
So ... does
host somehostname.somedomain.tld
or
dig ...
or
nslookup ...
work?
If you want "unqualified names" to be assumed part of a specific domain (other than the domain of the local machine, or as specified in a "domain local.domain.tld" entry), you need a
search somedomain.tld
in /etc/resolv.conf

-- Glenn
0
 
LVL 30

Author Comment

by:Axter
ID: 11830371
>>host somehostname.somedomain.tld
I'll try this out tonight when I have access to the Linux Box.

>>dig ...
>>or
>>nslookup ...

What is dig and nslookup?


>>If you want "unqualified names" to be assumed part of a specific domain (other
>>than the domain of the local machine, or as specified in a "domain
>>local.domain.tld" entry), you need a search somedomain.tld
>>in /etc/resolv.conf

What do you mean by "need a search somedomain.tld"???

Most of my Windows Computers do not have a static IP address.  Infact, I only have one Windows computer (Adv Server 2000), which has a static IP address.
So it's not practical for me to enter IP address in hosts file.

I want to set it up so that the Linux box can find all the Windows computers with out having to add each Windows computer name to a file in the Linux box.

0
 
LVL 20

Accepted Solution

by:
Gns earned 250 total points
ID: 11830933
> What is dig and nslookup?
Two other commands that you can use the same way as "host", more or less:-). Some (or all) might be installed.

> What do you mean by "need a search somedomain.tld"???
If your host has the FQDN "myhost.mydomain.com", then the "domain part" would be "mydomain.com"which would make your resolver assume that "thatotherhost" is in fact "thatotherhost.mydomain.com"... And you can make this explicit in the /etc/resolv.conf file with a line like
domain mydomain.com
Now say you'd want to be able to use "thatotherhost" for "thatotherhost.thatotherdomain.com", then you'd need "search" that domain too for the unqualified name "thatotherhost. You do that by having a line
search thatotherdomain.com
in /etc/resolv.conf ... Clearer?
It's not a bad idea to be ... explicit, even if it's not really needed:-).

> So it's not practical for me to enter IP address in hosts file.
Of course you shouldn't.

Once you have the resolver set OK, you should have no problems like that.
Are we to understand that the windoze server is the DNS server?

-- Glenn
0
 
LVL 30

Author Comment

by:Axter
ID: 11831167
>>Are we to understand that the windoze server is the DNS server?

No, I have a cable router that assigns the IP address.
0
 
LVL 1

Expert Comment

by:ekukiela101
ID: 11831181
Hi,

You're looking for /etc/hosts. This file allows you to do this. If you want to ping "192.168.0.1" by "router", you'd do:

router            192.168.0.1

in your /etc/hosts file.

Hope it helps,
Eddie
0
 
LVL 1

Expert Comment

by:ekukiela101
ID: 11831189
Sorry, that should be:

192.168.0.1              router
0
 
LVL 20

Expert Comment

by:Gns
ID: 11831201
Ok... "assigns the IP address." == DHCP != DNS.
So it provides (local) DNS service as well?
Or are you relying on the usual netbios/widoze heuristical fallbacks for this?

-- Glenn
0
 
LVL 20

Expert Comment

by:Gns
ID: 11831228
No Eddie, Axter has already stated that s/he has a DNS server (although I'm a bit wondering about that:-), and that /hosts files aren't acceptable.

-- Glenn
0
 
LVL 38

Assisted Solution

by:yuzh
yuzh earned 250 total points
ID: 11837829
Hi Axter,
    Glenn has given you  good explanations.
   
    If all your M$ PC and Linux boxes are DHCP client, and you still want to use "ping
by name" without using files (/etc/hosts), you need to use Dynamic DNS server, you
can setup your own or ask your ISP to host it for you, all you PCs have to have DNS
record, if you have only a few PC, it is ok, not a big deal. For most of the PCs, you really
don't need a DNS record just for ping.

   More information about DDNS server/client setup FAQ:
   http://www.aboutdebian.com/dns.htm
   http://www.siliconvalleyccie.com/linux-hn/dns-dynamic.htm
   http://www.dyndns.org/services/dyndns/faq.html
   http://www.dyndns.org/support/kb/nat.html
   http://labmice.techtarget.com/networking/dns.htm
   http://www.badblue.com/helpdd.htm

   Good luck!
0
 
LVL 2

Expert Comment

by:astrand
ID: 11877138
If you want to look up the IP using NetBIOS, try this command:

ping `nmblookup THEXPNAME | tail -1 | awk '{print $1}'`
0
 
LVL 30

Author Comment

by:Axter
ID: 11877576
Thanks Gns and yuzh

Gns, I realized after you posted your previous comment, that I don't have a DNS.

I'm going to setup my own DNS server.
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will explain how to establish a SSH connection to Ubuntu through the firewall and using a different port other then 22. I have set up a Ubuntu virtual machine in Virtualbox and I am running a Windows 7 workstation. From the Ubuntu vi…
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question