Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

Tethering via WiFi - Troubleshooting

OP divinehawk

10th November 2008, 04:18 AM   |  #1  
OP Junior Member
Thanks Meter: 1
 
9 posts
Join Date:Joined: Nov 2008
FYI,

I've been able to successfully use iptables to configure ip masquerading (NAT). With it, I am tethered over WiFi without using tetherbot (which still works as a backup). Hopefully someone else can package this to be more useful.
Update: See posts #13 and #15 on how to use Ad-hoc mode.
  • Root required
  • Existing wifi network required (and configured)

1> Disable WiFi through the UI. Then turn on Wifi manually using the following commands as root. Normally the phone data interface and WiFi can't be turned on at the same time. (Can this be done through the android gui somehow?)

Quote:

insmod /system/lib/modules/wlan.ko

wlan_loader -f /system/etc/wifi/Fw1251r1c.bin -e /proc/calibration -i /system/etc/wifi/tiwlan.ini

cd /data/local/tmp
wpa_supplicant -f -Dtiwlan0 -itiwlan0 -c/data/misc/wifi/wpa_supplicant.conf &

sleep 5
ifconfig tiwlan0 192.168.2.30 netmask 255.255.255.0
ifconfig tiwlan0 up

Note that I had to use a static ip since dhcp will typically add in a gateway.

2> Enable and configure ip forwarding

Quote:

iptables -I FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -I FORWARD -s 192.168.2.0/24 -j ACCEPT
iptables -P FORWARD DROP

iptables -t nat -I POSTROUTING -s 192.168.2.0/24 -j MASQUERADE

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

3> On your computers, set your default gateway to your phone's WiFi IP address (192.168.2.30 - in my case). Also set your DNS to a real DNS server.

Attached is the iptables binary, compiled with the android sdk.
Attached Files
File Type: zip iptables.zip - [Click for QR Code] (54.8 KB, 2157 views)
Last edited by divinehawk; 10th November 2008 at 07:19 PM. Reason: add note
The Following User Says Thank You to divinehawk For This Useful Post: [ View ]
10th November 2008, 04:20 AM   |  #2  
Senior Member
Thanks Meter: 0
 
303 posts
Join Date:Joined: Oct 2008
just curious as to why you would want the "tethering" this way. isnt it most likely that any wifi your phone can connect to your computer most probably can too? just curious?
10th November 2008, 04:31 AM   |  #3  
Retired Moderator
Thanks Meter: 10
 
1,271 posts
Join Date:Joined: Mar 2008
More
Quote:
Originally Posted by hondamx525

just curious as to why you would want the "tethering" this way. isnt it most likely that any wifi your phone can connect to your computer most probably can too? just curious?

This is just progress on tethering. The proxy method is a horrible way of tethering. iptables is the correct way if done correctly. His developments while useless to most are still good because it is progressive. And he can get hotspots now LOL
10th November 2008, 04:42 AM   |  #4  
OP Junior Member
Thanks Meter: 1
 
9 posts
Join Date:Joined: Nov 2008
Quote:
Originally Posted by hondamx525

just curious as to why you would want the "tethering" this way. isnt it most likely that any wifi your phone can connect to your computer most probably can too? just curious?

The above configuration uses your existing wifi settings (I haven't tried ad-hoc mode).

USB networking would be better, or even bluetooth. But I'm not sure this is possible.
10th November 2008, 04:44 AM   |  #5  
Senior Member
Flag Wilmington!
Thanks Meter: 36
 
1,388 posts
Join Date:Joined: Mar 2007
More
wmwifi router is such an amasing program for windows mobile. Not only does it create an access point with encryption, it also has a dhcp server set up, so multiple computers can share the 3G access. If something like this comes to the android, it will be BADASS!
10th November 2008, 04:59 AM   |  #6  
Junior Member
Thanks Meter: 5
 
29 posts
Join Date:Joined: Nov 2008
divinehawk, do you really need an access point? have you tried this using an ad-hoc network? (I am not sure if the G1's WiFi supports ad-hoc networks)
10th November 2008, 05:22 AM   |  #7  
OP Junior Member
Thanks Meter: 1
 
9 posts
Join Date:Joined: Nov 2008
Quote:
Originally Posted by scootley

divinehawk, do you really need an access point? have you tried this using an ad-hoc network? (I am not sure if the G1's WiFi supports ad-hoc networks)

Doesn't look like the gui will let you do ad-hoc. Maybe if a modified wpa_supplicant.conf. I'll report back if I have success.

Ideal mode would be for the phone to *act* as an access point. But that usually requires driver support.
10th November 2008, 07:50 AM   |  #8  
Member
Thanks Meter: 33
 
44 posts
Join Date:Joined: Nov 2008
Quote:
Originally Posted by divinehawk

USB networking would be better, or even bluetooth. But I'm not sure this is possible.

Code:
# adb --help
[...]
adb forward <local> <remote> - forward socket connections
                                 forward specs are one of: 
                                   tcp:<port>
[...]
...but I guess everybody already knew that. I suppose that doing it via iptables under this approach, you are still limited to specific ports.
Last edited by alansj; 10th November 2008 at 07:58 AM.
10th November 2008, 07:52 AM   |  #9  
Retired Moderator
Thanks Meter: 10
 
1,271 posts
Join Date:Joined: Mar 2008
More
Quote:
Originally Posted by alansj

Code:
# adb --help
[...]
adb forward <local> <remote> - forward socket connections
                                 forward specs are one of: 
                                   tcp:<port>
[...]

that only works if you want to make a proxy... I think he is trying to make it a true internet sharing app similar to that of the wing and other WM devices
10th November 2008, 08:40 AM   |  #10  
Member
Thanks Meter: 33
 
44 posts
Join Date:Joined: Nov 2008
How about something similar to PdaNet?

http://www.theiphoneblog.com/2008/10...r-with-pdanet/

It's interesting that it works by having you set up an ad-hoc wireless network from your computer and then connecting to that from the iPhone. Maybe that's essentially what scootley was suggesting above.

PdaNet .deb here:
http://apt.modmyi.com/2debs/pdanet1.40.deb

Post Reply Subscribe to Thread

Tags
ad-hoc, tether
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes