Internet Connection via the command-line
I have been tethering via USB a lot lately.
I don’t connect to the internet using my laptop directly but instead, I access the N900’s data connection via SSH tunnelling (port-forwarding). I had to resort to this because I didn’t want to interfere with the network that my laptop was already connected to. So the process is, connect in PC Suite Mode (USB Networking), create the tunnel, connect to the Internet.
Anyway, to make life easier I was looking for a way to initiate the internet-connection via the command-line on my laptop. Thankfully, the t.m.o forum was a great resource.
The following command triggers the N900 to initiate the T-Mobile data-connection:
dbus-send --type=method_call --system --dest=com.nokia.icd /com/nokia/icd com.nokia.icd.connect string:0000-0000-0000-0000 uint32:0
where 0000-0000-0000-0000 is the ID of the connection. The list of connections can be found using
gconftool-2 -R /system/osso/connectivity/IAP
Look for the value after ‘/IAP/’. Here is a snippet of the output:
ipv4_autodns = true
ipv4_address = 0.0.0.0
ipv4_type = AUTO
ipv4_gateway = 0.0.0.0
name = T-Mobile Internet
type = GPRS
proxytype = NONE
ask_password = false
ipv4_dns2 = 0.0.0.0
sim_imsi = 3102612312319
ipv4_dns1 = 0.0.0.0
ipv4_netmask = 0.0.0.0
gprs_accesspointname = internet2.voicestream.com
I now run the dbus command from a script and voila! the internet is ready and all I now need to do is access it via port-forwarding on my laptop.
ssh -D 9999 user@n900
and SOCKS proxy settings in Firefox of course (Go FoxyProxy!).