Editing N900 USB networking

Warning: You are not logged in. Your IP address will be recorded in this page's edit history.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 1: Line 1:
-
This page describes how to enable Networking on the [[Nokia N900|N900]] via [[USB]], '''to share your PC's internet to N900 via USB'''. The first part describes how to configure the N900. The second part describes how to configure various PC platforms to share internet. This article is based on the [[USB networking|Maemo 4.x USB networking article]]. It is also possible to use the N900 as a [[N900 USB router|USB router]], to share N900 internet to PC.
+
This page describes how to enable Networking on the [[Nokia N900|N900]] via [[USB]]. The first part describes how to configure the N900 as a USB pluggable network device. The second part describes how to configure various platforms to use the Nokia N900 as a network device. This article is based on the [[USB networking|Maemo 4.x USB networking article]]. It is also possible to use the N900 as a [[N900 USB router|USB router]].
You might want to use the N900 as a USB network device to log into your N900 remotely, or to transfer data from your N900 to another computer, in a situation where wifi or Bluetooth are not an option. If you wish to connect your N900 to a Linux machine over TCP/IP, the [http://maemo.org/development/documentation/pc_connectivity/ PC connectivity] section in the Maemo SDK documentation also contains useful information.
You might want to use the N900 as a USB network device to log into your N900 remotely, or to transfer data from your N900 to another computer, in a situation where wifi or Bluetooth are not an option. If you wish to connect your N900 to a Linux machine over TCP/IP, the [http://maemo.org/development/documentation/pc_connectivity/ PC connectivity] section in the Maemo SDK documentation also contains useful information.
Line 19: Line 19:
       up route del default
       up route del default
       up route add default gw  192.168.2.14
       up route add default gw  192.168.2.14
-
Also you can add the following lines to set the nameserver (dnsmasq will automatically change <code>/etc/resolve.conf</code>)
 
-
      dns-nameservers 8.8.8.8 8.8.4.4
 
and
and
       up run-standalone.sh dbus-send --type=method_call --system --dest=com.nokia.icd /com/nokia/icd com.nokia.icd.connect string:DUMMY uint32:0
       up run-standalone.sh dbus-send --type=method_call --system --dest=com.nokia.icd /com/nokia/icd com.nokia.icd.connect string:DUMMY uint32:0
Line 71: Line 69:
</pre>
</pre>
-
To automatically setup usb0 when entering PC suite mode edit the file <code>/etc/default/usbnetwork</code> and set the variable <code>USBNETWORK_ENABLE</code>.
+
To automatically setup usb0 when entering PC suite mode change the last few lines of <code>/usr/sbin/pcsuite-enable.sh</code> by adding the "ifup usb0" line.
 +
<pre>
 +
logger "$0: sent SIGUSR1 to syncd"
 +
ifup usb0
 +
exit 0
 +
</pre>
 +
And, to automatically down your usb0 interface when leaving PC suite mode, add to <code>/usr/sbin/pcsuite-disable.sh</code>
<pre>
<pre>
-
# Automatically enable USB network when PC Suite mode is active (default disabled)
+
ifdown usb0
-
USBNETWORK_ENABLE=1
+
exit 0
</pre>
</pre>
Line 137: Line 141:
</li>
</li>
<li>
<li>
-
Add the following lines to <code>/usr/sbin/pcsuite-enable.sh</code> (Do not forget to change the ip address so it matches the one configured on your host's usb port.) (pcsuite-enable.sh is called by the ke-recv which handles memory card mounting, USB mass storage logic, and some other things, based on HAL.)
+
Add the following lines to <code>/usr/sbin/pcsuite-enable.sh</code> (Do not forget to change the ip address so it matches the one configured on your host's usb port.)
<pre>
<pre>
run-standalone.sh dbus-send --type=method_call --system --dest=com.nokia.icd /com/nokia/icd com.nokia.icd.connect string:DUMMY uint32:0
run-standalone.sh dbus-send --type=method_call --system --dest=com.nokia.icd /com/nokia/icd com.nokia.icd.connect string:DUMMY uint32:0
Line 167: Line 171:
  logger "$0: do nothing to pass USB certs"
  logger "$0: do nothing to pass USB certs"
  ifdown usb0
  ifdown usb0
-
  run-standalone.sh dbus-send --system --dest=com.nokia.icd /com/nokia/icd_ui com.nokia.icd_ui.disconnect boolean:true
+
  run-standalone.sh dbus-send --system --dest=com.nokia.icd /com/nokia/icd_ui com.nokia.icd_ui.disconnect boolean:true route del default netmask 0.0.0.0 gw 192.168.2.14
-
route del default netmask 0.0.0.0 gw 192.168.2.14
+
  exit 0
  exit 0
</pre>
</pre>
Line 206: Line 209:
== Host USB Network Configuration ==
== Host USB Network Configuration ==
-
The PC Host configuration is detailed in the [[USB networking#Host_USB_Network_Configuration|Maemo 4.x  USB Networking article]]. Please refer to it for details.
+
The Host configuration is detailed in the [[USB networking#Host_USB_Network_Configuration|Maemo 4.x  USB Networking article]]. Please refer to it for details.
 +
''FIXME, there is no usb host mode on n900''
=== Host configuration on Debian Lenny ===
=== Host configuration on Debian Lenny ===
Line 253: Line 257:
  ifconfig n900
  ifconfig n900
-
=== Automatic configuration with Ubuntu 12.04 ===
+
=== Automatic configuration with Ubuntu 9.10/10.04 ===
-
 
+
-
Create the file /etc/udev/rules.d/nokia-n900.rules and add this (single) line:
+
-
<pre>
+
-
ACTION=="add", DRIVERS=="usb", ATTRS{idVendor}=="0421", ATTRS{idProduct}=="01c8", ATTRS{manufacturer}=="Nokia", ATTRS{product}=="N900 (PC-Suite Mode)", NAME="usb0", RUN+="/sbin/ifup usb0"
+
-
</pre>
+
-
 
+
-
NetworkManager must be told to ignore usb0.  Use ifconfig to get the MAC address of usb0, and add these lines to /etc/NetworkManager/NetworkManager.conf:
+
-
<pre>
+
-
[keyfile]
+
-
unmanaged-devices=mac:XX:XX:XX:XX:XX:XX # replace X's with usb0 MAC address
+
-
</pre>
+
-
 
+
-
Add the following lines to /etc/network/interfaces:
+
-
<pre>
+
-
# N900 on usb0
+
-
allow-hotplug usb0
+
-
iface usb0 inet static
+
-
  address 192.168.2.14 
+
-
  netmask 255.255.255.0
+
-
</pre>
+
-
 
+
-
Restart the affected services:
+
-
<pre>
+
-
sudo service udev restart
+
-
sudo service network-manager restart
+
-
</pre>
+
-
 
+
-
Now when you connect the N900 via USB and select PC Suite Mode, usb0 will be up and configured.
+
-
 
+
-
=== Automatic configuration with Ubuntu 9.10/10.04/11.10 ===
+
Note: this instructions should be fixed/improved:
Note: this instructions should be fixed/improved:
Line 303: Line 277:
</pre>
</pre>
-
<strong>For Ubuntu 11.10</strong>, put these lines to /etc/udev/rules.d/99-nokia-n900.rules
+
For 9.10 (NOT 10.04) you have to fix <code>/etc/init/network-interface.conf</code>, change the line:
-
<pre>
+
-
SUBSYSTEM=="net", ACTION=="add", ATTRS{idVendor}=="0421", ATTRS{idProduct}=="01c8", ATTRS{manufacturer}=="Nokia", ATTRS{product}=="N900 (PC-Suite Mode)", NAME="usb0", RUN+="/sbin/ifconfig usb0 192.168.2.14 up", RUN+="/sbin/iptables -A POSTROUTING -t nat -s 192.168.2.15/32 -j MASQUERADE"
+
-
</pre>
+
-
and don't modify <code>/etc/network/interfaces</code> in the way above, because you will make the boot slow with the message "waiting for network configuration". But for forwarding you should add to <code>/etc/sysctl.conf</code>
+
-
<pre>
+
-
net.ipv4.ip_forward=1
+
-
</pre>
+
-
 
+
-
The Network Manager on Ubuntu 11.10 won't auto detect this <code>usb0</code> interface, you will have to check it via <code>ping</code> or via Network Tools.
+
-
 
+
-
<strong>For Ubuntu 11.04</strong>, just plug the USB cable in, with already-configured N900,the Network Manager will auto handle <code>usb0</code> interface.
+
-
 
+
-
<strong>For Ubuntu 9.10 (NOT 10.04)</strong> you have to fix <code>/etc/init/network-interface.conf</code>, change the line:
+
  stop on net-device-removed INTERFACE=$INTERFACE
  stop on net-device-removed INTERFACE=$INTERFACE
with:
with:
Line 322: Line 283:
(Note the difference: net-device-remove'''d''')
(Note the difference: net-device-remove'''d''')
-
<strong>For all versions:</strong> You have to reload udev rules with:
+
You have to reload udev rules with:
  udevadm control --reload-rules
  udevadm control --reload-rules
Line 338: Line 299:
* you should see with <code>ifconfig -a</code> two new network interfaces, n900 and n900pn, the first one configured with the proper ip address 192.168.2.15, and should be able to ping the N900.
* you should see with <code>ifconfig -a</code> two new network interfaces, n900 and n900pn, the first one configured with the proper ip address 192.168.2.15, and should be able to ping the N900.
* the N900 should be able to use the PC internet connection immediately.
* the N900 should be able to use the PC internet connection immediately.
-
 
-
=== Host configuration on Archlinux via netcfg ===
 
-
 
-
You will need to add the following lines into <code>/etc/network.d/N900</code>:
 
-
 
-
<pre>
 
-
CONNECTION='ethernet'
 
-
DESCRIPTION='Nokia n900 maemo USB passthrough network'
 
-
INTERFACE='usb0'
 
-
IP='static'
 
-
ADDR='192.168.2.14'
 
-
# GATEWAY='192.168.2.14'
 
-
# DNS=('192.168.2.14')
 
-
# PRE_UP='  << script loading of main module(s)! >>'
 
-
POST_UP='
 
-
        echo 1 > /proc/sys/net/ipv4/ip_forward &&
 
-
        iptables -A POSTROUTING -t nat -s 192.168.2.0/24 -j MASQUERADE &&
 
-
        iptables -I INPUT -s 192.168.2.15 -j ACCEPT &&
 
-
        iptables -P FORWARD ACCEPT'
 
-
POST_DOWN='
 
-
        echo 0 > /proc/sys/net/ipv4/ip_forward &&
 
-
        iptables -F &&
 
-
        iptables -t nat -F &&
 
-
        echo ":: Unloading cdc_ether" &&
 
-
        modprobe -r cdc_ether &&
 
-
        echo ":: Unloading cdc_phonet" &&
 
-
        modprobe -r cdc_phonet &&
 
-
        echo ":: Unloading usbnet" &&
 
-
        modprobe -r usbnet &&
 
-
        echo ":: Unloading phonet" &&
 
-
        modprobe -r phonet &&
 
-
        echo ":: Unloading cdc_acm" &&
 
-
        modprobe -r cdc_acm'
 
-
</pre>
 
-
 
-
You need to also add these to udev if you are also using udev. Normally they go into <code>/etc/udev.d/rules/</code>:
 
-
 
-
SUBSYSTEM=="net", ACTION=="add", ENV{ID_USB_DRIVER}=="cdc_ether", ENV{ID_MODEL}="N900__PC-Suite_Mode", ENV{ID_VENDOR}=="Nokia", NAME="usb0"
 
-
SUBSYSTEM=="net", ACTION=="add", ENV{ID_USB_DRIVER}=="cdc_phonet", ENV{ID_MODEL}="N900__PC-Suite_Mode", ENV{ID_VENDOR}=="Nokia", NAME="usb1"
 
-
 
-
Of course your entire configuration does not exactly have to be like this, it is only a rough guide.
 
-
 
-
If you don't use netcfg, you can have the udev rule directly configure the interface with e.g. <code>/etc/udev/rules.d/99-nokia-n900.rules</code>:
 
-
 
-
SUBSYSTEM=="net", ACTION=="add", ATTRS{idVendor}=="0421", ATTRS{idProduct}=="01c8", ATTRS{manufacturer}=="Nokia", ATTRS{product}=="N900 (PC-Suite Mode)", NAME="n900", RUN+="/sbin/ifconfig n900 192.168.2.14"
 
-
 
-
This may even work with multiple USB devices connected, because it's matching on the vendor and product IDs rather than the interface name.
 
=== Windows ===
=== Windows ===
Line 443: Line 357:
By default, standard network applications works well with USB networking, while Maemo-specific applications do not.
By default, standard network applications works well with USB networking, while Maemo-specific applications do not.
-
Install <code>libicd-network-dummy</code> from Fremantle Nokia-binaries repository or better <code>libicd-network-null</code> from [[extras-devel]], and when USB networking is up pickup "Dummy network" from the connection manager. One way to do it:
+
Install <code>libicd-network-dummy</code> from Fremantle Nokia-binaries repository or better <code>libicd-network-null</code> from [[extras-devel]], and when USB networking is up pickup "Dummy network" from the connection manager.
-
apt-get install libicd-network-dummy
+
-
  or
+
-
apt-get install libicd-network-null
+
-
 
+
If the dummy network does not show up in the network manager you could run
If the dummy network does not show up in the network manager you could run
the following commands in xterm:
the following commands in xterm:

Learn more about Contributing to the wiki.


Please note that all contributions to maemo.org wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see maemo.org wiki:Copyrights for details). Do not submit copyrighted work without permission!


Cancel | Editing help (opens in new window)