Archive for the ‘Network’ Category

HTC Incredible S, internet over Wifi not working

Saturday, May 14th, 2011

After recently buying an HTC Incredible S, one of the first requirements was to get it connected to the home Wifi. For security I use WPA-PSK and also MAC address filtering. After adding the MAC address to the router and configuring the password, the phone connected to the Wifi with no issues. But after trying to use the market and the internet it was apparent that the connection wasn’t working.

After a little bit of troubleshooting, I discovered I could actually access other computers on the home network, but could not access anything on the internet. This didn’t seem to be a DNS issue as using straight IP addresses didn’t help either. After reading a few posts, it seemed this might be an issue with my SpeedTouch router (and/or the combination of the SpeedTouch with an Android 2.2 device).

Anyway, the current solution (or workaround) is to use a static IP address on the home network. Once configured, everything works as expected. But, this is a workaround, and I wouldn’t want to have to do this on other Wifi networks (which I’m yet to test).

Running scripts on network connection (if-up.d, if-down.d,if-pre-up.d,if-post-down.d)

Friday, November 19th, 2010

On my previous post I described how to authenticate against web based logons after connecting to a particular SSID.  One of the problems I had was getting the script to actually run.  You should just be able to put a script in the /etc/network/if-up.d directory (on Debian based systems) and it should run when a network interface connects.  This wasn’t working for me and it seemed some other people were having issues too.

The solution to the problem turned out to be removing the file extension.  So the script that was named didn’t run, but the script named testscript did.  So if you are having similar problems you may want to try removing the file extension.

I am not sure if this is documented and expected behavior, or a bug.

Auto logon to web-authenticated wireless

Thursday, November 18th, 2010

At my current workplace I am using a guest wireless network.  After connecting, I need to open any web page and I am redirected to the login page and need to enter my provided username and password.  After submitting, I can browse any page and use the connection for email and other tasks.

Whilst this is only a minor inconvenience, it is definitely a candidate for automation.

A single line wget command is all we really need.  I have wrapped it up into a shell script below:



wget -O /dev/null --no-check-certificate --post-data "username=$username&password=$password&buttonClicked=4&err_flag=0&"

-O /dev/null throws any downloaded content away, --no-check-certificate is fairly self-explanatory (wget wouldn’t connect to the https address without this), --post-data wraps up the various name/value pairs that the login form is expecting.

For most of these login forms, you only need a username and password, but I found with this one it also needed a few extra parameters.

So, the next step is to get this script to run automatically after connecting to the wireless network.  On Ubuntu (or any Debian based distro), there is a directory structure under /etc/network that includes an if-up.d directory.  Any scripts in here will be run after a network interface is brought online.  These scripts don’t have access to the SSID (as far as I know), but this can be obtained with the following command:

iwgetid --raw

Wrapping it all together, we can put the following script in the “if-up.d” directory:



if [  "`iwgetid --raw`" = "$ssid" ]
wget -O /dev/null --no-check-certificate  --post-data "username=$username&password=$password&buttonClicked=4&err_flag=0&"

Remember to change the values of username, password and ssid.  Set the URL to the forms action value and add remove parameters as necessary.  Also, another point I learned the hard way is that the script can’t have a “.sh” extension, so name it “something” not “” (and remember to chmod +x it).

If you need to then connect to a VPN, this can also be added to the script.