Surfing on the net with greenphone using the usb connection

From GreenphoneWiki

Jump to: navigation, search

[edit] Connecting to internet using the usb

It's simple, only run this script on your host computer (before you do that, make sure the device names are right):

#!/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 run this on your greenphone in a shell:

ifconfig eth0 netmask 255.255.255.0
route add default gw 10.10.10.21

Then you should be able to have net on your greenphone without problems..


[edit] Alternative Way

The above did not work for me. I poked around the forums for a while and could not come with an answer. I was using the 4.2.4 SDK and it was complaining about he state flag being set. So after spending some time on irc.freenode.net #qtopia I found some help. Babel0 ended up helping me figure out the problem. So below is my solution to get the greenphone working.

I was using windows XP, with VMPlayer 2.0.2. I was using VMware Workstation but was having a lot of problems with USB connecting. VMplayer ended up working.


Steps:

1. Boot up SDK

2. Boot up Greenphone

3. Plug Greenphone in USB.

4. In the SDK open up a terminal and type (this will make you the root user):

sudo -s

5. In the terminal now type:

echo 1 > /proc/sys/net/ipv4/ip_forward

6. In the terminal now type:

iptables -t nat -A POSTROUTING -s 10.10.10.0/24 -o eth0 -j MASQUERADE

7. Now in the terminal type:

telnet 10.10.10.20

Your shell should now read something like: [root@greenphone /]

8. You are now connected to the green phone, if it didn't connect you need to make sure you USB is setup correctly. Now you want to type the following:

route add default gw 10.10.10.21

9. Now we need to get the DNS server info from the windows machine. So open up a terminal in windows (run->cmd). Then type:

ipconfig -all

This will give all the information (in the DNS server section). On my machine it is connected to a router, so it's IP address is: 192.168.0.1

10. Now back on the greenphone terminal we want to type:

vi /etc/resolv.conf

11. That will open the vi editor then we want to type:

nameserver IP_ADDRESS_OF_WINDOWS_MACHINE_HERE

We type in the IP address of the windows machine. In my case it was 192.168.0.1

12. Now press:

esc

13. Now hold shift and press ; to get a colon. Then type:

x

and hit enter. It should save it.

Now you can type:

ping google.com

You should be able to get a some type of feedback, else something went wrong and you need to trouble shoot.


Things to note:

  • Make sure that NAT service is running on your windows machine. I had skype running and for some reason was preventing it from starting.
  • Your VMplayer needs to be running in NAT mode, not bridged or Host-only.
Personal tools