How to see if an IP address belongs inside of a range of IPs using CIDR notation?

后端 未结 7 2053
猫巷女王i
猫巷女王i 2020-12-09 08:54

Here I have a static reference the ranges I need to check:

private static List Ip_Range = new List()
{
    \"12.144.86.0/23\",
           


        
相关标签:
7条回答
  • 2020-12-09 09:50

    For start, you should use that:

    IPNetwork ipnetwork = IPNetwork.Parse("192.168.168.100/29");
    Console.WriteLine("CIDR: {0}", ipnetwork.Cidr);
    

    Output

    CIDR: 29
    
    0 讨论(0)
提交回复
热议问题