N900 USB networking
(Update) |
(→Automatic configuration with Ubuntu 12.04) |
||
(67 intermediate revisions not shown) | |||
Line 1: | Line 1: | ||
- | This page describes how to enable Networking on the [[N900]] via [[USB]]. The first part describes how to configure the | + | 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. |
- | 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 | + | 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. |
== N900 USB network configuration == | == N900 USB network configuration == | ||
- | There is a default USB network interface configuration on Nokia N900. In the file /etc/network/interfaces, you should see a section which looks like this: | + | |
+ | If you are going to use windows as your host, the configuration needed on your N900 are a little different, so skip directly to the "Starting USB network mode with Windows" Part. | ||
+ | |||
+ | There is a default USB network interface configuration on Nokia N900. In the file <code>/etc/network/interfaces</code>, you should see a section which looks like this: | ||
<pre> | <pre> | ||
auto usb0 | auto usb0 | ||
Line 16: | 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 21: | Line 26: | ||
down run-standalone.sh dbus-send --system --dest=com.nokia.icd /com/nokia/icd_ui com.nokia.icd_ui.disconnect boolean:true | down run-standalone.sh dbus-send --system --dest=com.nokia.icd /com/nokia/icd_ui com.nokia.icd_ui.disconnect boolean:true | ||
- | to properly set/reset the connection manager on connection/disconnection | + | to properly set/reset the connection manager on connection/disconnection, especially if you have set up a DUMMY network as decribed later. |
- | especially if you have set up a DUMMY network as decribed later. | + | |
- | With this default configuration, the N900 USB interface will have the IP address 192.168.2.15, and the remote end will have the IP address 192.168.2.14. | + | With this default configuration, the N900 USB interface will have the IP address 192.168.2.15, and the remote end will have the IP address 192.168.2.14. By default, the USB network interface on the N900 is configured. You need to install the package usb-network-modules. |
- | By default, the USB network interface on the N900 is configured. | + | |
- | You need to install the package usb-network-modules. | + | |
=== Starting USB network mode === | === Starting USB network mode === | ||
+ | |||
+ | First, set up the host (the computer at the other end of the USB connection, not the N900) to have an IP address of the gateway --in our case here, it's 192.168.2.14. For a typical Linux computer, one might use the command "ifconfig usb0 192.168.2.14" (add "sudo" to the beginning of that command if necessary). There may be other ways to do it for various versions of operating systems. | ||
+ | |||
Plug one end of the USB cable on the host and the other end into the N900. The N900 will bring up the mode-selection dialog. Select 'PC Suite mode'. | Plug one end of the USB cable on the host and the other end into the N900. The N900 will bring up the mode-selection dialog. Select 'PC Suite mode'. | ||
Line 36: | Line 41: | ||
- | Open a root shell in | + | Open a [[root access|root shell]] in [[terminal|X Terminal]] on the N900 and activate the interface by executing the following: |
<pre> | <pre> | ||
sudo gainroot | sudo gainroot | ||
Line 66: | Line 71: | ||
</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>. | |
+ | |||
+ | <pre> | ||
+ | # Automatically enable USB network when PC Suite mode is active (default disabled) | ||
+ | USBNETWORK_ENABLE=1 | ||
+ | </pre> | ||
+ | |||
+ | In fact if you want to use the `Mail to exchange' feature to synchronize mail, calendar or contacts with an exchange server (such as Google mail) the 'PC suite mode' might block the exchange. So do not use it when connected in that mode, instead choose the 'charging only' mode instead. This | ||
+ | mode can be achieved by choosing neither of the offers in the above menu. Simply tap above the menu to close it. This 'charging only' mode still gives you the usb0 interface provided that you initialized it | ||
+ | once through the 'PC suite mode'. | ||
If you can not ping the outside world (for example: local network works but Google does not), check your routing tables. | If you can not ping the outside world (for example: local network works but Google does not), check your routing tables. | ||
- | <pre>/home/user # route | + | <pre> |
+ | /home/user # route | ||
Kernel IP routing table | Kernel IP routing table | ||
Destination Gateway Genmask Flags Metric Ref Use Iface | Destination Gateway Genmask Flags Metric Ref Use Iface | ||
192.168.2.0 * 255.255.255.0 U 0 0 0 usb0 | 192.168.2.0 * 255.255.255.0 U 0 0 0 usb0 | ||
default 192.168.2.14 0.0.0.0 UG 0 0 0 usb0 | default 192.168.2.14 0.0.0.0 UG 0 0 0 usb0 | ||
- | default * 0.0.0.0 U 0 0 0 gprs0</pre> | + | default * 0.0.0.0 U 0 0 0 gprs0 |
+ | </pre> | ||
If you have a situation like above where the cell network's packets are at a lower default priority, you might have to run the following to fix it: | If you have a situation like above where the cell network's packets are at a lower default priority, you might have to run the following to fix it: | ||
- | <pre>/home/user # route del default | + | <pre> |
+ | /home/user # route del default | ||
/home/user # route | /home/user # route | ||
Kernel IP routing table | Kernel IP routing table | ||
Line 91: | Line 108: | ||
--- google.com ping statistics --- | --- google.com ping statistics --- | ||
3 packets transmitted, 3 packets received, 0% packet loss | 3 packets transmitted, 3 packets received, 0% packet loss | ||
- | round-trip min/avg/max = 236.481/249.929/257.081 ms</pre> | + | round-trip min/avg/max = 236.481/249.929/257.081 ms |
+ | </pre> | ||
- | If after having fixed the routing table you still are not able to ping | + | If after having fixed the routing table you still are not able to ping the outside world try to add a nameserver to <code>/etc/resolv.conf</code> |
- | the outside world try to add a nameserver to /etc/resolv.conf | + | |
nameserver 127.0.0.1 | nameserver 127.0.0.1 | ||
Line 102: | Line 119: | ||
=== Stopping USB network mode === | === Stopping USB network mode === | ||
+ | |||
This is optional. It is not necessary to stop the interface after unplugging the USB cable. | This is optional. It is not necessary to stop the interface after unplugging the USB cable. | ||
Line 109: | Line 127: | ||
ifdown usb0 | ifdown usb0 | ||
</pre> | </pre> | ||
+ | |||
+ | === Starting USB network mode with Windows === | ||
+ | |||
+ | To use the USB network mode alongside with a Windows host, you must use [[MADDE]]. MADDE will not work with just changing the configuration in the <code>/etc/network/interfaces</code> file. Different modification are needed: | ||
+ | |||
+ | <ol> | ||
+ | <li> | ||
+ | Install MADDE package (actually MADDE for Windows is not required, but just files '''maemo_usbnet.inf''' and '''maemo_usbnet.cat''' for installation network device '''Linux USB Ethernet/RNDIS Gadget'''). | ||
+ | </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.) | ||
+ | <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 | ||
+ | route del default | ||
+ | route add default gw 192.168.2.14 | ||
+ | </pre> | ||
+ | so it looks like this : | ||
+ | <source lang="bash"> | ||
+ | if [ $RC != 0 ]; then | ||
+ | logger "$0: failed to install g_nokia" | ||
+ | run-standalone.sh dbus-send --type=method_call --system --dest=com.nokia.icd /com/nokia/icd com.nokia.icd.connect string:DUMMY uint32:0 | ||
+ | route del default | ||
+ | route add default gw 192.168.2.14 | ||
+ | exit 1 | ||
+ | else | ||
+ | sleep 2 | ||
+ | fi | ||
+ | </source> | ||
+ | </li> | ||
+ | <li> | ||
+ | Add the following lines to <code>/usr/sbin/pcsuite-disable.sh</code> (Don't forget to change the ip...) | ||
+ | <pre> | ||
+ | ifdown usb0 | ||
+ | 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 | ||
+ | </pre> | ||
+ | So it looks like this: | ||
+ | <pre> | ||
+ | logger "$0: do nothing to pass USB certs" | ||
+ | ifdown usb0 | ||
+ | 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 | ||
+ | exit 0 | ||
+ | </pre> | ||
+ | </li> | ||
+ | <li> | ||
+ | This will cause the dummy network to connect when USB networking is used, right after you press the "PC Suite" button in the popup that comes after connecting the USB cable. This will only work if you got MADDE installed and configured for "Windows network". Also, a route will be added to your host machine, with Windows it is very easy to share connections. You should now have network connectivity to your PC + Internet. | ||
+ | </li> | ||
+ | <li>Once you disconnect the USB cable, the dummy network will disconnect and the route will be deleted. | ||
+ | </li> | ||
+ | <li> | ||
+ | Add a DNS server of your choice to <code>/etc/resolv.conf</code>, for example: | ||
+ | <pre> | ||
+ | nameserver 8.8.8.8 | ||
+ | nameserver 8.8.4.4 | ||
+ | </pre> | ||
+ | </li> | ||
+ | </ol> | ||
+ | |||
+ | Windows 7 (and probably Vista) have firewall setups based network location. This means you might run into problems trying to connect to services on your Windows boxen, because by default N900 USB Network adapter isn't known to Windows as a proper type of NDIS device. This causes Windows to put connections made over USB into "unidentified connections" category and apply Public Location firewall rules to it. Now of course you could poke all the holes into your Public firewall profile and make it look like Swiss cheese, but fortunately some VirtualBox people ran into the same thing with their loopback adapter and [http://forums.virtualbox.org/viewtopic.php?p=73167#p73167 solved it for us]: | ||
+ | # open Registry Editor | ||
+ | # browse to <code>HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}</code> (all network adapters are stored here) | ||
+ | # find your N900 USB adapter sub-key, it says the adapter name somewhere in key | ||
+ | # add <code>DWORD</code> key <code>*NdisDeviceType</code> with a value 1 | ||
+ | Now your USB connection is considered part of Private firewall profile. Stay safe and go buy Swiss cheese in supermarket instead. | ||
+ | |||
+ | === Fixing the MAC address === | ||
+ | |||
+ | By default, the N900 sets a random MAC address for the USB interface every time you reboot. | ||
+ | This makes some operating systems (Mac OS X) detect a new device whenever you connect the N900 | ||
+ | and ask you to configure the network interface. The solutions is to set a fixed MAC address | ||
+ | <pre> | ||
+ | sudo gainroot | ||
+ | echo options g_nokia host_addr=00:11:22:33:44:55 > /etc/modprobe.d/g_nokia | ||
+ | </pre> | ||
+ | After the next reboot your N900 will always be detected as the same device. | ||
== 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. | |
+ | |||
- | == Host configuration on Debian Lenny == | + | === Host configuration on Debian Lenny === |
Create the file in /etc/udev/rules.d/99-nokia-n900.rules and put in the following lines: | Create the file in /etc/udev/rules.d/99-nokia-n900.rules and put in the following lines: | ||
Line 121: | Line 215: | ||
#SUBSYSTEM=="net", ACTION=="add", ATTRS{idVendor}=="0421", ATTRS{idProduct}=="01c8", ATTRS{manufacturer}=="Nokia", ATTRS{product}=="N900 (PC-Suite Mode)", NAME="n900p" | #SUBSYSTEM=="net", ACTION=="add", ATTRS{idVendor}=="0421", ATTRS{idProduct}=="01c8", ATTRS{manufacturer}=="Nokia", ATTRS{product}=="N900 (PC-Suite Mode)", NAME="n900p" | ||
- | + | The second rule is commented out as it is not needed for usb networking. | |
+ | A different approach uses a DEVPATH key: | ||
+ | |||
+ | SUBSYSTEM=="net", ACTION=="add", DEVPATH=="/devices/pci0000:00/0000:00:1a.7/usb1/1-2/1-2:1.8/net/usb0", ATTRS{idVendor}=="0421", ATTRS{idProduct}=="01c8", ATTRS{manufacturer}=="Nokia", ATTRS{product}=="N900 (PC-Suite Mode)", NAME="n900" | ||
+ | SUBSYSTEM=="net", ACTION=="add", DEVPATH=="/devices/pci0000:00/0000:00:1a.7/usb1/1-2/1-2:1.0/net/usbpn0", ATTRS{idVendor}=="0421", ATTRS{idProduct}=="01c8", ATTRS{manufacturer}=="Nokia", ATTRS{product}=="N900 (PC-Suite Mode)", NAME="n900p" | ||
+ | |||
+ | Your DEVPATH may be different though, depending on which USB port is used on the host computer etc, so to make this work reliably you have to use always | ||
+ | the same usb port. | ||
+ | |||
+ | You can use | ||
+ | |||
+ | udevadm monitor --kernel | ||
+ | |||
+ | while plugging in the N900 to see what is the correct path. | ||
+ | |||
+ | Newer kernels/udev versions seem to be confused to seeing both <code>usb0</code> and <code>usbpn0</code> devices. Luckily DEVPATH accepts wildcards, so you may want to try something like: | ||
+ | SUBSYSTEM=="net", ACTION=="add", DEVPATH=="*/net/usb[0-9]", ATTRS{idVendor}=="0421", ATTRS{idProduct}=="01c8", ATTRS{manufacturer} =="Nokia", ATTRS{product}=="N900 (PC-Suite Mode)", NAME="n900" | ||
+ | |||
+ | After adding the udev rules, you have to reload them with: | ||
udevadm control --reload-rules | udevadm control --reload-rules | ||
- | Then edit /etc/network/interfaces and add: | + | Then edit <code>/etc/network/interfaces</code> and add: |
<pre> | <pre> | ||
allow-hotplug n900 | allow-hotplug n900 | ||
Line 137: | Line 249: | ||
</pre> | </pre> | ||
- | Now put your | + | Now put your USB cable in the PC and in the N900 and on the host. To check that everything is set up properly you can run: |
- | To check that everything is set up properly you can run: | + | |
ifconfig n900 | ifconfig n900 | ||
- | == Automatic configuration with | + | === Automatic configuration with Ubuntu 12.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 149: | Line 291: | ||
SUBSYSTEM=="net", ACTION=="add", ENV{ID_USB_DRIVER}=="cdc_phonet", ENV{ID_MODEL}="N900__PC-Suite_Mode", ENV{ID_VENDOR}=="Nokia", NAME="n900pn" | SUBSYSTEM=="net", ACTION=="add", ENV{ID_USB_DRIVER}=="cdc_phonet", ENV{ID_MODEL}="N900__PC-Suite_Mode", ENV{ID_VENDOR}=="Nokia", NAME="n900pn" | ||
- | Then edit /etc/network/interfaces and add: | + | Then edit <code>/etc/network/interfaces</code> and add: |
<pre> | <pre> | ||
auto n900 | auto n900 | ||
Line 161: | Line 303: | ||
</pre> | </pre> | ||
- | + | <strong>For Ubuntu 11.10</strong>, put these lines to /etc/udev/rules.d/99-nokia-n900.rules | |
+ | <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 167: | Line 322: | ||
(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 | ||
- | Now put your | + | You have to restart NetworkManager so it re-reads the interfaces file (otherwise it'll clobber your network device): |
+ | sudo /etc/init.d/network-manager restart | ||
+ | or | ||
+ | sudo service network-manager restart | ||
+ | |||
+ | Now put your USB cable in the PC and in the N900. | ||
+ | |||
+ | If you are unable to autoconnect through the networking applet, you may need to manually bring up the interface: | ||
+ | ifup n900 | ||
If all went fine: | If all went fine: | ||
- | * you should see with ifconfig -a 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 | + | * 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. | ||
- | + | === Host configuration on Archlinux via netcfg === | |
- | == Windows | + | You will need to add the following lines into <code>/etc/network.d/N900</code>: |
- | Windows | + | |
+ | <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 USB networking does not work out of the box, but the old 770 workaround still works. | ||
So follow these steps: | So follow these steps: | ||
- | + | # install the [[MADDE|Mad Developer]] application on N900 and start it and press "'''Usb Networking'''" -> "'''Windows Network'''" -> "'''Close'''". | |
- | + | # Press button "'''Edit'''" and enter following '''IP Address:''' 192.168.2.15, '''Netmask:''' 255.255.255.0, '''Peer IP:''' 192.168.2.14. and then press "'''Configure'''" (this address will be used for the SCP client as well). | |
- | + | # For Windows OS download [http://tablets-dev.nokia.com/MADDE.php install-madde-0.6.72.exe]. Open file with '''7-Zip''' and extract somewhere (best to the desktop) files "'''maemo_usbnet.inf'''" and "'''maemo_usbnet.cat'''" | |
- | + | # Connect your N900 via USB and choose '''PC Suite mode'''. | |
- | + | # PC will obtain drivers for new network device, just point it to the downloaded files. This will install network device "'''Linux USB Ethernet/RNDIS Gadget'''" | |
- | + | # Set for "Linux USB Ethernet/RNDIS Gadget" IP address '''192.168.2.14'''. | |
+ | # For Vista / Windows7 open "'''Network and Sharing center'''" and select "'''Manage network connections'''" (left menu) --> right click on network device which have internet access and choose "'''Properties'''" --> select '''tab "Sharing"''' --> check box "'''Allow other devices to connect...'''" --> under "'''Home networking connection'''" select the network connection (Local Area Connection n#) which is dedicated to "Linux USB Ethernet/RNDIS Gadget". | ||
+ | # When you have finished USB Networking, to retrieve default state of N900 press in Mad Developer: "'''Usb Networking'''" -> "'''Unix Network'''" -> "'''Close'''". | ||
- | == | + | === Mac OS X === |
- | By default standard network | + | |
+ | OS X will detect a new network interface and ask you to configure it. Choose DHCP with manual address and set the IP address to 192.168.2.14 | ||
+ | |||
+ | To use the Internet connection of your Mac via USB networking make sure to enable System Preferences -> Sharing -> Internet sharing for the N900 interface [http://docs.info.apple.com/article.html?path=Mac/10.5/en/8156.html Howto] | ||
+ | |||
+ | == One-time Quick & Dirty Connection == | ||
+ | |||
+ | If you just need a one-time connection quickly, with no need to edit configuration files or set things up for automatic detection/connection, then as an alternative to the above, the following has worked for this user (kwtm). Make sure "usb-network-modules" and "rootsh" are installed (via Applications Manager or equivalent). | ||
+ | |||
+ | <ol> | ||
+ | <li> | ||
+ | connect the N900 to the Other Computer via USB cable, and select "PC Suite mode" when asked. | ||
+ | </li> | ||
+ | <li> | ||
+ | open a terminal on the N900 and type: | ||
+ | <pre> | ||
+ | sudo gainroot | ||
+ | ifconfig usb0 192.168.2.15 | ||
+ | ifconfig usb0 up | ||
+ | </pre> | ||
+ | </li> | ||
+ | <li> | ||
+ | on your Other Computer, open a terminal and type the following for Ubuntu; modify appropriately for other computers: | ||
+ | <pre> | ||
+ | sudo ifconfig usb0 192.168.2.14 | ||
+ | sudo ifconfig usb0 up | ||
+ | ssh -l user -v 192.168.2.15 | ||
+ | </pre> | ||
+ | </li> | ||
+ | </ol> | ||
+ | |||
+ | That is all. You should now be connected via terminal to your N900. Whatever you type on your Other Computer, it will be as if you are typing on the N900 itself in a terminal. Non-Ubuntu Linux computers might not use the "sudo" command, so you will have to gain root another way. One possibility that will probably work is to use the "su" command first, allowing you to omit "sudo" on the above commands: | ||
+ | su # (And then enter the root password when asked) | ||
+ | ifconfig usb0 192.168.2.14 | ||
+ | ifconfig usb0 up | ||
+ | exit # (This stops the root mode) | ||
+ | ssh -l user -v 192.168.2.15 | ||
+ | [I have no idea what to do for Windows computers. Perhaps someone can post the equivalent commands?] | ||
+ | |||
+ | == Using USB networking for Maemo applications == | ||
+ | |||
+ | 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: | ||
+ | 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: | ||
Line 201: | Line 456: | ||
gconftool-2 -s -t string /system/osso/connectivity/IAP/DUMMY/autoconnect false | gconftool-2 -s -t string /system/osso/connectivity/IAP/DUMMY/autoconnect false | ||
+ | |||
+ | If connect automatically is used with "Any Connection", the phone will also use Dummy Network, which is not good. To prevent this, you need to run the following command : | ||
+ | gconftool -s /system/osso/connectivity/network_type/auto_connect -t list --list-type string "[WLAN_INFRA,GPRS]" | ||
+ | Keep in mind the above command will get overwritten if you change the value via UI. (If you choose any / wifi / gprs, and you will want to go back to "wifi or gprs" you will have to do the CLI thing again. | ||
Then restart icd2: | Then restart icd2: |
Latest revision as of 14:33, 4 August 2014
This page describes how to enable Networking on the 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 Maemo 4.x USB networking article. It is also possible to use the N900 as a USB router, to share N900 internet to PC.
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 PC connectivity section in the Maemo SDK documentation also contains useful information.
Contents |
[edit] N900 USB network configuration
If you are going to use windows as your host, the configuration needed on your N900 are a little different, so skip directly to the "Starting USB network mode with Windows" Part.
There is a default USB network interface configuration on Nokia N900. In the file /etc/network/interfaces
, you should see a section which looks like this:
auto usb0 iface usb0 inet static address 192.168.2.15 netmask 255.255.255.0 gateway 192.168.2.14
You can also add the following lines to set the default route correctly
up route del default up route add default gw 192.168.2.14
Also you can add the following lines to set the nameserver (dnsmasq will automatically change /etc/resolve.conf
)
dns-nameservers 8.8.8.8 8.8.4.4
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
down run-standalone.sh dbus-send --system --dest=com.nokia.icd /com/nokia/icd_ui com.nokia.icd_ui.disconnect boolean:true
to properly set/reset the connection manager on connection/disconnection, especially if you have set up a DUMMY network as decribed later.
With this default configuration, the N900 USB interface will have the IP address 192.168.2.15, and the remote end will have the IP address 192.168.2.14. By default, the USB network interface on the N900 is configured. You need to install the package usb-network-modules.
[edit] Starting USB network mode
First, set up the host (the computer at the other end of the USB connection, not the N900) to have an IP address of the gateway --in our case here, it's 192.168.2.14. For a typical Linux computer, one might use the command "ifconfig usb0 192.168.2.14" (add "sudo" to the beginning of that command if necessary). There may be other ways to do it for various versions of operating systems.
Plug one end of the USB cable on the host and the other end into the N900. The N900 will bring up the mode-selection dialog. Select 'PC Suite mode'.
Open a root shell in X Terminal on the N900 and activate the interface by executing the following:
sudo gainroot ifup usb0
If all went well, no errors will be displayed. The command 'ifconfig usb0' will give the following output:
Nokia-N900-42-11:~# ifconfig usb0 usb0 Link encap:Ethernet HWaddr F2:50:8F:04:1D:8B inet addr:192.168.2.15 Bcast:192.168.2.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1021 errors:0 dropped:0 overruns:0 frame:0 TX packets:2003 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:86091 (84.0 KiB) TX bytes:2556598 (2.4 MiB)
You should also be able to ping 192.168.2.15
Nokia-N900-42-11:~# ping 192.168.2.15 PING 192.168.2.15 (192.168.2.15): 56 data bytes 64 bytes from 192.168.2.15: seq=0 ttl=64 time=0.367 ms 64 bytes from 192.168.2.15: seq=1 ttl=64 time=0.214 ms ^C --- 192.168.2.15 ping statistics --- 2 packets transmitted, 2 packets received, 0% packet loss round-trip min/avg/max = 0.214/0.290/0.367 ms
To automatically setup usb0 when entering PC suite mode edit the file /etc/default/usbnetwork
and set the variable USBNETWORK_ENABLE
.
# Automatically enable USB network when PC Suite mode is active (default disabled) USBNETWORK_ENABLE=1
In fact if you want to use the `Mail to exchange' feature to synchronize mail, calendar or contacts with an exchange server (such as Google mail) the 'PC suite mode' might block the exchange. So do not use it when connected in that mode, instead choose the 'charging only' mode instead. This mode can be achieved by choosing neither of the offers in the above menu. Simply tap above the menu to close it. This 'charging only' mode still gives you the usb0 interface provided that you initialized it once through the 'PC suite mode'.
If you can not ping the outside world (for example: local network works but Google does not), check your routing tables.
/home/user # route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.2.0 * 255.255.255.0 U 0 0 0 usb0 default 192.168.2.14 0.0.0.0 UG 0 0 0 usb0 default * 0.0.0.0 U 0 0 0 gprs0
If you have a situation like above where the cell network's packets are at a lower default priority, you might have to run the following to fix it:
/home/user # route del default /home/user # route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.2.0 * 255.255.255.0 U 0 0 0 usb0 default * 0.0.0.0 U 0 0 0 gprs0 /home/user # ping google.com PING google.com (74.125.45.103): 56 data bytes 64 bytes from 74.125.45.103: seq=0 ttl=51 time=257.081 ms 64 bytes from 74.125.45.103: seq=1 ttl=51 time=236.481 ms 64 bytes from 74.125.45.103: seq=2 ttl=51 time=256.226 ms ^C --- google.com ping statistics --- 3 packets transmitted, 3 packets received, 0% packet loss round-trip min/avg/max = 236.481/249.929/257.081 ms
If after having fixed the routing table you still are not able to ping the outside world try to add a nameserver to /etc/resolv.conf
nameserver 127.0.0.1 # added Google DNS nameserver 8.8.8.8 nameserver 8.8.4.4
[edit] Stopping USB network mode
This is optional. It is not necessary to stop the interface after unplugging the USB cable.
However, to stop the USB interface, unplug the USB cable and execute the following in 'X Terminal'
sudo gainroot ifdown usb0
[edit] Starting USB network mode with Windows
To use the USB network mode alongside with a Windows host, you must use MADDE. MADDE will not work with just changing the configuration in the /etc/network/interfaces
file. Different modification are needed:
- Install MADDE package (actually MADDE for Windows is not required, but just files maemo_usbnet.inf and maemo_usbnet.cat for installation network device Linux USB Ethernet/RNDIS Gadget).
-
Add the following lines to
/usr/sbin/pcsuite-enable.sh
(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.)run-standalone.sh dbus-send --type=method_call --system --dest=com.nokia.icd /com/nokia/icd com.nokia.icd.connect string:DUMMY uint32:0 route del default route add default gw 192.168.2.14
so it looks like this :
if [ $RC != 0 ]; then logger "$0: failed to install g_nokia" run-standalone.sh dbus-send --type=method_call --system --dest=com.nokia.icd /com/nokia/icd com.nokia.icd.connect string:DUMMY uint32:0 route del default route add default gw 192.168.2.14 exit 1 else sleep 2 fi
-
Add the following lines to
/usr/sbin/pcsuite-disable.sh
(Don't forget to change the ip...)ifdown usb0 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
So it looks like this:
logger "$0: do nothing to pass USB certs" ifdown usb0 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 exit 0
- This will cause the dummy network to connect when USB networking is used, right after you press the "PC Suite" button in the popup that comes after connecting the USB cable. This will only work if you got MADDE installed and configured for "Windows network". Also, a route will be added to your host machine, with Windows it is very easy to share connections. You should now have network connectivity to your PC + Internet.
- Once you disconnect the USB cable, the dummy network will disconnect and the route will be deleted.
-
Add a DNS server of your choice to
/etc/resolv.conf
, for example:nameserver 8.8.8.8 nameserver 8.8.4.4
Windows 7 (and probably Vista) have firewall setups based network location. This means you might run into problems trying to connect to services on your Windows boxen, because by default N900 USB Network adapter isn't known to Windows as a proper type of NDIS device. This causes Windows to put connections made over USB into "unidentified connections" category and apply Public Location firewall rules to it. Now of course you could poke all the holes into your Public firewall profile and make it look like Swiss cheese, but fortunately some VirtualBox people ran into the same thing with their loopback adapter and solved it for us:
- open Registry Editor
- browse to
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}
(all network adapters are stored here) - find your N900 USB adapter sub-key, it says the adapter name somewhere in key
- add
DWORD
key*NdisDeviceType
with a value 1
Now your USB connection is considered part of Private firewall profile. Stay safe and go buy Swiss cheese in supermarket instead.
[edit] Fixing the MAC address
By default, the N900 sets a random MAC address for the USB interface every time you reboot. This makes some operating systems (Mac OS X) detect a new device whenever you connect the N900 and ask you to configure the network interface. The solutions is to set a fixed MAC address
sudo gainroot echo options g_nokia host_addr=00:11:22:33:44:55 > /etc/modprobe.d/g_nokia
After the next reboot your N900 will always be detected as the same device.
[edit] Host USB Network Configuration
The PC Host configuration is detailed in the Maemo 4.x USB Networking article. Please refer to it for details.
[edit] Host configuration on Debian Lenny
Create the file in /etc/udev/rules.d/99-nokia-n900.rules and put in the following lines:
SUBSYSTEM=="net", ACTION=="add", ATTRS{idVendor}=="0421", ATTRS{idProduct}=="01c8", ATTRS{manufacturer}=="Nokia", ATTRS{product}=="N900 (PC-Suite Mode)", NAME="n900" #SUBSYSTEM=="net", ACTION=="add", ATTRS{idVendor}=="0421", ATTRS{idProduct}=="01c8", ATTRS{manufacturer}=="Nokia", ATTRS{product}=="N900 (PC-Suite Mode)", NAME="n900p"
The second rule is commented out as it is not needed for usb networking. A different approach uses a DEVPATH key:
SUBSYSTEM=="net", ACTION=="add", DEVPATH=="/devices/pci0000:00/0000:00:1a.7/usb1/1-2/1-2:1.8/net/usb0", ATTRS{idVendor}=="0421", ATTRS{idProduct}=="01c8", ATTRS{manufacturer}=="Nokia", ATTRS{product}=="N900 (PC-Suite Mode)", NAME="n900" SUBSYSTEM=="net", ACTION=="add", DEVPATH=="/devices/pci0000:00/0000:00:1a.7/usb1/1-2/1-2:1.0/net/usbpn0", ATTRS{idVendor}=="0421", ATTRS{idProduct}=="01c8", ATTRS{manufacturer}=="Nokia", ATTRS{product}=="N900 (PC-Suite Mode)", NAME="n900p"
Your DEVPATH may be different though, depending on which USB port is used on the host computer etc, so to make this work reliably you have to use always the same usb port.
You can use
udevadm monitor --kernel
while plugging in the N900 to see what is the correct path.
Newer kernels/udev versions seem to be confused to seeing both usb0
and usbpn0
devices. Luckily DEVPATH accepts wildcards, so you may want to try something like:
SUBSYSTEM=="net", ACTION=="add", DEVPATH=="*/net/usb[0-9]", ATTRS{idVendor}=="0421", ATTRS{idProduct}=="01c8", ATTRS{manufacturer} =="Nokia", ATTRS{product}=="N900 (PC-Suite Mode)", NAME="n900"
After adding the udev rules, you have to reload them with:
udevadm control --reload-rules
Then edit /etc/network/interfaces
and add:
allow-hotplug n900 auto n900 iface n900 inet static address 192.168.2.14 netmask 255.255.255.0 up iptables -A POSTROUTING -t nat -s 192.168.2.15/32 -j MASQUERADE up echo 1 > /proc/sys/net/ipv4/ip_forward down iptables -D POSTROUTING -t nat -s 192.168.2.15/32 -j MASQUERADE down echo 0 > /proc/sys/net/ipv4/ip_forward
Now put your USB cable in the PC and in the N900 and on the host. To check that everything is set up properly you can run:
ifconfig n900
[edit] Automatic configuration with Ubuntu 12.04
Create the file /etc/udev/rules.d/nokia-n900.rules and add this (single) line:
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"
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:
[keyfile] unmanaged-devices=mac:XX:XX:XX:XX:XX:XX # replace X's with usb0 MAC address
Add the following lines to /etc/network/interfaces:
# N900 on usb0 allow-hotplug usb0 iface usb0 inet static address 192.168.2.14 netmask 255.255.255.0
Restart the affected services:
sudo service udev restart sudo service network-manager restart
Now when you connect the N900 via USB and select PC Suite Mode, usb0 will be up and configured.
[edit] Automatic configuration with Ubuntu 9.10/10.04/11.10
Note: this instructions should be fixed/improved:
Create the file in /etc/udev/rules.d/99-nokia-n900.rules and put in the following lines:
SUBSYSTEM=="net", ACTION=="add", ENV{ID_USB_DRIVER}=="cdc_ether", ENV{ID_MODEL}="N900__PC-Suite_Mode", ENV{ID_VENDOR}=="Nokia", NAME="n900" SUBSYSTEM=="net", ACTION=="add", ENV{ID_USB_DRIVER}=="cdc_phonet", ENV{ID_MODEL}="N900__PC-Suite_Mode", ENV{ID_VENDOR}=="Nokia", NAME="n900pn"
Then edit /etc/network/interfaces
and add:
auto n900 iface n900 inet static address 192.168.2.14 netmask 255.255.255.0 up iptables -A POSTROUTING -t nat -s 192.168.2.15/32 -j MASQUERADE up echo 1 > /proc/sys/net/ipv4/ip_forward down iptables -D POSTROUTING -t nat -s 192.168.2.15/32 -j MASQUERADE down echo 0 > /proc/sys/net/ipv4/ip_forward
For Ubuntu 11.10, put these lines to /etc/udev/rules.d/99-nokia-n900.rules
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"
and don't modify /etc/network/interfaces
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 /etc/sysctl.conf
net.ipv4.ip_forward=1
The Network Manager on Ubuntu 11.10 won't auto detect this usb0
interface, you will have to check it via ping
or via Network Tools.
For Ubuntu 11.04, just plug the USB cable in, with already-configured N900,the Network Manager will auto handle usb0
interface.
For Ubuntu 9.10 (NOT 10.04) you have to fix /etc/init/network-interface.conf
, change the line:
stop on net-device-removed INTERFACE=$INTERFACE
with:
stop on net-device-remove INTERFACE=$INTERFACE
(Note the difference: net-device-removed)
For all versions: You have to reload udev rules with:
udevadm control --reload-rules
You have to restart NetworkManager so it re-reads the interfaces file (otherwise it'll clobber your network device):
sudo /etc/init.d/network-manager restart
or
sudo service network-manager restart
Now put your USB cable in the PC and in the N900.
If you are unable to autoconnect through the networking applet, you may need to manually bring up the interface:
ifup n900
If all went fine:
- you should see with
ifconfig -a
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.
[edit] Host configuration on Archlinux via netcfg
You will need to add the following lines into /etc/network.d/N900
:
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'
You need to also add these to udev if you are also using udev. Normally they go into /etc/udev.d/rules/
:
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. /etc/udev/rules.d/99-nokia-n900.rules
:
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.
[edit] Windows
Windows USB networking does not work out of the box, but the old 770 workaround still works. So follow these steps:
- install the Mad Developer application on N900 and start it and press "Usb Networking" -> "Windows Network" -> "Close".
- Press button "Edit" and enter following IP Address: 192.168.2.15, Netmask: 255.255.255.0, Peer IP: 192.168.2.14. and then press "Configure" (this address will be used for the SCP client as well).
- For Windows OS download install-madde-0.6.72.exe. Open file with 7-Zip and extract somewhere (best to the desktop) files "maemo_usbnet.inf" and "maemo_usbnet.cat"
- Connect your N900 via USB and choose PC Suite mode.
- PC will obtain drivers for new network device, just point it to the downloaded files. This will install network device "Linux USB Ethernet/RNDIS Gadget"
- Set for "Linux USB Ethernet/RNDIS Gadget" IP address 192.168.2.14.
- For Vista / Windows7 open "Network and Sharing center" and select "Manage network connections" (left menu) --> right click on network device which have internet access and choose "Properties" --> select tab "Sharing" --> check box "Allow other devices to connect..." --> under "Home networking connection" select the network connection (Local Area Connection n#) which is dedicated to "Linux USB Ethernet/RNDIS Gadget".
- When you have finished USB Networking, to retrieve default state of N900 press in Mad Developer: "Usb Networking" -> "Unix Network" -> "Close".
[edit] Mac OS X
OS X will detect a new network interface and ask you to configure it. Choose DHCP with manual address and set the IP address to 192.168.2.14
To use the Internet connection of your Mac via USB networking make sure to enable System Preferences -> Sharing -> Internet sharing for the N900 interface Howto
[edit] One-time Quick & Dirty Connection
If you just need a one-time connection quickly, with no need to edit configuration files or set things up for automatic detection/connection, then as an alternative to the above, the following has worked for this user (kwtm). Make sure "usb-network-modules" and "rootsh" are installed (via Applications Manager or equivalent).
- connect the N900 to the Other Computer via USB cable, and select "PC Suite mode" when asked.
-
open a terminal on the N900 and type:
sudo gainroot ifconfig usb0 192.168.2.15 ifconfig usb0 up
-
on your Other Computer, open a terminal and type the following for Ubuntu; modify appropriately for other computers:
sudo ifconfig usb0 192.168.2.14 sudo ifconfig usb0 up ssh -l user -v 192.168.2.15
That is all. You should now be connected via terminal to your N900. Whatever you type on your Other Computer, it will be as if you are typing on the N900 itself in a terminal. Non-Ubuntu Linux computers might not use the "sudo" command, so you will have to gain root another way. One possibility that will probably work is to use the "su" command first, allowing you to omit "sudo" on the above commands:
su # (And then enter the root password when asked) ifconfig usb0 192.168.2.14 ifconfig usb0 up exit # (This stops the root mode) ssh -l user -v 192.168.2.15
[I have no idea what to do for Windows computers. Perhaps someone can post the equivalent commands?]
[edit] Using USB networking for Maemo applications
By default, standard network applications works well with USB networking, while Maemo-specific applications do not.
Install libicd-network-dummy
from Fremantle Nokia-binaries repository or better libicd-network-null
from extras-devel, and when USB networking is up pickup "Dummy network" from the connection manager. One way to do it:
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 the following commands in xterm:
gconftool-2 -s -t string /system/osso/connectivity/IAP/DUMMY/type DUMMY gconftool-2 -s -t string /system/osso/connectivity/IAP/DUMMY/name "Dummy network"
and maybe
gconftool-2 -s -t string /system/osso/connectivity/IAP/DUMMY/autoconnect false
If connect automatically is used with "Any Connection", the phone will also use Dummy Network, which is not good. To prevent this, you need to run the following command :
gconftool -s /system/osso/connectivity/network_type/auto_connect -t list --list-type string "[WLAN_INFRA,GPRS]"
Keep in mind the above command will get overwritten if you change the value via UI. (If you choose any / wifi / gprs, and you will want to go back to "wifi or gprs" you will have to do the CLI thing again.
Then restart icd2:
killall icd2
or reboot the device.
- This page was last modified on 4 August 2014, at 14:33.
- This page has been accessed 339,549 times.