---
layout: page
title: Script to test a dn42 peer for clearnet access
permalink: /blog/dn42-test-clearnet-access/
keywords: test clearnet access,dn42
description: The following script rambles around dn42 IRC on Hackint every now and then. It is a small bash script which checks if you can reach the clearnet via a certain interface.
lang: en
date: 2023-05-08 00:00:00 +0100
feed: true
---

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.

```sh
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 1.1.1.1 > /dev/null; rc=$?;  if [[ $rc -eq 0 ]]; then echo "---> Please alert your peer on interface $line"; fi; done
```
