The Mer Wiki now uses your Mer user account and password (create account on https://bugs.merproject.org/)


Nemo/USBNetworking

From Mer Wiki
< Nemo(Difference between revisions)
Jump to: navigation, search
(remove extra spaces.)
Line 52: Line 52:
 
Add a section that looks a bit like this:
 
Add a section that looks a bit like this:
  
  [network]
+
[network]
  ip = <ip of your fancy>
+
ip = <ip of your fancy>
  gateway = <gateway you like>
+
gateway = <gateway you like>

Revision as of 22:20, 28 January 2013

These instructions are tested on Nokia N900/N950/N9 and a host machine that uses NetworkManager (with Gnome 3 interface, but other environments should have similar tools).

To get a stable MAC address, run this as root on the device:

echo options g_ether host_addr=00:11:22:33:44:55 > /etc/modprobe.d/g_ether.conf

Once you plug in the usb cable, what happens on the host side is that NetworkManager will try to configure the interface using DHCP (if the host uses NetworkManager, that is). There's no DHCP available, so the connection will fail. You should tell NetworkManager to use manual configuration:

  1. Open "Network Settings"
  2. Select the right "Wired" connection (the one with "Hardware Address" of 00:11:22:33:44:55).
  3. Go to "Options..."
  4. Open the "IPv4 Settings" tab.
  5. Change the "Method" from "Automatic (DHCP)" to "Manual".
  6. Click "Add" on the "Addresses" section.
  7. Enter "192.168.2.14" as the address and "255.255.255.0" as the netmask. The gateway can be left empty (which means that your host machine won't try to route its own internet data through the device).

Now you can use ssh to connect to the device from the host machine. For making life a bit easier, you can add this snippet to ~/.ssh/config:

Host nemo
        HostName 192.168.2.15
        User nemo

This allows you to just run "ssh nemo" to log in to the device as user nemo.

If you want to set up a full internet connection from the device through the host machine, you'll need to make the host machine a router and set up the name server and routing parameters on the device.

Connect the device with usb cable to your host pc and run following commands

sudo /sbin/ifconfig usb0 up 192.168.2.14
sudo /usr/sbin/iptables -A POSTROUTING -t nat -s 192.168.2.15/32 -j MASQUERADE
sudo /usr/sbin/iptables -P FORWARD ACCEPT
echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward
# Rest of these are here just to print something that is needed for the device to get routing work.
NAME_SERVER=`cat /etc/resolv.conf | grep "nameserver" | head -1`
echo "echo $NAME_SERVER > /etc/resolv.conf"
echo "route add default gw 192.168.2.14"

Note: for ubuntu users you might find iptables under /sbin

By default device clock starts on year 1970. If you do not modify this, you might get error on zypper:

Error code: Unrecognized error
Error message: SSL certificate problem, verify that the CA cert is OK.

What you need to do is setup the clock straight, e.g. issue this command at host PC:

export DATE=$(date) ; ssh root@192.168.2.15 date -s \"$DATE\"

To change the ip and or add a default gateway this can be achieved by editing /etc/usb-moded/usb-moded.ini

Add a section that looks a bit like this:

[network]
ip = <ip of your fancy>
gateway = <gateway you like>
Personal tools