3
Well I'm not sure whether I'm missing something here. But all I've read is that if first octet of IP is within 0 - 127 then it is categorized as Class A subnet and correspondingly Subnet Mask for this is 255.0.0.0 but when I connect my system to Apple airport then my system gets IP as 10.0.1.4 however subnet mask is 255.255.255.0 not 255.0.0.0. Please explain what I'm missing here.
If there is something like for apple router subnet mask is calculated on some different flags then please let me know. This is what I'm doing currently in order to fetch subnet mask from an IP address.
if (ipAddress == null)
{
return ClassCSubnetMask;
}
byte byteipAddressFirstOctet = ipAddress.GetAddressBytes()[0];
if (byteipAddressFirstOctet <= 127)
{
return ClassASubnetMask;
}
else if (byteipAddressFirstOctet >= 128 && byteipAddressFirstOctet <= 191)
{
return ClassBSubnetMask;
}
else if (byteipAddressFirstOctet >= 192 && byteipAddressFirstOctet <= 223)
{
return ClassCSubnetMask;
}
return null;
For all those who are voting for closing this - I tried deleting this but did not work as it has answers. And in the mean while I've posted it on super user.
Thanks to everyone for waking me up on Subneting :)
2This is not a c# question. – Hans Z – 2012-06-08T13:23:32.097
Actually it will be once I found the answer to this. I need to pro grammatically fetch subnet mask. So either I can remove C# tag from here and post it another question but I thought to consolidate both things here. – Rohit – 2012-06-08T13:25:35.433
2@RohitKandhal The question as it stands doesn't even belong on this site, IMO. Your follow up question might do, however. – Adam Houldsworth – 2012-06-08T13:26:20.393
Okay. Maybe add the second part of your question to this one so people can answer them at the same time? – Hans Z – 2012-06-08T13:26:56.057
So should I post it on Programmers ? – Rohit – 2012-06-08T13:26:57.833
2@RohitKandhal You currently are not asking a programming question... I've voted to migrate it to Super User. – Adam Houldsworth – 2012-06-08T13:27:26.710
SuperUser is the site you need – Mihai Oprea – 2012-06-08T13:27:44.273
2@All do you think still I should move it to super user?? – Rohit – 2012-06-08T13:30:02.870
Is there someway I can directly move my question from stackoverflow to superuser? – Rohit – 2012-06-08T13:33:41.667
2@RohitKandhal If enough people vote to close as off-topic and select super user, it migrates automatically. – Adam Houldsworth – 2012-06-08T13:35:15.007
Close should be called Move really in many cases. People see "Closed" and think bah, unhelpful people. But if instead if said "Moved somewhere you're more likely to get help" it would be better. Anyway this is not a discussion for here :) – John Burton – 2012-06-08T14:38:46.540
1Google is your friend – mpontillo – 2012-06-10T08:08:07.893
Thanks Mike ... but I found that link when I searched for Inter-domain subnet routing.. – Rohit – 2012-06-10T12:05:15.267