[G1 Android Development] parrothd:
Tether via wifi setup 1.1 (Can someone make this a sticky!?!?)

This wifi is not an Encrypted connection, please take necesassry step to protect your data (ie: https)

Speed are fast, speed tests give me 900kbps down / 200 kbps up on 3G

Requirements:

G1 with Root

JFv1.31 Image (either AD1 or RC30)

tether-1.6.tar Fixed error in 1.5

tether-1.5.tar [/URL] Has an error in dnsmasq.conf

tether-1.2.ZIP[/URL]

tether-1.1.ZIP[/URL]

Windows XP with wifi card

*******************************************

New Way:

1. Connect phone to computer via USB cable.

2. On the phone, select Mount on the USB connect Notification window.

3. Download the latest tether package and save it to the sdcard(G1 Storage).

4. DISCONNECT THE USB CABLE!!!

5. Open the Terminal Emulator application on the G1

6. Type:

su and press enter (Select Yes to the warning about superuser access)

7. type:

tar xf /sdcard/tether-1.6.tar and press enter

If there are no errors you can proceed..

8. Make sure the G1 wifi is disabled. (settings/wireless controls/Uncheck wi-fi enabled)

type:

tether start ( to start tethering)

tether stop ( to stop tethering)

9. Connect to G1 ad-hoc access point – Ensure Ad-hoc networks is enabled on your windows box .

On WidowsXP (start/settings/network connections/wireless network connection/properties/wireless networks/advanced/

(make sure Any Available Network is enabled)

Then select view wireless networks, you should see an ad-hoc network access point called g1, please note any can connect to this network and surf the internet. You should have dnsmasq assign your laptop a static IP address and then use IP tables to block unwanted access. This is not in this document! Also the G1 gets hot, no worries.

10. You must always be root to start/stop tethering. Open the terminal application, type su, then tether stop/start.

ERRORS:

************************

insmod: init_module '/system/lib/modules/wlan.ko' failed (Operation Not Permitted)

fatal error opening "/sys/android_power/aquire_partial_wake_lock"

error : SI0CSIFADOR (permission denied)

error: SI0CSIFFLAGS (permission denied)

Could not open socket to kernal: Operation not permitted (X5)

/data/local/bin/tether: cannot create /proc/sys/net/ipw4/ip_forward: permission denied

dnsmasq: cannot open or create lease file /data/local/dnsmasq.leases: Permission denied.

error: SIOCSIFFLAGS (Cannot assign requested address)

#

***********

Either you forgot to uncheck enable wifi on the G1 or you're not root, (type su(enter) then tether start(enter))..

*********************************

Old - Manual Setup - Reference

1. Download tether-1.1.ZIP file

2. Create a directory c:\tether on your workstation

4. Unzip tether-1.1.ZIP file to c:\tether directory (5 Files)

3. Use adb utility to copy files from c:\tether to phone (This is done via a windows command window Start/run/cmd/)

(I copied the adb.exe & AdbWinApi.dll into my c:\windows\system32\ directory, this allows you to start adb.exe from any folder.)

C:\>cd c:\tether

Connect your phone via the USB cable.

************************

If you see this error:

C:\tether>adb push tether /data/local/bin/tether

'adb' is not recognized as an internal or external command, operable program or batch file.

You need to use the complete path to adb.exe executeable for all commands!!

C:\tether>C:\folder-where-adb.exe-is-located\adb.exe push tether /data/local/bin/tether

***********************

C:\tether>adb shell

#mkdir /data/local/bin/ (This directory may exists, if it does ignore the error, this needs to be a directory NOT a file!)

#exit

C:\tether>adb push tether /data/local/bin/tether

C:\tether>adb push iptables /data/local/bin/iptables

C:\tether>adb push dnsmasq /data/local/bin/dnsmasq

C:\tether>adb push tiwlan.ini /data/local/tiwlan.ini

C:\tether>adb push dnsmasq.conf /data/local/dnsmasq.conf

4. Change file permissions

C:\tether>adb shell

# chmod 755 /data/local/bin/tether

# chmod 755 /data/local/bin/dnsmasq

# chmod 755 /data/local/bin/iptables

# chmod 755 /data/local/dnsmasq.conf

# chmod 755 /data/local/ tiwlan.ini

5. Make sure the G1 wifi is disabled. (settings/wireless controls/Uncheck wi-fi enabled)

6. Start and stop tether

#tether start

7. Connect to G1 ad-hoc access point – Ensure Ad-hoc networks is enabled on your windows box .

On WidowsXP (start/settings/network connections/wireless network connection/properties/wireless networks/advanced/

(make sure Any Available Network is enabled)

Then select view wireless networks, you should see an ad-hoc network access point called g1, please note any can connect to this network and surf the internet. You should have dnsmasq assign your laptop a static IP address and then use IP tables to block unwanted access. This is not in this document! Also the G1 gets hot, no worries.

#tether stop (stop tethering)

You can enable and disable the tethering after install directly from the phone without being connected to the PC. (MUST HAVE ROOT, OR JF's). Just go into Terminal Emulator..... and simply type the following....

TO START:

$ su (Click yes when it says a program is asking from root)

# tether start

TO STOP:

$ su (Click yes when it says a program is asking from root)

# tether stop

*********************

To restrict who can connect to your wifi network.

You need to get your MAC address of the wifi card, (start/run/cmd/ipconfig /all)

Ethernet adapter Wireless Network Connection:

Connection-specific DNS Suffix . :

Description . . . . . . . . . . . : Intel(R) PRO/Wireless 2915ABG Netw

k Connection

Physical Address. . . . . . . . . : 00-13-CE-B7-A8-0E

Dhcp Enabled. . . . . . . . . . . : Yes

Autoconfiguration Enabled . . . . : Yes

IP Address. . . . . . . . . . . . : 192.168.2.30

Subnet Mask . . . . . . . . . . . : 255.255.255.0

Default Gateway . . . . . . . . . : 192.168.2.1

DHCP Server . . . . . . . . . . . : 192.168.2.1

DNS Servers . . . . . . . . . . . : 192.168.2.1

Lease Obtained. . . . . . . . . . : Thursday, January 29, 2009 11:23

Lease Expires . . . . . . . . . . : Thursday, January 29, 2009 11:25

Then on the phone, copy the dnsmasq.conf-sure to dnsmasq.conf then either use vi or echo to insert that MAC address and unique ip for each MAC address. Everyone that isn't staticly assigned will be give 192.168.2.254 which is dropped via iptables.

su

cp /data/local/dnsmasq.conf dnsmasq.conf-old

cp /data/local/dnsmasq.conf-secure dnsmasq.conf

(replace XX:XX:XX:XX:XX:XX with your MAC Address in that format)

(for each MAC address/host you have use a unique IP address starting at 192.168.2.40)

echo dhcp-host=XX:XX:XX:XX:XX:XX,192.168.2.40 >> /data/local/dnsmasq.conf

echo dhcp-host=XX:XX:XX:XX:XX:XX,192.168.2.41 >> /data/local/dnsmasq.conf

echo dhcp-host=XX:XX:XX:XX:XX:XX,192.168.2.43 >> /data/local/dnsmasq.conf

tether start

**********************

Someone write a gui app would be greatly appriecatied!

I have some ideas, but don't know java!

Also, I've made some suggestions on how to better secure the connection. Basically:

Start the wifi

Have IPTABLES drop all traffic

Have the user connect to the access point

Have the user click a allow/deny box

The loads the dnsmasq.leases file, which contains the ip/hostname

The user selects which ip/hostname they want to allow access

flush iptables

create new IPTABLE rules with the ip/hostnames allowed.