Check if network subnets are overlapping each other.

Use ipconflict Python package (source) to check if two or more network subnets are overlapping.

Install ipconflict Pythopn package.

$ pip3 install ipconflict
Defaulting to user installation because normal site-packages is not writeable
Collecting ipconflict
  Downloading ipconflict-0.5.0-py2.py3-none-any.whl (16 kB)
Collecting py-radix
  Downloading py-radix-0.10.0.tar.gz (21 kB)
  Preparing metadata ( ... done
Requirement already satisfied: netaddr in /usr/lib/python3/dist-packages (from ipconflict) (0.8.0)
Collecting tqdm
  Downloading tqdm-4.64.1-py2.py3-none-any.whl (78 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 78.5/78.5 KB 1.3 MB/s eta 0:00:00
Building wheels for collected packages: py-radix
  Building wheel for py-radix ( ... done
  Created wheel for py-radix: filename=py_radix-0.10.0-cp310-cp310-linux_x86_64.whl size=50897 sha256=d170ed0f783ffe973e03530aabd4dd3ee1e00d3c4a260a90cfb9c8174843b6ad
  Stored in directory: /home/milosz/.cache/pip/wheels/6d/29/5a/e5083f47e00dd79bf1e95d93c452440cff80d7ca16215cabed
Successfully built py-radix
Installing collected packages: py-radix, tqdm, ipconflict
  WARNING: The script tqdm is installed in '/home/milosz/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script ipconflict is installed in '/home/milosz/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed ipconflict-0.5.0 py-radix-0.10.0 tqdm-4.64.1

Ensure that binary directory is in PATH.

$ echo $PATH
$ export PATH=$PATH:~/.local/bin/

Update ~/.bashrc file accordingly.

Display help information.

$ ipconflict --help
usage: ipconflict [-h] [-f FROM_FILE] [-i] [-o] [-p] [-q] [-V] [subnets ...]

Check for conflicts between subnets.

positional arguments:
  subnets               list of subnets to be checked

  -h, --help            show this help message and exit
  -f FROM_FILE, --from-file FROM_FILE
                        load subnet definitions from file (one per line)
  -i, --from-stdin      load subnet definitions from stdin
  -o, --ip-only         print only the overlapping IP addresses
  -p, --print-conflicts
                        print overlapping IP addresses
  -q, --quiet           show progress status
  -V, --version         print ipconflict version

  ipconflict -f my-subnets.txt
  ipconflict -f my-subnets.txt

exit status:
  0: one or more conflicts found
  1: no conflict found
  2: aborted or invalid input

Check two network subnets for conflicts.

$ ipconflict  
100%|███████████████████████████████████████████| 2/2 [00:00<00:00, 13530.01subnet/s]
conflict found: <->

Inspect exit code.

$ echo $?

Use quiet mode.

$ ipconflict --quiet  
conflict found: <->

Display conflicting IP addresses.

$ ipconflict --quiet --ip-only --print-conflicts

Check different networks.

$ ipconflict --quiet  
no conflict found
$ echo $?

Additional notes

You can also display IP addresses for given network (, but notice that the list includes network (first) and broadcast (last) address.

$ ipconflict --quiet --ip-only --print-conflicts

Calculate usable IP addresses for given network (

$ expr $(ipconflict --quiet --ip-only --print-conflicts | wc -l) - 2