Script to test a dn42 peer for clearnet access

The following script rambles around dn42 IRC on Hackint every now and then. Therefore I wanted to save it, so I don’t have to search for it. I did not write the script.

It is a small bash script which checks if you can reach the clearnet via a certain interface. This should not be the case with peers in dn42. This script checks all peer interfaces and gives a message if a peer can reach the internet.

ip link | awk -F: '$0 !~ "lo|eth|vir|enp|ens|^[^0-9]"{print $2;getline}' | while read line ; do echo Testing peer on interface: $line; timeout 3 ping -c 1 -I $line > /dev/null; rc=$?;  if [[ $rc -eq 0 ]]; then echo "---> Please alert your peer on interface $line"; fi;done