
Example config showing how to retrieve IP from fritzbox via UPnP using ddclients cmd option. The script has been provided by @Rusk85 in pull request #45
20 lines
1.1 KiB
Bash
Executable file
20 lines
1.1 KiB
Bash
Executable file
#!/bin/bash
|
|
#
|
|
# Scirpt to fetch IP from fritzbox
|
|
#
|
|
# Contributed by @Rusk85 in request #45
|
|
# Script can be used in the configuration by adding
|
|
#
|
|
# use=cmd, cmd=/etc/ddclient/get-ip-from-fritzbox
|
|
#
|
|
# All credits for this one liner go to the author of this blog:
|
|
# http://scytale.name/blog/2010/01/fritzbox-wan-ip
|
|
# As the author explains its not required to tamper with the provided IP for the FritzBox
|
|
# as it always binds to that address for UPnP.
|
|
# Disclaimer: It might be necessary to make the script executable
|
|
|
|
curl -s -H 'Content-Type: text/xml; charset="utf-8"' \
|
|
-H 'SOAPAction: urn:schemas-upnp-org:service:WANIPConnection:1#GetExternalIPAddress' \
|
|
--data-binary '<?xml version="1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:GetExternalIPAddress xmlns:u="urn:schemas-upnp-org:service:WANIPConnection:1" /></s:Body></s:Envelope>' \
|
|
http://169.254.1.1:49000/upnp/control/WANCommonIFC1 | \
|
|
sed -n -e 's#^.*<NewExternalIPAddress>\(.*\)</NewExternalIPAddress>.*$#\1#p'
|