#!/bin/sh FRITZBOX="192.168.0.1" PAYLOAD=\ ' ' curl -s "http://$FRITZBOX:49000/igdupnp/control/WANIPConn1" \ -H "Content-Type: text/xml; charset=utf-8" \ -H "SoapAction:urn:schemas-upnp-org:service:WANIPConnection:1#GetExternalIPAddress" \ -d "$PAYLOAD" | grep -Eo "\<[[:digit:]]{1,3}(\.[[:digit:]]{1,3}){3}\>"