Archive

Archive for the ‘Technical’ Category

SpeedTest vs. DSLReports Analysis

September 17th, 2011 1 comment

I decided to do a little check on this article:
http://www.phuketgazette.net/archives/articles/2011/article10972.html

Update: details for SpeedTest.net are for Los Angeles as well now.

SpeedTest.net

Latency

Get http://ndt.dhspeedtest.com/flash/speedtest/latency.txt?x=<some sort of timestamp> (this request repeats 10 times)

Last-Modified: Fri, 28 Jul 2006 23:31:21 GMT

Download Speed
  • Download in 1 thread http://ndt.dhspeedtest.com/flash/speedtest/random750x750.jpg
  • Download in 2 threads http://ndt.dhspeedtest.com/flash/speedtest/random750x750.jpg

Note: URL is for Los Angeles server

Upload Speed
  • Upload in 2 threads 29705 bytes of random data
  • Upload in 2 threads 29705 bytes of random data
  • Upload in 2 threads 95251 byte of random data
  • Upload in 2 threads 95251 byte of random data

Note: the download and upload patterns differ for different locations!

DSLReports

Latency

Get http://www.dslreports.com/ft?c=gd&o=records&limit=4&f=myuid

Cache-Control: no-cache, max-age=0

Download Speed
  • Downloading http://dslreports.linkline.com/SpeedTests/random750x750.jpg?x=0.928372583817691
  • Downloading http://dslreports.linkline.com/SpeedTests/random500x500.jpg?x=0.663370833266526

Note: URL is for Los Angeles server

Upload Speed and Compression Check
  • Uploading 100009 bytes of zeros
  • Uploading 50009 bytes of random data
  • Uploading 100009 bytes of random data

Conclusions

Upload and download speed differences are most likely not related to any caching; data downloaded and uploaded is random. Numbers are different because DSLReports uses single thread and SpeedTest.net uses 2-4 threads. One question remains: do both sites do any checksumming on the downloaded data to assure it is really what their servers send them or it’s a stale copy from some cache?

Latency: SpeedTest server does not put the proper Cache-Control: directives in the reply, therefore the latency measurement is more likely to be affected by caching. DSLReports put the proper directive in the reply but that does not mean the latency result cannot be faked intentionally by the ISP proxy. It is possible to configure a proxy server to always use cached result for a given URL, ignoring directives from a Web server; but in that case the proxy would not be RFC2616-compliant anymore.

RFC2616, 13.3 Validation Model

When a cache has a stale entry that it would like to use as a response to a client’s request, it first has to check with the origin server (or possibly an intermediate cache with a fresh response) to see if its cached entry is still usable.

Please note what for the latency measurement the content returned is not important; if proxy complies with RFC2616 it MUST check the resource on the original server before returning the resource and this means HTTP “ping” value would be about right (it will consist of round-trip time from the client to the proxy + round-trip time from proxy to the original server).

On the other hand, if the proxy is not RFC2616 compliant, I do not see any advantage of DSLReports over SpeedTest.net; it seems that DSLReports latency can be faked as well if ISP wishes to do so.

True Cable (DOCSIS) Internet Hardware

September 5th, 2011 1 comment

The hardware we saw so far:

Warning: IP address you will get on WAN interface is from private ip address range (10.x.x.x)! Therefore no port forwarding would be possible (probably the most common use for it on the island is remote access to the CCTV recorders and IP cameras); problems with VPN  etc…

Matching Linux ata numbers to the device names

July 16th, 2011 1 comment

Many thanks to Dirk Tilger for the information on his blog. I am just providing the more manageable commands to type :)

Recently we had to recover data from a 8-drive soft-RAID5 on Linux. It had 3 devices failed out of 8. 2 of the drives just had some bad sectors on them. The problem is, the Linux kernel reports errors on the device as ata channel numbers, for example as “ata1.00″. All 8 drives were the same model, the serial number is not reported via dmesg, so how to know the device name (like /dev/sda) that is causing these error messages?

The command

grep '[0-9]' /sys/class/scsi_host/host{0..9}/unique_id

will provide output like this:

/sys/class/scsi_host/host0/unique_id:1
/sys/class/scsi_host/host1/unique_id:2
/sys/class/scsi_host/host2/unique_id:0
/sys/class/scsi_host/host3/unique_id:0
/sys/class/scsi_host/host4/unique_id:3
/sys/class/scsi_host/host5/unique_id:4
/sys/class/scsi_host/host6/unique_id:5
/sys/class/scsi_host/host7/unique_id:6

