0×1337.de_blog about security, open source, music and revolution.

May 8, 2010

Find Uplink

Filed under: linux — flyc0r @ 11:38 pm


#!/bin/bash
#simple uplink finder. Returns the first device to be able to ping 8.8.8.8
for i in $(ifconfig |grep encap |cut -f 1 -d ' '|grep -v lo); do
if ping -I $i -c 1 -w 20 8.8.8.8 > /dev/null; then echo $i; exit 1; fi
done

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress