Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 494
  • Last Modified:

How to ping a windows computer

What is the correct syntax to ping local Windows XP computer from a Linux box?
0
Axter
Asked:
Axter
  • 7
  • 6
  • 3
  • +3
2 Solutions
 
yuzhCommented:
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
 
ekukiela101Commented:
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
 
AxterAuthor Commented:
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
yuzhCommented:
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
 
pjedmondCommented:
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
 
AxterAuthor Commented:
>>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
 
GnsCommented:
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
 
GnsCommented:
Oh, and checking that name lookups work can be done by one of the tools host, dig or (old and deprecatied) nslookup ...

-- Glenn
0
 
AxterAuthor Commented:
>>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
 
AxterAuthor Commented:
>>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
 
GnsCommented:
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
 
AxterAuthor Commented:
>>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
 
GnsCommented:
> 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
 
AxterAuthor Commented:
>>Are we to understand that the windoze server is the DNS server?

No, I have a cable router that assigns the IP address.
0
 
ekukiela101Commented:
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
 
ekukiela101Commented:
Sorry, that should be:

192.168.0.1              router
0
 
GnsCommented:
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
 
GnsCommented:
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
 
yuzhCommented:
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
 
astrandCommented:
If you want to look up the IP using NetBIOS, try this command:

ping `nmblookup THEXPNAME | tail -1 | awk '{print $1}'`
0
 
AxterAuthor Commented:
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

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

  • 7
  • 6
  • 3
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now