The Mer Wiki now uses your Mer user account and password (create account on https://bugs.merproject.org/)
Nemo/USBNetworking
(explanation of udev rule for the interface name) |
(→Network interfaces names: fmt) |
||
Line 60: | Line 60: | ||
After adding a new connection in network manager, you may find it's called 'eth2'. To rename it in '''/etc/udev/rules.d/70-persistent-net.rules''' on host machine, you can optionally edit the 'eth2' name: | After adding a new connection in network manager, you may find it's called 'eth2'. To rename it in '''/etc/udev/rules.d/70-persistent-net.rules''' on host machine, you can optionally edit the 'eth2' name: | ||
− | + | <div style="font-family:monospace;padding-left:40px;"> | |
− | + | <nowiki>#</nowiki> This file maintains persistent names for network interfaces.<br> | |
− | + | <nowiki>#</nowiki> See udev(7) for syntax.<br> | |
− | + | <nowiki>#</nowiki><br> | |
− | + | <nowiki>#</nowiki> Entries are automatically added by the 75-persistent-net-generator.rules<br> | |
− | + | <nowiki>#</nowiki> file; however you are also free to add your own entries.<br> | |
− | + | <br> | |
− | + | <nowiki>#</nowiki> PCI device 0x11ab:0x4363 (sky2)<br> | |
− | + | SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:17:42:c1:88:16", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"<br> | |
− | + | <br> | |
− | + | <nowiki>#</nowiki> PCI device 0x8086:0x4229 (iwlagn)<br> | |
− | + | SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:1f:3b:4c:81:0d", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan0"<br> | |
− | + | <br> | |
− | + | <nowiki>#</nowiki> USB device 0x1286:0xf003 (usb)<br> | |
− | + | SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="80:00:60:0f:e8:00", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"<br> | |
− | + | <br> | |
− | + | <nowiki>#</nowiki> USB device 0x0525:0xa4a2 (usb)<br> | |
+ | SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:01:10:22:03:30", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"<br> | ||
+ | </div> | ||
Replace last line with: | Replace last line with: | ||
− | + | <div style="font-family:monospace;padding-left:40px;"> | |
− | + | SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:01:10:22:03:30", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="nemo" | |
+ | </div> |
Revision as of 04:18, 30 May 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:
- Open "Network Settings"
- Select the right "Wired" connection (the one with "Hardware Address" of 00:11:22:33:44:55).
- Go to "Options..."
- Open the "IPv4 Settings" tab.
- Change the "Method" from "Automatic (DHCP)" to "Manual".
- Click "Add" on the "Addresses" section.
- 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>
Network interfaces names
After adding a new connection in network manager, you may find it's called 'eth2'. To rename it in /etc/udev/rules.d/70-persistent-net.rules on host machine, you can optionally edit the 'eth2' name:
# This file maintains persistent names for network interfaces.
# See udev(7) for syntax.
#
# Entries are automatically added by the 75-persistent-net-generator.rules
# file; however you are also free to add your own entries.
# PCI device 0x11ab:0x4363 (sky2)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:17:42:c1:88:16", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x8086:0x4229 (iwlagn)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:1f:3b:4c:81:0d", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan0"
# USB device 0x1286:0xf003 (usb)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="80:00:60:0f:e8:00", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
# USB device 0x0525:0xa4a2 (usb)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:01:10:22:03:30", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"
Replace last line with:
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:01:10:22:03:30", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="nemo"