Surfing with the Greenphone

According to qtopia forum and trolltech labs blog, here a short tutorial to get your greenphone connected to the internet over an USB connection.

On the greenphone SDK run the following script as root.
(You might have to adjust the network interfaces, in this sample the host PC is connected at eth0 and the device with eth4.)

	#!/bin/sh

	# the external interface
	EXTIF=eth0
	
	# the Greenphone interface
	GREENIF=eth4
	
	# enable forwarding
	echo "1" > /proc/sys/net/ipv4/ip_forward
	
	# forward packets from the outside if they belong to an existing connection
	iptables -A FORWARD -i $EXTIF -o $GREENIF -m state --state ESTABLISHED,RELATED -j ACCEPT
	
	# forward everything from the Greenphone
	iptables -A FORWARD -i $GREENIF -o $EXTIF -j ACCEPT
	
	# Masquerade all packages coming from the Greenphone
	iptables -t nat -A POSTROUTING -o $EXTIF -j MASQUERADE

Now, connect to the Greenphone (telnet gp) and run this commands:

	ifconfig eth0 netmask 255.255.255.0
	route add default gw 10.10.10.21

Finally you might want wo set a DNS. You can do this by just copy the file

	/etc/resolv.conf

from the Greenphone SDK to your Greenphone (in the same directory).