<% Function Valid_IP(IPAddr) 'Due to the constraints of VBScript I had to use the CByte function instead of declaring the variable as a byte Dim part(3), Period, IP On Error Resume Next IP = IPAddr For i = 0 To 2 'Find the period in the string Period = InStr(1, IP, ".") part(i) = CByte(Mid(IP, 1, Period - 1)) IP = Mid(IP, Period + 1, Len(IP) - Period) err.clear Next part(3) = CByte(IP) If Err.Number > 0 Then Valid_IP = False Err.Clear Else Valid_IP = True End If End Function Function checkmask(Mask) Dim aryMask, Number, x aryMask = Split(Mask,".") If UBound(aryMask) <> 3 then checkmask = false Else For x = 0 To UBound(aryMask) 'this returns true if the Mask is a valid mask If CInt(aryMask(x)) <> 255 And CInt(aryMask(x)) <> 0 And CInt(aryMask(x)) <> 128 And _ CInt(aryMask(x)) <> 224 And CInt(aryMask(x)) <> 240 And CInt(aryMask(x)) <> 248 And _ CInt(aryMask(x)) <> 252 And CInt(aryMask(x)) <> 254 Then checkmask = False Exit For Else checkmask = True End If Next End If End Function If Request.ServerVariables("REQUEST_METHOD") = "POST" Then Dim aryIpAddress, aryMask strIPAddress = Request.Form("IP") strMask = Request.Form("Mask") aryIPAddress = Split(strIPAddress, ".") aryMask = Split(strMask,".") If Not Valid_IP(strIPAddress) Then Response.Write "" & vbCrLf Else If Not checkmask(strMask) Then Response.Write "" & vbCrLf Else Response.Redirect "ip_calculator_result.asp?IP=" & strIPAddress & "&Mask=" & strMask End If End If End If %> CCNA Certification Tools: Subnetting Calculator

  
 
 
 

Subnetting Calculator

Submit an IP Address and subnet mask and get information such as:
  • Network address
  • All possible subnets
  • Class & type of the IP address
  • Hosts per subnet, subnets
  • Binary representations of the address information
Sample IP & Subnet Mask: 192.168.2.18, 255.255.255.240

This tools can also be useful solving many CCNA exam style subnetting questions such as:
- Which subnet will host 192.168.2.18 belong to, as per the mask 255.255.255.240?
- What is the network address for a host with the IP address given by 123.200.8.68 255.255.255.192 ?
...and so on.


IP Address
Subnet Mask