so we can match the unique id used in kernel error messages to the host number. Then the command:

ls -l /sys/block/sd*

Will show us which device name belongs to which host number:

/sys/block/sda -> ../devices/pci0000:00/0000:00:13.2/usb1/1-6/1-6:1.0/host2/target2:0:0/2:0:0:0/block/sda
/sys/block/sdb -> ../devices/pci0000:00/0000:00:13.2/usb1/1-8/1-8:1.0/host3/target3:0:0/3:0:0:0/block/sdb
/sys/block/sdc -> ../devices/pci0000:00/0000:00:12.0/host6/target6:0:0/6:0:0:0/block/sdc
/sys/block/sdd -> ../devices/pci0000:00/0000:00:13.2/usb1/1-8/1-8:1.0/host3/target3:0:0/3:0:0:1/block/sdd
/sys/block/sde -> ../devices/pci0000:00/0000:00:13.2/usb1/1-8/1-8:1.0/host3/target3:0:0/3:0:0:2/block/sde
/sys/block/sdf -> ../devices/pci0000:00/0000:00:13.2/usb1/1-8/1-8:1.0/host3/target3:0:0/3:0:0:3/block/sdf
/sys/block/sdg -> ../devices/pci0000:00/0000:00:12.0/host7/target7:0:0/7:0:0:0/block/sdg

From these two outputs we can see that the unique id 6 maps to host7, and host7 maps to /dev/sdg. And finally, with the command:

hdparm -i /dev/sdg
/dev/sdg:
 Model=ST3500418AS, FwRev=CC34, SerialNo=6VM2KSFD

we can find the serial number of the drive.

Monitor Windows Server via WMI from Ubuntu Linux

July 15th, 2011 No comments

This article is a work in progress

deb package for the Linux WMI client (wmic) for Ubuntu 10.10 can be downloaded here.

We use this utility together with collectd, it’s Exec plug-in and rrdgraph.

For example with this script we read the Transactions performance counter for MS SQL Server:

#!/bin/bash
INTERVAL="${COLLECTD_INTERVAL:-60}"

while sleep "$INTERVAL"
do
        TRANSPS=$((wmic -U user%password //server "SELECT TransactionsPersec FROM Win32_PerfRawData_MSSQLSERVER_SQLServerDatabases WHERE Name='_Total'" | grep "_Total" | awk -F "|" '{ print $2; }') 2>/dev/null);
        if [ $? -ne 0 ]
        then
              TRANSPS="U"
        fi
        echo "PUTVAL sqlserver/exec-mssql-wmi/operations interval=$INTERVAL N:$TRANSPS"
done

Note what the rrd file name (in this case operations) should start from the defined word in types.db

Categories: Technical Tags: , , , , ,

Dual PPPoE Connections with Automatic Failover on Ubuntu

July 7th, 2011 No comments

This article is a work in progress

Both modems should be set to Bridged Mode

Packages involved: pppd, shorewall, iproute2

/etc/ppp/peers/cat, configuration file for CAT Telecom provider:

noipdefault
#defaultroute
#replacedefaultroute
#usepeerdns
hide-password
debug
noauth
persist
maxfail 0
lcp-echo-interval 30
lcp-echo-failure 5
mtu 1492
plugin rp-pppoe.so eth0
rp_pppoe_service 'cat'
user "lettersandnumbers@hinet.p"
linkname cat
unit 0

/etc/ppp/peers/tot, configuration file for TOT provider:

noipdefault
#defaultroute
#replacedefaultroute
#usepeerdns
hide-password
debug
noauth
persist
maxfail 0
lcp-echo-interval 30
lcp-echo-failure 5
mtu 1492
plugin rp-pppoe.so eth1
rp_pppoe_service 'tot'
user "phoneno@totgoldbiz"
linkname tot
unit 1

I will explain the options.

#defaultroute
#replacedefaultroute
#usepeerdns

These we comment out, we will control default routes in the /etc/ppp/ip-up.local and /etc/ppp/ip-down.local scripts; we are not going to use DNS servers offered by the provider and will use fixed DNS (like Google DNS) instead.

persist
maxfail 0
lcp-echo-interval 30
lcp-echo-failure 5

Persist sets pppd to keep the connection; maxfail 0 prevents pppd from giving up after 5 unsuccessful connections; we are sending line control protocol “pings” every 30 seconds and going to disconnect and try to connect back again if 5 of these “pings” are lost in a row.

unit 0
linkname cat

unit is a very important option to nail the number (ppp0, ppp1 etc.) of the connection. If this option is not specified, the connections will be numbered in the order they are established and the interface number would change all the time.  linkname defines the name of .pid created in /var/run, I check for the existence of these files from PHP script to report in the web interface if the provider connection is on or off.

/etc/network/interfaces (fragment)

auto cat
iface cat inet ppp
pre-up /sbin/ifconfig eth0 up # line maintained by pppoeconf
provider cat

auto tot
iface cat inet ppp
pre-up /sbin/ifconfig eth1 up # line maintained by pppoeconf
provider tot

/etc/iproute2/rt_tables

#
# reserved values
#
255     local
254     main
253     default
0       unspec
#
# local
#
100     ppp0
200     ppp1

/etc/ppp/ip-up.local

#!/bin/bash
if [[ "$PPP_IFACE" == "ppp0" ]] ; then
        METRIC=1
else
        METRIC=2
fi

ip route add default dev $PPP_IFACE table $PPP_IFACE
ip route add default dev $PPP_IFACE metric $METRIC
ip rule add from $PPP_LOCAL lookup $PPP_IFACE
shorewall refresh
/usr/sbin/ddclient -syslog -file /etc/ddclient-$PPP_IFACE.conf

pppd does not have option to specify interface metric. There is a proposed patch for it, but it is not in the mainline yet. That’s why we move routing setup to this file. First line adds a default route to the routing table named ppp0 or ppp1. Third line adds a rule: if the source address of a packet is a local address of ppp interface, route it through this specific table (ppp0 or ppp1).

I am not sure if refreshing shorewall config is really needed, but won’t do any harm. ddclient updates DynDNS records using two different config files for two interfaces.

/etc/ppp/ip-down.local

#!/bin/sh
ip route del default table $PPP_IFACE
ip route del default dev $PPP_IFACE
ip rule del lookup $PPP_IFACE
shorewall refresh

/etc/shorewall/interfaces (fragment)

net     ppp0            detect          tcpflags,routefilter,nosmurfs,mss=1452
net     ppp1            detect          tcpflags,routefilter,nosmurfs,mss=1452

Important to clamp MSS to 1452 bytes here

“ip route show” output when both connections are on:

default dev ppp0  scope link  metric 1
default dev ppp1  scope link  metric 2

Primary interface ppp0, with lowest metric is used first. If it will go down, the second default route will be used automatically.

To be continued – from failover to load-balancing…

Categories: Technical Tags: , , , , , , , ,

Windows 3.11 for Workgroups – Alive

June 14th, 2011 No comments

It was amazing to see Keehin Electrical Shop in Phuket still using Windows 3.11 for Workgroups with Paradox database for stock and sales… I wonder if they run it in a virtual machine though. Last time I worked with Paradox was in 1995!

Categories: Phuket IT Events, Technical Tags:

Unable to change a wallpaper: Internal error

May 31st, 2011 7 comments

Happens when this file:

%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Themes\TranscodedWallpaper.jpg

has wrong permissions or hidden/system file attribute. Remove this file as an Administrator.

Windows Validation was interrupted

May 31st, 2011 No comments

If you are getting the message “Windows Validation was interrupted” while trying to activate your Windows 7 installation via Internet Explorer, check the permissions on the file

%SystemRoot%\System32\Wat\WatAdminSvc.exe

On some hacked installations there is a permissions setting to deny execute rights for Everyone, set it back to Allow.

The proper permissions for this file:
Allow – TrustedInstaller – Full control
Allow – Administrators – Read & execute
Allow – SYSTEM – Read & execute
Allow – Users – Read & execute

UPS APC BE500R-AS

May 26th, 2011 No comments

Looking for schematics for APC BE500R-AS, Chassis 640-0690B-Z…

Categories: Technical Tags: , , , ,

Defective Batteries

May 26th, 2011 No comments

This 25-baht RTC battery with a slight bulge on the top prevented the motherboard from booting. The previous technician suggested replacing the motherboard…

This battery from APC BR1500I UPS burst open, oozing a small amount of electrolyte liquid. Happens often here, most likely because of overheating. The battery is 3 years old.

Categories: Technical Tags: , , , , , , ,