[YLUG] Finding the external IP of a linksys router
Richard G. Clegg
richard at richardclegg.org
Mon May 22 19:38:11 BST 2006
Stephen wrote:
> On 22 May 06, Craig Genner (craig at gennerfam.freeserve.co.uk) wrote:
>
>>curr_ip=`wget -q -O- http://www.whatismyip.com/ | grep "Your IP is " - | cut
>>-d" " -f4`
>
>
> Thats neater than my first thought (at least the html is) - load the router's
> status webpage which has its external IP & grep through that.
>
> I'll post the actual script when I've got something figured out.
>
> hmmm, looks like gpg's gone snafu :(
If you are always connecting via the same ISP you could ping
somewhere.nearby.net -R | head -5 | tail -1
E.g. for me
richard at barq:~ $ ping www.zen.co.uk -Rn | head -5 | tail -1
217.155.198.94
This relies on you having pretty much the same ping version I do.
There's probably a less hackish way of doing that last bit too!
--
Richard G. Clegg,
Networks & NonLinear Dynamics Group,
Dept. of Maths, Uni. of York.
http://www.richardclegg.org/
More information about the York
mailing list