AVM FritzBox specific
hardwarefritzbox-ip-adresse-abfragen

What is my IPv4 address? #

# get_ipaddress.py
from SOAPpy import SOAPProxy
print SOAPProxy(proxy='http://192.168.178.1:49000/upnp/control/WANCommonIFC1',
                namespace='urn:schemas-upnp-org:service:WANIPConnection:1',
                soapaction='urn:schemas-upnp-org:service:WANIPConnection:1#GetExternalIPAddress',
                noroot=True).GetExternalIPAddress()

Older methods #

wget -qO- "http://192.168.178.1:49000/igdupnp/control/WANIPConn1" --header \
"Content-Type: text/xml" --header \
"SoapAction:urn:schemas-upnp-org:service:WANIPConnection:1#GetExternalIPAddress" \
--post-data="" | xmllint --xpath 'string(//NewExternalIPAddress)' -

What is my IPv6 address? #

wget -qO- "http://192.168.178.1:49000/igdupnp/control/WANIPConn1" --header \
"Content-Type: text/xml" --header \
"SoapAction:urn:schemas-upnp-org:service:WANIPConnection:1#X_AVM_DE_GetExternalIPv6Address" \
--post-data="" | xmllint --xpath 'string(//NewExternalIPv6Address)' -

Force a reconnection #

curl "http://fritz.box:49000/upnp/control/WANIPConn1" -H 'Content-Type: \
text/xml; charset="utf-8"' -H 'SoapAction: \
urn:schemas-upnp-org:service:WANIPConnection:1#ForceTermination' -d '     '
top