The fact I couldn't get the DSL linespeed from the Fritz!Box 7360 annoyed
me a lot, especially since there is a new telephone wiring cabinet which
should raise VDSL2 speeds. I went through a number of websites about getting
data out of the Fritz!Box with upnp, and finally I made it work and I get the
results I want:
<NewLayer1UpstreamMaxBitRate>1480000</NewLayer1UpstreamMaxBitRate>
<NewLayer1DownstreamMaxBitRate>23144000</NewLayer1DownstreamMaxBitRate>
The hint that worked for me was at
MRTG en Fritz!Box 7360 (firmware 124.06.05) - tweakers (in Dutch)
where it mentiones the changeover to TR-064 protocol which should be reachable
over the
http://192.168.178.1/tr064/tr64desc.xml url which will
ask for authentication with the root username and the Fritz!Box password.
More about the Fritz!Box TR-064 implementation at
Schnittstellen für Entwickler | AVM Deutschland (in German) which has more documentation at
AVM TR-064 – First Steps (pdf, English).
This made me end up at doing a SOAP request (post) to
http://192.168.178.1/tr064/upnp/control/wancommonifconfig1 which
failed. All SOAP requests fail with an HTTP error code 500, but there is
a separate SOAP error set in the HTTP status 500 body. I used tcpdump to
look at the SOAP error body and found:
<errorCode>504</errorCode> <errorDescription>SSL needed</errorDescription></UPnPError>
The SSL port is (according to the TR-064 first steps document above) 49443
and the URL is over SSL:
https://192.168.179.1:49443/upnp/control/wancommonifconfig1
and this works, giving the answers I want.
The full script that fetches data:
#!/bin/sh
FRITZUSER=root
FRITZPASS=VerySecretPassword
wget --user=$FRITZUSER --password=$FRITZPASS --post-file=linkstatusrequest.xml \
--header="Content-Type: text/xml" \
--header="SOAPAction: \"urn:dslforum-org:service:WANCommonInterfaceConfig:1#GetCommonLinkProperties\"" --no-check-certificate \
https://192.168.179.1:49443/upnp/control/wancommonifconfig1 -O linkstatusanswer.xml
This does need the
linkstatusrequest.xml file:
<?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:GetCommonLinkProperties xmlns:u="urn:dslforum-org:service:WANCommonInterfaceConfig:1">
</u:GetCommonLinkProperties>
</s:Body>
</s:Envelope>
And gives me the right answer:
<?xml version="1.0"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<s:Body>
<u:GetCommonLinkPropertiesResponse xmlns:u="urn:dslforum-org:service:WANCommonInterfaceConfig:1">
<NewWANAccessType>DSL</NewWANAccessType>
<NewLayer1UpstreamMaxBitRate>1504000</NewLayer1UpstreamMaxBitRate>
<NewLayer1DownstreamMaxBitRate>23129000</NewLayer1DownstreamMaxBitRate>
<NewPhysicalLinkStatus>Down</NewPhysicalLinkStatus>
</u:GetCommonLinkPropertiesResponse>
</s:Body>
</s:Envelope>
Which I can import into my rrdtool scripts and make into pretty graphs.
Which directly shows me something interesting: the DSL linespeed is varying
constantly.