Internet On Your Neo FreeRunner (USB Networking)

From GeoSharing

(Difference between revisions)
Jump to: navigation, search
(Created page with "TODO")
 
(26 intermediate revisions not shown)
Line 1: Line 1:
-
TODO
+
[[File:Internet-on-your-neo-1.png|thumb|400px|Internet on FreeRunner via USB]]
 +
It is always simpler to have a direct internet access from your Neo FreeRunner when you want to install or develop something on your phone. We will take advantage of the internet connection of the PC and the USB connection between the PC and the Neo FreeRunner.
 +
 
 +
For this example, we are working with Ubuntu 10.10 on a laptop.
 +
 
 +
== Connect the Openmoko ==
 +
The first thing to do is to create an alias for the IP address of the Neo FreeRunner.
 +
* Edit the file /etc/hosts by adding the line:
 +
192.168.0.202 openmoko
 +
Note : The alias "openmoko" can be replaced by any other name at the will of the user.
 +
 
 +
Then, we must set up the connection.
 +
 
 +
=== With the network manager ===
 +
The easiest way to set up the connection with the Openmoko is to create a new connection (called Openmoko here) for the wired networks. For this connection, you choose a static (manual) IP address '''192.168.0.200'''.
 +
 
 +
[[File:Screenshot-Editing Openmoko.png|350px]]
 +
 
 +
=== Without the network manager ===
 +
* Edit the file '''/etc/network/interfaces''' by adding the following lines:
 +
# The Openmoko network interface
 +
auto eth1
 +
iface eth1 inet static
 +
address 192.168.0.200
 +
netmask 255.255.255.0
 +
* Restart the network service by running the following command:
 +
$ /etc/init.d/networking restart
 +
* Now, you can connect to the openmoko as root via ssh:
 +
$ ssh root@openmoko
 +
root@om-gta02 ~ #
 +
 
 +
== Configuration IP tables ==
 +
 
 +
In order to make the computer connected to the openmoko forward packets comming from the interface eth1, it is necessary to enable IP forwarding which is deactivated by default in Ubuntu. It is therefore requiered to issue the following commands with administrator (sudo) priviledges :
 +
* First step:
 +
$ gedit /etc/sysctl.conf
 +
* Second step: look for the following line in this file:
 +
#net.ipv4.conf.default.forwarding=1
 +
and uncomment it (remove the # caracter if not already done).
 +
* Third step: This change will be effective at the next reboot, or use the following command to make it effective directly:
 +
sudo sysctl -w net.ipv4.conf.default.forwarding = 1
 +
* Fourth step: it is now time to configure the iptables in order to let the packets go through the gateway (computer connected to the Openmoko):
 +
$ gedit /etc/rc.local
 +
* Fifth step: add these lines:
 +
/sbin/iptables -P FORWARD ACCEPT
 +
/sbin/iptables --table nat -A POSTROUTING -s 192.168.0.202/32 -o iface -j MASQUERADE
 +
where '''iface''' corresponds to the interface connected to the internet (wlan0, eth0, eth1, ...). These changes also take effect only after a reboot. To make them effective directly, type the same command in a terminal by replacing '''/sbin/''' by '''sudo'''.
 +
 
 +
== Sources ==
 +
* http://wiki.openmoko.org/wiki/USB_Networking
 +
* http://ubuntuforums.org/showthread.php?t=713874

Latest revision as of 12:03, 13 June 2011

Internet on FreeRunner via USB

It is always simpler to have a direct internet access from your Neo FreeRunner when you want to install or develop something on your phone. We will take advantage of the internet connection of the PC and the USB connection between the PC and the Neo FreeRunner.

For this example, we are working with Ubuntu 10.10 on a laptop.

Contents

Connect the Openmoko

The first thing to do is to create an alias for the IP address of the Neo FreeRunner.

192.168.0.202 openmoko

Note : The alias "openmoko" can be replaced by any other name at the will of the user.

Then, we must set up the connection.

With the network manager

The easiest way to set up the connection with the Openmoko is to create a new connection (called Openmoko here) for the wired networks. For this connection, you choose a static (manual) IP address 192.168.0.200.

Screenshot-Editing Openmoko.png

Without the network manager

# The Openmoko network interface 
auto eth1
iface eth1 inet static 
address 192.168.0.200 
netmask 255.255.255.0
$ /etc/init.d/networking restart
$ ssh root@openmoko
root@om-gta02 ~ #

Configuration IP tables

In order to make the computer connected to the openmoko forward packets comming from the interface eth1, it is necessary to enable IP forwarding which is deactivated by default in Ubuntu. It is therefore requiered to issue the following commands with administrator (sudo) priviledges :

$ gedit /etc/sysctl.conf
#net.ipv4.conf.default.forwarding=1

and uncomment it (remove the # caracter if not already done).

sudo sysctl -w net.ipv4.conf.default.forwarding = 1
$ gedit /etc/rc.local
/sbin/iptables -P FORWARD ACCEPT 
/sbin/iptables --table nat -A POSTROUTING -s 192.168.0.202/32 -o iface -j MASQUERADE

where iface corresponds to the interface connected to the internet (wlan0, eth0, eth1, ...). These changes also take effect only after a reboot. To make them effective directly, type the same command in a terminal by replacing /sbin/ by sudo.

Sources

Personal tools
Namespaces
Variants
Actions
Navigation
GeoSharing
Misc
Toolbox