Go Back   PreCentral Forums > webOS Software and Chat > web OS Development

Reply
 
LinkBack Thread Tools Display Modes
Old 07/06/2009, 03:46 PM   #1 (permalink)
Member
 
Join Date: Jul 2009
Posts: 33
Thanks: 0
Thanked 26 Times in 7 Posts
Default Tethered Pre without any apps, SSH, or scripts

hello all,

I'm new here but I love the site. I posted this on the "possible tether work-around" thread but I wanted to make sure everybody got a chance to see it, and that thread is pretty long now. I used to have my 800w hacked for tethering and when I found the options of tethering available to the pre (so far) they just didn't quite cut it. I didn't want to have to ssh to my phone and use a socks proxy or run an app to shut down pmconnectionmanager every time I wanted to connect, so I modified the connectionmanager program to stop change ip_forward to 0. Here are the steps:

Prerequisites:
rooted pre
ssh access (dropbear or openssh)
ability to use VI or editor of your choice

optional prereq:
usbnet setup and dhcp setup

1) ssh to the phone, sudo to root and go to /usr/bin

2) cp PmConnectionManager PmConnectionManager.orig just in case you mess something up

3) stop PmConnectionManager

4) vi PmConnectionManager and do a find for "forward" (with vi you use / then the string you are looking for)

5) the third "forward" you find should say "Disabling IP Forwarding^@0^@^@^@"

6) change the 0 to a 1, save and quit

7) start PmConnectionManager

I did this and kept checking my /proc/sys/net/ipv4/ip_forward file and it is now staying at 1. with this and the correct IPtable rules I can just connect my phone via usb or bluetooth and get right on the net without ssh or anything else. I rebooted the phone many times and it has stuck also the iptable rull I'm using looks something like this:

iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE

I added that iptable rule to my dropbear upstart script so it gets added on startup. If you wanted to make a separate upstart you could, but I was too lazy. I'm using webOS 1.0.4 and it's working great. Let me know if you have any questions. thanks.
zeropoint46 is offline   Reply With Quote
Old 07/06/2009, 04:02 PM   #2 (permalink)
Member
 
jack87's Avatar
 
Join Date: Jun 2009
Location: Salt Lake City, Ut
Posts: 1,161
Thanks: 69
Thanked 167 Times in 120 Posts
Default

very cool find. now when not tethering tell us if you run into any issues. i hope not
jack87 is offline   Reply With Quote
Old 07/06/2009, 04:03 PM   #3 (permalink)
Member
 
Join Date: Jul 2009
Posts: 33
Thanks: 0
Thanked 26 Times in 7 Posts
Default

been running like this for 3 days, no issues whatsoever.
zeropoint46 is offline   Reply With Quote
Old 07/06/2009, 04:04 PM   #4 (permalink)
Tazmorator
 
berdinkerdickle's Avatar
 
Join Date: Dec 2005
Location: P|C when the light below is green. Otherwise; I could be just about anywhere.
Posts: 8,295
Thanks: 1,701
Thanked 1,241 Times in 922 Posts
Default

Thanks!

and Welcome to PreC
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Just call me Berd.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
berdinkerdickle is offline   Reply With Quote
Old 07/06/2009, 04:05 PM   #5 (permalink)
Member
 
Join Date: May 2009
Posts: 452
Thanks: 27
Thanked 252 Times in 51 Posts
Default

Although I'm quite adept at following instructions, programming and *nix are not my bailiwick. So... how do you stop the PmConnectionManager specifically? Conversely, how do you start it again? You mentioned that you can now just connect via Bluetooth- how, exactly? And the last question: How do you add the iptable rule to a dropbear upstart script (and what's an upstart script, anyway)?
buyrihn is offline   Reply With Quote
Old 07/06/2009, 04:11 PM   #6 (permalink)
Member
 
Join Date: Jul 2009
Posts: 33
Thanks: 0
Thanked 26 Times in 7 Posts
Default

starting and stoping is quite easy, you litterally type stop PmConnectionManager and start PmConnectionManager at the command line. As far as adding the ip table rule you edit the file in /etc/event.d/optware-dropbear and you will see a few iptable lines near the end of the file. just add another line with the rule that I posted here. Here is what mine looks like:

pre-start script
# Add firewall rule to allow SSH access over WiFi on port 222
# Remove the "-i eth0" on both of the following lines to enable SSH access
# over the cellular data network (EVDO, etc).
/usr/sbin/iptables -D INPUT -p tcp --dport 222 -j ACCEPT || /bin/true
/usr/sbin/iptables -I INPUT -p tcp --dport 222 -j ACCEPT
/usr/sbin/iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
end script
zeropoint46 is offline   Reply With Quote
Old 07/06/2009, 04:37 PM   #7 (permalink)
Member
 
Join Date: May 2009
Posts: 452
Thanks: 27
Thanked 252 Times in 51 Posts
Default

Quote:
Originally Posted by zeropoint46 View Post
starting and stoping is quite easy, you litterally type stop PmConnectionManager and start PmConnectionManager at the command line. As far as adding the ip table rule you edit the file in /etc/event.d/optware-dropbear and you will see a few iptable lines near the end of the file. just add another line with the rule that I posted here. Here is what mine looks like:

