Skip to content

Instantly share code, notes, and snippets.

@dewomser
Last active May 25, 2026 23:01
Show Gist options
  • Select an option

  • Save dewomser/d7e4a3ab4f3ce77bc36ee6f08fc37998 to your computer and use it in GitHub Desktop.

Select an option

Save dewomser/d7e4a3ab4f3ce77bc36ee6f08fc37998 to your computer and use it in GitHub Desktop.
Internet IP, Up- und down- Stream aus der Fritzbox holen . Ein Bash einzeiler
curl "http://fritz.box:49000/igdupnp/control/WANIPConn1" -H "Content-Type: text/xml; charset="utf-8"" -H "SoapAction:urn:schemas-upnp-org:service:WANIPConnection:1#GetExternalIPAddress" -d "<?xml version='1.0' encoding='utf-8'?> <s:Envelope s:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:s='http://schemas.xmlsoap.org/soap/envelope/'> <s:Body> <u:GetExternalIPAddress xmlns:u='urn:schemas-upnp-org:service:WANIPConnection:1' /> </s:Body> </s:Envelope>" -s | grep -Eo '\<[[:digit:]]{1,3}(\.[[:digit:]]{1,3}){3}\>'
Bei mir hat dieser Einzeiler funktioniert.
mehr Info und ander Bashzeilen gibts hier:
https://wiki.ubuntuusers.de/FritzBox/Skripte/
curl -s "http://192.168.1.1:49000/igdupnp/control/WANCommonIFC1" \
-H "Content-Type: text/xml; charset=utf-8" \
-H 'SoapAction: urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1#GetCommonLinkProperties' \
-d '<?xml version="1.0" encoding="utf-8"?>
<s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<u:GetCommonLinkProperties xmlns:u="urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1" />
</s:Body>
</s:Envelope>' \
| grep -oP '(?<=NewLayer1)(Up|Down)streamMaxBitRate>\K\d+'
# Beispiel Ausgabe
# 2944000
# 17280000
curl -s http://192.168.1.1:49000/igdupnp/control/WANIPConn1 \
-H "Content-Type: text/xml; charset=utf-8" \
-H "SoapAction: urn:schemas-upnp-org:service:WANIPConnection:1#GetExternalIPAddress" \
-d '<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>' \
| grep -oE '\b[0-9]{1,3}(\.[0-9]{1,3}){3}\b'
# Vorschlag Grok, Hab ich probiert und es funktioniert
@dewomser
Copy link
Copy Markdown
Author

Zu kompliziert ?
curl ifconfig.me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment