3

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.

4 Answers 4

6

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.

2
  • 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, 2009 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? Jun 9, 2009 at 17:20
3

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

1
  • +1 for creativity, assuming he has the rights on the local server to run the psexec script. Jan 15, 2011 at 18:56
2

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.

0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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