Check if two CIDR addresses intersect?

后端 未结 4 2044
时光说笑
时光说笑 2020-12-16 14:40

Given two CIDR addresses say 192.168.2.0/14 and 192.168.2.0/32

How do I check if two ip addresses overlap in \"python2.6\"??

I have gone through netaddr and

4条回答
  •  暖寄归人
    2020-12-16 15:08

    I wrote this simple command line tool, based on the netaddr lib.

    pip install ipconflict
    

    Example:

    ipconflict 10.0.0.0/22 10.0.1.0/24
    

    Output:

    conflict found: 10.0.1.0/24 <-> 10.0.1.0/22
    

提交回复
热议问题