Link to home
Start Free TrialLog in
Avatar of JoeyBugeyes
JoeyBugeyesFlag for United States of America

asked on

What Subnet Am I In?

Hello,

If I do an IPConfig, I can find out the IP address and subnet mask of my Windows machine.  With this info, can I determine what AD subnet I'm on?

Thanks,
Joe
Avatar of JoeyBugeyes
JoeyBugeyes
Flag of United States of America image

ASKER

The reason I'm asking is because I'm trying to put together a script or at lease a procedure.  If I get that midnight call and says these 100 users can't log on...  I want to be able to ask for an IP address of an affected machine and do something like this...

1. based on IP, determine subnet they are on
2. look up subnet in AD Sites & Services to determine the DC they 'should' be connecting to.
3. check the DC(s) in question.

Thanks,
Joe
Do you mean what AD Site you are in? A subnet is a subnet. There is no such thing as an AD Subnet as such.

What exactly are you trying to find out?

Can you give example of what you would expect to find as a result?
Avatar of ITguy565
Neilsr,

I think I understand what he is referring to but he is using the wrong terminology. If I am reading this right he has site specific policies in place that vary from one location to another.

Example of this is :
http://technet.microsoft.com/en-us/library/cc731907.aspx
Now where I am confused is why he would need what he is asking for.

If you have your subnets mapped to different sites then you have probably already told Active Directory which server is linked to what site. If that is the case all you would need to do is ping the machine get the IP relate that to one of your DHCP scopes and that should tell you which server you are connecting to.
OK...

I apologize if I wasn't clear.  I'm certain I'm not using the correct terminology and perhaps not even asking a valid question.  But here's what I'm thinking.   We have a TON of sites and subnets.  If a group of people experience long logons, no logons, or other authentication issues, I want to be able to very quickly (perhaps even scripted) tell which domain controller is in trouble.  I understand that it may be other things such as network, but let's assume for now it's AD related.  By the way, there is currently no issue, but I just want to be prepared for next time.

1. Let's say I have an IP Address / subnet mask of a windows machine of 10.20.30.40 / 255.255.252.  This windows machine and all others in the same physical location is having trouble logging on.

2. If I plug this IP/subnet mask into a subnet calculator (http://www.subnetonline.com/pages/subnet-calculators/ip-subnet-calculator.php) it reveals to me that my machine is on the 10.20.28.0 network.  I assume this is the same thing as my 'subnet'.  Again, forgive my misuse of terminology.  If I'm wrong here, let me know.

3.  I now take this 10.20.28.0 and look for it in AD sites & Services to find out what site it's associated with.  Let's say it comes back with Trenton.

4.  Then I use AD Sites & Services to look up the 'Trenton' site to see what domain controllers service the site.

5. Now I can health check the the Trenton DCs .

So I guess what I'm really asking now is two things.  1) Are my steps correct/logical?  and 2) if so, is there a better way to do step number two above instead of having to use a subnet calculator?  Is there a command line tool or something?  I'm thinking command line because if this process is good, then I'd like to script it eventually.

What are your thoughts?  I'm sure I'll get this call from time to time and I don't want to get caught without a good process.

Thanks a bunch!

Joe
Have the user do an ipconfig /all and tell you what the dns server is. A lot of times that is also the domain controller.  You should also check dhcp and see what different scopes they have so that you will be familiar with the addresses. You can check the subnets in AD but that won't tell you much.  
Ipconfig /all should be enough.
Do you mean, within AD sites & services, the subnets that are defined here are assigned against sites?...
ASKER CERTIFIED SOLUTION
Avatar of mat1458
mat1458
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you very much for your answers.  <br /><br />Mat1458, <br />I was lucky and found a script that does exactly this process.  It's a winbatch script, but i have a compiler so I'm good there.  There's no direct link to the script, but you can go to techsupt.winbatch.com and search for "Useful ADSI Site server functions".<br /><br />172PilotSteve,<br />That's great info.  Thank you!!!!
WOW..  a winbatch user?!  How unusual!  I used to do a LOT of winbatch, and actually, somewhere I have a routine I wrote for EXACTLY this purpose - you pass it 2 IP addresses with mask, and it will tell you whether they're in the same subnet.

I wrote it because I had written a custom software deployment / workstation management system (kind of a mini SMS) and I used it to be able to target installs to certain subnets.

If that code would be handy for you, let me know, and I'll dig it out.  I KNOW I still have it SOMEWHERE..
Steve,

Oh yeah, I love Winbatch.  Don't bother digging out the script though.  The one on their site works pretty well.  I think it was some guy from NJ who wrote it, maybe Clifton area?  That wouldn't happen to be you, would it?  What a small world if so.

Joe
Nope..  Wasn't me..  I'm in Maryland..  Haven't used Winbatch in a couple years, but I'm a big fan too.  It's amazing what it can do.  I've been forced into Powershell, which is also really cool, but sometimes I miss the simplicity of winbatch...

Good luck and thanks!!