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:
/system/osso/connectivity/IAP/0000-0000-0000-0000:
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
gprs_password =
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_username =
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!).
:likes:
nice , but how you solve the problem that when you get connect to the data in the n900 you can’t access from the laptop to the n900 ( but you can ping from the n900 to the laptop ) ? i was trying do the same setup and because of that i can’t , if i put down the data in the n900 everything is fine and i can ssh to the n900
Eox, after the SSH tunnel is created on port 9999, simply configure Firefox or any other browser’s proxy settings to use a SOCKS proxy on that port. You should then be able to use the connection through the laptop browser.
maybe i don’t get understand well , i not even can get connect to the n900 via ssh because when you enable the data in your n900 and the interface gpsr0 get up the usb networking stop working right , in that moment connection from pc to the n900 stop but still i can ping from the n900 to the pc but not from the pc to n900
No. the usb0 connection is always available in PC Suite Mode. just need to start it up. So this is what I do:
You can also use : dbus-send –system –type=method_call –dest=com.nokia.icd /com/nokia/icd com.nokia.icd.connect string:”[ANY]” uint32:0
It ll connect to the first available network connection instead of looking for the id of the connection
@Khertan nice to know, thanks!
do anyone try this? not work for me. it show me the change connection UI. – ? (first wlan is a saved connection)
When I execute de script appear this:
Must use org.mydomain.Interface.Signal notation, no dot in “system”
This´s the script:
dbus-send –type=method_call –system –dest=com.nokia.icd /com/nokia/icd com.nokia.icd.connect string:01b6e714-f055-41c3-a215-85330f44cd75 uint32:0
Can You help me??
each argument (type, system, dest etc) should begin with two dashes
--. I noticed that the blog rendered it as a single hash :S. I have updated the post. See if the above fixes it now.Thanks Mustali.
I think your laptop is a linux O.S. It would be possible do it in windows xp with putty? or you are using cygwin?
“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”
Right. I use Ubuntu.
I had trouble setting up USB Networking in XP so I gave up.
If you can ssh into the N900 via USB on your XP machine, then you are almost there. You can use Putty for port-forwarding/tunneling. The option is under SSH->Tunnels. Specify a port, select ‘Dynamic’ and click Add.
Ok Mustali. I have been worked the connection script, and I´ve configured in putty the tunnel, but is impossible make the conecction via USB with putty. Any idea??
One more thing, the IAP number nor appear when I run gconftool-2 -R /system/osso/connectivity/IAP. This is the report
/system/osso/connectivity/IAP/INTERNET:
ipv4_autodns = true
ipv4_type = AUTO
name = INTERNET
type = GPRS
ask_password = false
gprs_password = vodafone
sim_imsi = 214079600788500
gprs_username = vodafone
gprs_accesspointname = airtelnet.es
It looks like your connection has a proper name. Use INTERNET instead of 0000-000..
Sounds like you don’t have USB Networking installed on your XP machine. Having the ability to SSH into the N900 via USB from XP would be the first step. Follow the instructions for setting up USB Networking here. HTH