Theodore Baschak

Routing Guru. IPv6 Advocate. Operator of Hextet Systems (AS395089).

ipquail now curl friendly

Sat, 05 Jul 2014 13:56:04 -0500 » Anycast, Nerd Projects, CLI, IPv6, Programming, SaltStack, System Administration » Estimated read time: 1 min

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.