Home > likes, Maemo, N900, T-Mobile > Internet Connection via the command-line

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 =
ipv4_type = AUTO
ipv4_gateway =
name = T-Mobile Internet
type = GPRS
proxytype = NONE
gprs_password =
ask_password = false
ipv4_dns2 =
sim_imsi = 3102612312319
ipv4_dns1 =
ipv4_netmask =
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!).


About these ads
Categories: likes, Maemo, N900, T-Mobile Tags: , , ,
  1. E0x
    August 20, 2010 at 1:55 pm | #1

    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

    • August 20, 2010 at 3:38 pm | #2

      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.

      • E0x
        August 20, 2010 at 9:57 pm | #3

        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

      • August 21, 2010 at 1:23 am | #4

        No. the usb0 connection is always available in PC Suite Mode. just need to start it up. So this is what I do:

        1. Connect via USB. Select PC Suite Mode.
        2. On the N900, execute ‘ifup usb0′ as root.
        3. Create SSH tunnel to the N900 from Laptop when I want the Internet.
        4. At the prompt, start the connection via the dbus command and keep the SSH connection open until done.
        5. Configure browser proxy and start browsing.
  2. August 20, 2010 at 3:26 pm | #5

    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

    • August 20, 2010 at 3:40 pm | #6

      @Khertan nice to know, thanks!

    • berlinermaxe
      August 20, 2010 at 11:04 pm | #7

      do anyone try this? not work for me. it show me the change connection UI. – ? (first wlan is a saved connection)

  3. Amaterua
    August 20, 2010 at 5:47 pm | #8

    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??

    • August 20, 2010 at 6:04 pm | #9

      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.

  4. Amaterua
    August 21, 2010 at 1:50 pm | #10

    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″

    • August 21, 2010 at 5:36 pm | #11

      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.

      • Amaterua
        August 22, 2010 at 9:55 am | #12

        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??

  5. Amaterua
    August 21, 2010 at 2:01 pm | #13

    One more thing, the IAP number nor appear when I run gconftool-2 -R /system/osso/connectivity/IAP. This is the report

    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

    • August 21, 2010 at 5:36 pm | #14

      It looks like your connection has a proper name. Use INTERNET instead of 0000-000..

  6. August 22, 2010 at 12:57 pm | #15

    Amaterua :

    Ok ..but is impossible make the conecction via USB with putty. Any idea??

    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

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.