Meego Wiki
Views

ARM/N900/Tips and Tricks/N900 USB Networking

From MeeGo wiki
(Difference between revisions)
Jump to: navigation, search
(Automatic configuration with Ubuntu 9.10)
Line 71: Line 71:
  ifconfig n900
  ifconfig n900
-
== Automatic configuration with Ubuntu 9.10 ==
+
== Automatic configuration with Ubuntu 9.10 and 10.04 ==
Note: these instructions should be fixed/improved:
Note: these instructions should be fixed/improved:
-
Create the file in /etc/udev/rules.d/99-nokia-n900.rules and put in the following lines: <b>Notice! Ethernet module has changed from cdc_ether to cdc_eem.</b>
+
* Create the file in /etc/udev/rules.d/99-nokia-n900.rules and put in the following lines:
 +
<b>Notice! Ethernet module has changed from cdc_ether to cdc_eem.</b>
 +
 
  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_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"
  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:
+
* Edit /etc/network/interfaces and add:
<pre>
<pre>
auto n900
auto n900
Line 90: Line 92:
</pre>
</pre>
-
finally you have to fix /etc/init/network-interface.conf, change the line:
+
* Fix /etc/init/network-interface.conf (this is not required for Ubuntu 10.04), change the line:
  stop on net-device-removed INTERFACE=$INTERFACE
  stop on net-device-removed INTERFACE=$INTERFACE
with:
with:
Line 96: Line 98:
(Note the difference: net-device-remove'''d''')
(Note the difference: net-device-remove'''d''')
-
 
+
* Reload udev rules with:
-
You have to reload udev rules with:
+
  udevadm control --reload-rules
  udevadm control --reload-rules
-
Now put your usb cable in the pc and in the n900.
+
* Restart NetworkManager so it re-reads the interfaces file (otherwise it'll clobber your network device):
 +
 
 +
<pre>sudo /etc/init.d/network-manager restart</pre>
 +
 
 +
or
 +
 
 +
<pre>sudo service network-manager restart</pre>
 +
 
 +
* 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:
If you are unable to autoconnect through the networking applet, you may need to manually bring up the interface:
Line 106: Line 115:
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 n900.
+
* 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.
+
* The N900 should be able to use the pc internet connection immediately.

Revision as of 20:41, 3 December 2010

Contents

Using USB networking

(This is based largely on the [N900 USB Networking] page of wiki.maemo.org)

This page describes how to enable Networking on the N900 via USB. The first part describes how to configure the Nokia 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.

The default configuration on MeeGo for N900 has the USB network interface set up. 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. You will need to set up your host for USB networking as well.

After this is set up, you can ssh into your MeeGo installation:

 ssh root@192.168.2.15 

Password is 'meego'. The 'scp' and 'ssh' tools should be available from within the device and you can transfer files in and out with them. You should also be able to run 'yum install' now, to install packages.

Setting up default route and DNS settings

You will need to set up a default route to your host IP:

route add default gw 192.168.2.14

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

Or put in your own ISP nameservers.

Host USB Network Configuration

The Host configuration is detailed in the Maemo 4.x USB Networking wiki. Please refer to it for details. Notice! Ethernet module has changed from cdc_ether to cdc_eem.

Host configuration on Debian Lenny

Notice! Ethernet module has changed from cdc_ether to cdc_eem.

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"

Note that the udev configuration above may not work in Debian squeeze. This rule renames either the usb network interface (usb0) or the usb phone net interface (usbpn0) to interface called n900. Since the two rules above are identical, the choice is made seemingly at random. Making the rules more accurate by adding a DEVPATH key helps:

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. You can use

udevadm monitor --kernel

while plugging in the N900 to see what is the correct path.

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

Automatic configuration with Ubuntu 9.10 and 10.04

Note: these instructions should be fixed/improved:

  • Create the file in /etc/udev/rules.d/99-nokia-n900.rules and put in the following lines:

Notice! Ethernet module has changed from cdc_ether to cdc_eem.

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"
  • 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
  • Fix /etc/init/network-interface.conf (this is not required for Ubuntu 10.04), change the line:
stop on net-device-removed INTERFACE=$INTERFACE

with:

stop on net-device-remove INTERFACE=$INTERFACE

(Note the difference: net-device-removed)

  • Reload udev rules with:
udevadm control --reload-rules
  • 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.
Personal tools