Find Duplicate IP or MAC
========================

Commands
========
    - netq show ip routes [<ipv4>|<ipv4/prefixlen>] [vrf <vrf>] origin [around <text-time>] [json]
    - netq show ipv6 routes [<ipv6>|<ipv6/prefixlen>] [vrf <vrf>] origin count [around <text-time>] [json]
    - netq show macs [<mac>] [vlan <0-4096>] origin [around <text-time>] [json]

Usage
=====
Using the 'origin' option coupled with the 'count' option, its easy to find
duplicate route announcements.

    cumulus@torc-21:mgmt-vrf:~$ netq show ip routes 3.0.0.0/26 origin count
    Count of matching routes: 3
    cumulus@torc-21:mgmt-vrf:~$

The example above shows that the ip route 3.0.0.0/26 has been announced from
three nodes in the network. You can look at which nodes by issuing the same
command without the count option. JSON output is of course available for both
commands.

For checking duplicate MACs, the setup involves an external tool such as jq
(https://stedolan.github.io/jq/).

  cumulus@torc-21:mgmt-vrf:~$ netq show macs 44:38:39:00:00:03 origin json | ./jq-linux64 '.[0]|length'
  2
  cumulus@torc-21:mgmt-vrf:~$

The reason for the count of 2 here is because of a dual-attached host.

The same mechanism can also be used to ensure that you have not allocated
the same IP address to multiple nodes. Or in the case of VRR with dual
attached hosts, that there are two nodes with the same VRR IP address:

  cumulus@torc-21:mgmt-vrf:~$ netq show ip addresses 3.0.1.193/26
  Matching address records are:
  Address       Node     Interface        VRF          Last Changed
  ------------  -------  ---------------  -----------  --------------
  3.0.1.193/26  torc-21  VlanA-1.100.VRR  DataVrf1080  16h ago
  3.0.1.193/26  torc-22  VlanA-1.100.VRR  DataVrf1080  16h ago
  cumulus@torc-21:mgmt-vrf:~$ netq show ip addresses 3.0.1.193 count
  Matching addresses count: 2
  cumulus@torc-21:mgmt-vrf:~$
