Using arp-scan to get a list of returned duplicate IP address. However, arp-scan will list duplicate IP with the same MAC address. I get a sorted output of asx.txt (shortened for brevity)
arp-scan 172.16.0.0/16 > as.txt
sort as.txt > as2.txt
cat as2.txt | uniq -D -w 36 > asx.txt
kye-mgmt02:/data # cat asx.txt
172.16.150.68 d8:cb:8a:b0:6a:12 Micro-Star INTL CO., LTD.
172.16.150.68 d8:cb:8a:b0:6a:12 Micro-Star INTL CO., LTD. (DUP: 2)
172.16.150.69 00:23:24:9e:3d:32 G-PRO COMPUTER
172.16.150.69 00:23:24:9e:3d:32 G-PRO COMPUTER (DUP: 2)
172.16.150.70 00:23:24:9e:3d:82 G-PRO COMPUTER
172.16.150.70 00:23:24:9e:3d:82 G-PRO COMPUTER (DUP: 2)
172.16.150.71 d8:cb:8a:86:2f:56 Micro-Star INTL CO., LTD.
172.16.150.71 d8:cb:8a:86:2f:56 Micro-Star INTL CO., LTD. (DUP: 2)
172.16.150.72 d8:cb:8a:cf:f1:e8 Micro-Star INTL CO., LTD.
172.16.150.72 d8:cb:8a:cf:f1:e8 Micro-Star INTL CO., LTD. (DUP: 2)
172.16.150.73 d8:cb:8a:cf:f1:5d Micro-Star INTL CO., LTD.
172.16.150.73 d8:cb:8a:cf:f1:5d Micro-Star INTL CO., LTD. (DUP: 2)
So as you can see, all the IPs are really not duplicated because the IPs have the same MAC address
to really find a duplicate IP with a different MAC, I edited the file and change the MAC of the last IP.
kye-mgmt02:/data # cat asx.txt
172.16.150.68 d8:cb:8a:b0:6a:12 Micro-Star INTL CO., LTD.
172.16.150.68 d8:cb:8a:b0:6a:12 Micro-Star INTL CO., LTD. (DUP: 2)
172.16.150.69 00:23:24:9e:3d:32 G-PRO COMPUTER
172.16.150.69 00:23:24:9e:3d:32 G-PRO COMPUTER (DUP: 2)
172.16.150.70 00:23:24:9e:3d:82 G-PRO COMPUTER
172.16.150.70 00:23:24:9e:3d:82 G-PRO COMPUTER (DUP: 2)
172.16.150.71 d8:cb:8a:86:2f:56 Micro-Star INTL CO., LTD.
172.16.150.71 d8:cb:8a:86:2f:56 Micro-Star INTL CO., LTD. (DUP: 2)
172.16.150.72 d8:cb:8a:cf:f1:e8 Micro-Star INTL CO., LTD.
172.16.150.72 d8:cb:8a:cf:f1:e8 Micro-Star INTL CO., LTD. (DUP: 2)
172.16.150.73 d8:cb:8a:cf:f1:5d Micro-Star INTL CO., LTD.
172.16.150.73 d8:cb:8a:cf:f1:55 Micro-Star INTL CO., LTD. (DUP: 2)
Looking on how to output the duplicate IPs with different MACs
expected output
172.16.150.73 d8:cb:8a:cf:f1:5d Micro-Star INTL CO., LTD.
172.16.150.73 d8:cb:8a:cf:f1:55 Micro-Star INTL CO., LTD. (DUP: 2)
I can't seem to find the right options to output the duplicate IPs with different MACs
Help please.
**tried
cat asx.txt | uniq -D -s 15 -w 33
cat asx.txt | uniq -D -s 15 -w 17-33
cat asx.txt | uniq -D -f1 -w 33
cat asx.txt | uniq -D -f1 -w 32
cat asx.txt | uniq -D -f1 -w 31
cat asx.txt | uniq -D -f1 -w 30
cat asx.txt | uniq -D -f1
cat asx.txt | uniq -D -s 15
But none gives the desired output.