Subnavigation

Surfing with the Greenphone

To test some Software on the Greenphone, it might be handy to connect to the internet using the USB cable. To achieve this, connect the Greenphone to your machine and run the following script on the Greenphone SDK (as root user):

#!/bin/sh

# the external interface
EXTIF=eth0
# the Greenphone interface
GREENIF=eth1

# 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

Then, open a shell on your Greenphone (by running gph -console, for example) and run the following commands:

ifconfig eth0 netmask 255.255.255.0
route add default gw 10.10.10.21

Voila - now you should be able to connect to any host on the internet.


Blog Topics:

Comments