Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I know I can ping a server name and determine the IP address. But are there commands I can use to determine the subnet? I'm using Windows XP.

share|improve this question

4 Answers 4

up vote 6 down vote accepted

No. Subnetting is generally hard/impossible to determine from afar - why do you need it?

Strictly speaking, you don't determine the IP address of the server using ping either - ping just uses the normal resolver to determine the IP address and prints it out before going on to do its main task, testing whether a host is up by sending an ICMP echo request message and awaiting ICMP echo reply messages.

A tool that's actually built to find name mappings from DNS is host, or, more recent, dig, from the BIND DNS server client tools. Dig is a fantastically useful tool and every sysadmin should be able to use it.

Bonus information: You can find out who owns the IP block to which the address belongs and how big it is using whois on an IP address, just like you would on a domain.

share|improve this answer
    
My company is asking what subnet to put a new server on. So, I want to put it on the same subnet as another computer that I'm familiar with, but don't have access to login to. Fortunately, I can find this info in a directory that is maintained manually. –  Jim Jun 9 '09 at 12:38
    
Are you sure that the new server needs to go on the same subnet as the existing one? Unless you are doing anything specific with link-local broadcast or multicast applications this may not be the case? –  Murali Suriar Jun 9 '09 at 17:20

Write a script to psexec ipconfig on the remote server and parse the output for the subnet mask.

share|improve this answer
    
+1 for creativity, assuming he has the rights on the local server to run the psexec script. –  JamesBarnett Jan 15 '11 at 18:56

With some trial and error, you can use "tracert" from the command line to ping neighboring IP addresses to see where the route ends up. That is, assuming there's no firewall blocking ICMP requests.

tracert 10.0.0.1
tracert 10.0.0.2
tracert 10.0.0.4
tracert 10.0.0.8
etc.
tracert 10.0.1.1

If the second-to-last IP stays the same, you're in the subnet. Of course, with NAT and the fact that many hosts block these requests, you're probably out of luck.

share|improve this answer

In theory a type '17' ICMP (ping) request should work for you, but I don't know how widely supported this is anymore.

http://www.rhyshaden.com/icmp.htm

http://www.ietf.org/rfc/rfc792.txt

ICMP Address Mask Ping (-PM)
http://www.networkuptime.com/nmap/page4-8.shtml
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.