email

Wednesday, April 8, 2009

How to find the remote machine OS easily

Do you ever got a requirement to findout what Operating System(OS) the remote machines has? You might say, "Ah! I am a sysadmin, it's my daily task". Good, how will you findout the OS, if you don't have any sort of rights(console right/admin rights/ports access) on remote machine?

Hmm..It's simple now!!

You might have many windows and UNIX boxes in your network. If you know one machine name and if you want to find if that machine has windows or UNIX os, try the below steps.

JUST PING IT.

Yes, right. You just ping that machine. If the TTL shows as 127 or less it is windows box and if the TTL shows 254 or less it is a UNIX box.

Test it if you don't believe.

c:\>ping windowsbox

Pinging windowsbox.mydomain.com [172.16.100.10] with 32 bytes of data:

Reply from 172.16.100.10: bytes=32 time=15ms TTL=127
Reply from 172.16.100.10: bytes=32 time<1ms TTL=127
Reply from 172.16.100.10: bytes=32 time<1ms TTL=127

c:\>ping unixbox

Pinging unixbox.mydomain.com [172.16.100.20] with 32 bytes of data:

Reply from 172.16.100.20: bytes=32 time=15ms TTL=254
Reply from 172.16.100.20: bytes=32 time<1ms TTL=254
Reply from 172.16.100.20: bytes=32 time<1ms TTL=254

The thing is that windows machine will return 128 as TTL by default and Unix machine returns 255 as TTL. And this TTL will get reduced by one(TTL --) when there is just one hop between your computer and the remote box. And will get reduced by two when you have two hops...and gets reduced by N where are N hops.

Happy Learning..,
Sitaram Pamarthi

9 comments:

  1. Hey, would be great if you let us know why windows has a TTL of 127 and Unix has a TTL of 254. Thanks for the post.

    ReplyDelete
  2. See this if you are looking for a way to do it with PowerShell

    http://www.sitaram-pamarthi.com/2009/08/findout-operating-system-of-remote.html

    ReplyDelete
  3. On a Windows box (tested on XP, Vista, and 7) you can use the $systeminfo command.

    Open a CMD line and type "systeminfo /?" (no quotes, obviously) to find out how to use it.

    VERY useful tool as it will tell you a LOT more than "well this Should be a windows box of Some sort... I hope."

    ReplyDelete
  4. sorry your statement is wrong.


    If i ping the unix box its says TTL =63

    ReplyDelete
  5. your statement is wrong


    if i ping unix box TTL=63
    TTL=63
    TTL=63
    TTL=63

    ReplyDelete
  6. Thanks everyone for your comments. I am glad that this post helped you to resolve your issue. A year back I moved my blog to http://techibee.com. That is the reason I couldn't respond to your comments very soon.

    I appreciate if you can push the further comments to http://techibee.com/tips/how-to-find-the-remote-machine-os-easily-2/120.

    Thanks again

    ReplyDelete
  7. @vivek, what version/flavor of unix you have? It might be differing between flavors. Get in touch in my new blog(http://techibee.com/tips/how-to-find-the-remote-machine-os-easily-2/120) for further discussion.

    @anonymous: I agree that systeminfo is useful but not for the purpose we are talking here. Feel free to visit/comment in my new blog if you have any questions.

    ReplyDelete
  8. Good post. very useful

    ReplyDelete
  9. But how to check different OS in windows box (XP, Vista, Win7..)...?

    can you help me to find the task..??

    ReplyDelete