Monday, December 23, 2013

TU Delft on IPv6 ... loving their IPv4 addresses

The TU Delft (Delft University of Technology) webserver is on IPv6:

$ host has address has IPv6 address 2001:610:908:112:131:180:77:102

Ah, apparently they love their IPv4 address scheme, as they have put their IPv4 address into their IPv6 address: 2001:610:908:112:131:180:77:102

(Thank you @Whreq)

Wednesday, December 11, 2013

Use curl to read your Sitecom WLR-4100 X4 N300 (and X6)

If you want to read out your Sitecom WLR-4100 X4 N300 (and X6) from the command line, here's how to do that with curl (alas Sitecom seems to have no SNMP nor telnet).

Assuming your Sitecom is on , make sure you can log in on the Sitecom router with your favorite webbrowser: username is 'admin', password is on a sticker on the bottom of your Sitecom at "WPA2 password". In the examples below I use the password '8BT5J5Y6AAAA'

If that works, first test that a plain curl login works:

curl --user admin:8BT5J5Y6AAAA ''

That should give some HTML garbage, but not "401 Unauthorized". If you get "401 Unauthorized" recheck your password.

If it works, you can proceed:

Get your public IPv4 address:

$ curl --silent --user admin:8BT5J5Y6AAAA '' | grep -i sta_ip:

var st2={sta_ip:"",sta_mac:"64:D1:A3:07:20:AA",sta_mask:"",sta_dns1:",",sta_gw:""};

So my public IPv4 address is

Get an overview of the traffic (alas in packets, not in bytes):

$ curl --silent --user admin:8BT5J5YAAAA '' | grep -i wRxNum:

var st={wlDev:"1",wlTxNum:"  15406",wlRxNum:"  30387",lTxNum:"   1031",lRxNum:"    562",wTxNum:"   4133",wRxNum:"   7482"};

You need to parse that output to get what you want. Here's the Sent Packets and Receive Packets (so: not bytes) on your Ethernet WAN interface you could feed into MRTG:

$ curl --silent --user admin:8BT5J5Y6AAAA '' | grep -i wRxNum: | awk -F "[^0-9]*"  '{ print $(NF-2) "\n" $(NF-1) "\n\n" }'


Looks good. Warning: these are packets ...not bytes. Multiply with the typical packet size in Send resp Received direction (so 50 resp 1200?) to get bytes. Example:

$ curl --silent --user admin:8BT5J5Y6AAAA '' | grep -i wRxNum: | awk -F "[^0-9]*"  '{ print 90*$(NF-2) "\n" 1200*$(NF-1) "\n\n" }'


Note: you have to change (NF-2) and (NF-1) to get the right Up and Down

As this is an IPv6 blog, here is some IPv6 stuff:

$ curl --silent --user admin:8BT5J5Y6AAA ''   | grep -i fe80

var ipv6_wan_linklocal = 'fe80::66d1:a3ff:fe07:aaaa/64';
var ipv6_linklocal = 'fe80::66d1:a3ff:fe07:aaaa/64';

Happy curling!

(Met dank aan Rob voor de Sitecom)