Nerd blog.

05 Jul 2014

ipquail now curl friendly

I’ve always liked how the site (down today it seems) returns JUST the IP address from command line when accessed via CURL. Unfortunately it is not IPv6 enabled. This morning I set out to CLI-enable The journey is documented in this short commit history.

$ for i in www 4 6; do \
  echo -n "curl $ => "
  curl $
curl => 2604:4280:d000:11::5
curl =>
curl => 2604:4280:d000:11::5

This can be used in scripts as well:


IP4=`curl 2>/dev/null`
IP6=`curl 2>/dev/null`

echo "Your IP Address is $IP4"
echo "Your IPv6 Address is $IP6"

I deployed the new files to all Anycast nodes using SaltStack as described in my previous post.

Note: This only works if you are NOT changing the default curl user agent, if you are, you would need to specify curl as your user agent using the -A flag for curl.

Theodore Baschak - Theo is a network engineer with experience operating core internet technologies like HTTP, HTTPS and DNS. He has extensive experience running service provider networks with OSPF, MPLS, and BGP.