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
(Add static mac and networkmanager instructions)
Line 1: Line 1:
Here is script that is tested on Fedora 15/16 and OpenSUSE 12.1 with Nokia N900/N950/N9.
+
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, NetworkManager will try to configure the interface using DHCP. 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
 
Connect the device with usb cable to your host pc and run following commands

Revision as of 09:52, 28 September 2012

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, NetworkManager will try to configure the interface using DHCP. 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

Personal tools