pre-start script
# Add firewall rule to allow SSH access over WiFi on port 222
# Remove the "-i eth0" on both of the following lines to enable SSH access
# over the cellular data network (EVDO, etc).
/usr/sbin/iptables -D INPUT -p tcp --dport 222 -j ACCEPT || /bin/true
/usr/sbin/iptables -I INPUT -p tcp --dport 222 -j ACCEPT
/usr/sbin/iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
end script
The phrase, "a prince among men" comes to mind. Thank you kindly.
buyrihn is offline   Reply With Quote
Old 07/06/2009, 05:01 PM   #8 (permalink)
Member
 
Join Date: May 2009
Posts: 452
Thanks: 27
Thanked 252 Times in 51 Posts
Default

Update:

This was absurdly simple in execution. After following the instructions and lastly modifying the iptables, I restarted the phone. It came back up, I made sure bluetooth was on, then added a new Bluetooth device on my Mac. The Pre was found, and a new PAN (Personal Area Network) was established. I turned off the WiFi on my laptop, and connected to the PAN (click the Bluetooth icon in your menu bar, then click the Pre). Flawless. I had the Pre connected to my wireless network, so I don't know how quick it'll be using EVDO, (and at the risk of offending some of the more Neanderthal among us) it's so simple a caveman could do it.

Thanks again.

Update (again): I tried using EvDo. It works, but it's molasses slow. I'm guessing part of this may be because I'm connecting via Bluetooth. How would I connect via USB instead?
buyrihn is offline   Reply With Quote
Old 07/06/2009, 05:09 PM   #9 (permalink)
Member
 
Join Date: Jul 2009
Posts: 33
Thanks: 0
Thanked 26 Times in 7 Posts
Default

follow the instructions on enabling usbnet, I think you can find it on the predev wiki.
zeropoint46 is offline   Reply With Quote
Old 07/06/2009, 10:05 PM   #10 (permalink)
Member
 
Join Date: Jul 2009
Posts: 19
Thanks: 5
Thanked 1 Time in 1 Post
Default

Wow, that was almost too easy! Thanks so much for keeping after it.

I'm posting this from my newly tethered Pre. It's not super speedy, but good enough for the rare cases when I'll actually need it. Rock on!
Prefect is offline   Reply With Quote
Old 07/06/2009, 10:11 PM   #11 (permalink)
Member
 
Join Date: Jul 2009
Posts: 19
Thanks: 5
Thanked 1 Time in 1 Post
Default

Update: while the screen was refreshing I turned on Outlook. The Pre popped up a notice that it wanted to turn on WiFi because there was no network connection available. When I dismissed the notice, everything in Firefox stopped and I had to restart to get going again. So maybe we can only browse, but that's ok. I can still use web based email.
Prefect is offline   Reply With Quote
Old 07/06/2009, 10:23 PM   #12 (permalink)
Homebrew Developer
 
Join Date: Nov 2008
Location: Raleigh, NC
Posts: 187
Thanks: 36
Thanked 29 Times in 16 Posts
Default

Quote:
Originally Posted by Prefect View Post
Update: while the screen was refreshing I turned on Outlook. The Pre popped up a notice that it wanted to turn on WiFi because there was no network connection available. When I dismissed the notice, everything in Firefox stopped and I had to restart to get going again. So maybe we can only browse, but that's ok. I can still use web based email.
An internet connection should be an internet connection, you shouldn't be limited to just browsing or checking email...
mfive is offline   Reply With Quote
Old 07/06/2009, 10:25 PM   #13 (permalink)
Member
 
Join Date: Jun 2009
Posts: 66
Thanks: 9
Thanked 0 Times in 0 Posts
Default

Wow, this is completely awesome. I'm also posting from a tethered Pre.

And you get to charge your phone at the same time (via USB)!
eesucks is offline   Reply With Quote
Old 07/06/2009, 11:38 PM   #14 (permalink)
Member
 
Join Date: May 2009
Posts: 50
Thanks: 3
Thanked 99 Times in 5 Posts
Default

nice find! trying it as we speak. Hopefully this works would like to use laptop on Bus ride Commute
t.tokarczyk01 is offline   Reply With Quote
Old 07/07/2009, 12:00 AM   #15 (permalink)
Member
 
volcom45's Avatar
 
Join Date: Jun 2009
Posts: 763
Thanks: 211
Thanked 61 Times in 46 Posts
Default

Quote:
Originally Posted by zeropoint46 View Post
hello all,

I'm new here but I love the site. I posted this on the "possible tether work-around" thread but I wanted to make sure everybody got a chance to see it, and that thread is pretty long now. I used to have my 800w hacked for tethering and when I found the options of tethering available to the pre (so far) they just didn't quite cut it. I didn't want to have to ssh to my phone and use a socks proxy or run an app to shut down pmconnectionmanager every time I wanted to connect, so I modified the connectionmanager program to stop change ip_forward to 0. Here are the steps:

Prerequisites:
rooted pre
ssh access (dropbear or openssh)
ability to use VI or editor of your choice

optional prereq:
usbnet setup and dhcp setup

1) ssh to the phone, sudo to root and go to /usr/bin

2) cp PmConnectionManager PmConnectionManager.orig just in case you mess something up

3) stop PmConnectionManager

4) vi PmConnectionManager and do a find for "forward" (with vi you use / then the string you are looking for)

5) the third "forward" you find should say "Disabling IP Forwarding^@0^@^@^@"

6) change the 0 to a 1, save and quit

7) start PmConnectionManager

I did this and kept checking my /proc/sys/net/ipv4/ip_forward file and it is now staying at 1. with this and the correct IPtable rules I can just connect my phone via usb or bluetooth and get right on the net without ssh or anything else. I rebooted the phone many times and it has stuck also the iptable rull I'm using looks something like this:

iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE

I added that iptable rule to my dropbear upstart script so it gets added on startup. If you wanted to make a separate upstart you could, but I was too lazy. I'm using webOS 1.0.4 and it's working great. Let me know if you have any questions. thanks.
Sorry to be so ignorant here, but I really want to do this and haven't fooled with this sorta thing before.. have only installed the SDK for USB installing homebrew apps. Anyway, you mention:

"optional prereq:
usbnet setup and dhcp setup"

But I don't see any of that listed in your instructions, is that not necessary?
Thanks,
volcom45 is offline   Reply With Quote
Old 07/07/2009, 12:22 AM   #16 (permalink)
Member
 
Join Date: Jul 2009
Posts: 33
Thanks: 0
Thanked 26 Times in 7 Posts
Default

I did not list it because you can find it on predev wiki. I should have probably posted a link to it before because it's probably highly desirable with this mod. so here it is.

pre dev wiki: USBnet networking setup


make sure and do the optional dhcp setup as well. Let me know if you have any other questions.
zeropoint46 is offline   Reply With Quote
Thanked By:
Old 07/07/2009, 12:45 AM   #17 (permalink)
Member
 
Join Date: May 2009
Posts: 160
Thanks: 94
Thanked 129 Times in 27 Posts
Default

Could you post your PmConnectionManager I cant edit mine in osx. Also if you could post your dropbear script I would be very grateful.
chrissurra is offline   Reply With Quote
Old 07/07/2009, 01:53 AM   #18 (permalink)
Homebrew Developer
 
fain's Avatar
 
Join Date: Jun 2009
Location: Lexington KY
Posts: 813
Thanks: 66
Thanked 117 Times in 82 Posts
Default

Ok, I have DHCP set up on usb0 via predev and I followed your instructions here but something is not right. When i plug the usb up I get a ip address of 192.168.0.12.
My gateway is 192.168.0.202 as is my DNS.

I have no connection to the internet. At least not with DNS. I haven't tried a IP but i need DNS of course. Am I missing something?

What should the DNS be? Sprints DNS servers? or 192.168.0.12? I doubt it is 192.168.0.202 as that address is not on my usbnet or is it a virtual interface bridge to ppp0? If it is wrong, how do I change it on my pre?

Thanks

ok i figured out the ip was coming from the pres usb0, but i still have no connection to the internet :/


edit2: nvm sorry must of been the firewall rule after reboot it worked fine getting about 75 KB/s average

edit3: ok, it looks like I can only have one or the other. Whith the modified PmConnectionManager in place. the pre will not operate over its EVDO. It pops up a no network connection dialog.

Last edited by fain; 07/07/2009 at 02:50 AM.
fain is offline   Reply With Quote
Old 07/07/2009, 03:01 AM   #19 (permalink)
Member
 
Join Date: Jul 2009
Posts: 33
Thanks: 0
Thanked 26 Times in 7 Posts
Default

as I post this message I'm am downloading and watching youtube on my phone. so there might be something wrong with your config. about posting the files I would be more than willing but I dont wanna violate any terms on this forum. PM me and I will help you.
zeropoint46 is offline   Reply With Quote
Old 07/07/2009, 07:55 AM   #20 (permalink)
Member
 
Join Date: Feb 2009
Posts: 335
Thanks: 168
Thanked 55 Times in 26 Posts
Default

Quote:
Originally Posted by mfive View Post
An internet connection should be an internet connection, you shouldn't be limited to just browsing or checking email...
Well, when you're hacking your phone to do something your service plan isn't allowing for, IE stealing service, I wouldn't really complain that its not doing what an "internet connection" should be doing.

Graet find here though. Seems the easiest of all the tether work arounds. I don't know much about a lot of the programming though so how hard would it be possibly in the future to write a program that essentially automatically goes in and switches that setting?
Zyphlin is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 02:04 AM.

Creating smartphone communities
Android Central - Android reviews, news and forums Crackberry - Blackberry news, reviews and community TiPb - iPhone news, accessory reviews & forums
Pre Central - Palm Pre Review, News and Community Treo Central - Treo & Centro News and Forums WMExperts - Windows Mobile Reviews & News

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0