Join Today
+ Reply to Thread
Page 1 of 7 12345 ... LastLast
Results 1 to 10 of 61
  1. #1

    Default How To: Internet Connection Sharing - Mack Connectivity Pack

    Hi all,

    Here's my Connectivity Pack for sharing internet connection over PPP (bluetooth or USB). It works both ways. (sharing GPRS with your laptop, or sharing your broadband connection with your phone).

    See previous discussions in this thread:
    http://www.motorolafans.com/forums/v...ic.php?p=14968

    Below is the README file of this package.

    Admin, after all this kernel-tinkering, isn't it time I lose my "Newbie" status ?

    If you test this package, post your feedbacks here. I tested it on my A780 but it should work on other ezx phones as well.

    Mack


    Mack's connectivity pack:
    -------------------------

    This package contains some hacks to add two features to the A780 (and probably other EZX-based phones):

    1. Sharing the GPRS connection over bluetooth (PPP), to provide your laptop with internet access on the go, through the phone.

    2. Sharing the broadband internet connection of your desktop/laptop with the phone, so the phone can get faster and cheaper net access rather than the GPRS connection.

    For obvious reasons, you shouldn't use these two features at the same time.

    Disclaimer: Some of this work is an ugly hack. I take no responsibility to any damage. If, without loss of generality, your phone dies, your GPRS charges rocket to $1M or your country suffers a massive earthquake, don't come to me

    A Thank You note: This work is dedicated to Motorola for releasing these wonderful phones. Keep making linux-based open environment phones and I'm sure my next phone will be a Motorola too.

    Installation:

    0. Make sure you have a working PPP connection (such as LeoPPP), and a loader that runs .lin scripts.

    1. Extract this package in /diska/.system/QTDownLoad:
    cd /diska/.system/QTDownLoad/ ; tar zxvf /diska/MackConnectivityPack.tgz
    (If you install in a different location, you'll have to edit the 'ln' line
    of the {masq,unmasq,inet-bt,un-inet-bt} scripts, to link to the new dir.
    Iptables will look for its components in /tmp/mack/iptables, so the
    symlink is required).

    2. Copy *.lin from this directory to /diska/MyPrograms/ or wherever you like
    to run .lin files from:
    cp /diska/.system/QTDownLoad/mack/iptables/*.lin /diska/MyPrograms/


    Usage:

    Sharing the GPRS connection with your laptop:

    0. Create the PPP connection (over bluetooth or USB cable) and use the Data
    menu in Setup to start a GPRS connection to your favorite operator.

    1. Click 'Files' and browse to MyPrograms. Click MackNAT.lin. Nothing will
    appear to happen, but the environment is set.

    2. On your laptop, add a route to wherever you wish to connect through ppp0:

    route add <address> dev ppp0

    You could route ALL traffic through the GPRS connection:

    route del default
    route add default dev ppp0

    but be warned that your laptop may decide to generate unexpected traffic
    such as getting an OS update, and you'll end up paying for more traffic
    than you meant. Therefore, I only add route to an IP address I plan to
    ssh to, or a default route for a very limited time, to access some website.

    3. Use the connection.

    4. When done, just go back to MyPrograms and click MackUnNAT. Nothing will
    appear to happen, but traffic from your laptop will no longer be routed
    through GPRS.


    Sharing your broadband connection with your phone:

    0. Create the PPP connection (over bluetooth or USB cable).

    1. When ppp0 is up and running, set your laptop to route and NAT the fake
    GPRS IP, 10.1.1.1. Here's my script for doing 0+1:

    #!/bin/sh
    dund -n -P 5 -c <MY_A780_BT_ADDRESS> noauth 192.168.1.3:192.168.1.4 netmask 255.255.255.0 local
    while ! ping -c 1 192.168.1.4 >/dev/null 2>&1 ; do echo -n "."; sleep 1; done
    iptables -D FORWARD -i ppp0 -j ACCEPT >/dev/null 2>&1
    iptables -I FORWARD -i ppp0 -j ACCEPT
    iptables -D FORWARD -o ppp0 -j ACCEPT >/dev/null 2>&1
    iptables -I FORWARD -o ppp0 -j ACCEPT
    iptables -t nat -D POSTROUTING -s 10.1.1.1 -j MASQUERADE >/dev/null 2>&1
    iptables -t nat -I POSTROUTING -s 10.1.1.1 -j MASQUERADE
    route add 10.1.1.1 dev ppp0
    echo Ready.

    Note to the paranoids among us: if you wish to set separate firewall
    rules for the fake GPRS traffic going through your laptop/desktop, note
    that packets will appear as though coming from 10.1.1.1 rather than the
    normal ppp0 address of the phone.

    2. Make sure you don't have an active GPRS connection. (The script would
    work even if you do have one active, but you won't be sure you're not
    paying, because the fake gprsv0 won't be created). I also suggest you
    don't try to mess with the Data menu in Setup while this mode is active,
    since it'll talk to the fake dsm and yield unexpected results. If you
    did enter this mode while a GPRS connection is active, you'll have to
    restart your GPRS connection after leaving this mode.

    3. Click 'Files' and browse to MyPrograms. Click MackInetBT.lin. Nothing will
    appear to happen, but the connection should now be up.

    4. Use the connection. Opera, Java, and anything else should go through the
    fake GPRS interface. Note that kvm (java) will still ask you to choose
    a network profile to go through. Just create a fake one and select it.
    It doesn't matter what you write in it since the fake dsm will always tell
    kvm that connection is successful.

    By the way, if you wish to make sure you're using the BT connection rather
    than a GPRS connection, try to connect some local server on your network,
    which wouldn't be accessible through the internet. If you don't have one,
    you can just browse to http://checkip.dyndns.org/ and see that your IP
    address is not the one you usually get from your GPRS provider.

    5. When done browsing, just go to MyPrograms and click MackUnInetBT.lin.
    Everything will be back to normal, and you'll be able to start a real
    GPRS connection again.


    Implementation notes:

    The first feature was easy to implement. I just added NAT support to the
    phone's kernel, and added some iptables rules to activate it.

    The second one was tricky. Its trivial to just add a default route from the
    phone via ppp0, but some internal applications (Opera, kvm) insist on routing
    through gprsv0. (Opera just bind()s the GPRS IP for its connection. KVM
    takes a step further, and ioctl()s gprsv0 itself. I wonder why they do that...

    So, you'd think its still easy. Just write a small kernel module that
    replaces gprsv with a fake gprsv0, and compile ipt_ROUTE.o and reroute
    packets from gprsv0 to ppp0. Well, wrong again. These applications insist
    on checking with 'dsm', which asks tapisrv to check /dev/mux* for a live GPRS
    connection. If they can't detect a live GPRS connection, they refuse to
    connect().

    I was left with no choice but to fake the dsm interface in order to tell
    applications that the GPRS is on. The complete solution is a combination of
    a fake (usermode) dsm, a fake (kernel mode) gprsv, and some netfilter
    trickery to reroute fake gprsv0 traffic over ppp0.

    I guess I could write a single kernel module that does all that, but since
    my scripts work, I'll leave it at that for now.

    Good luck.

    Mack
    Attached Files Attached Files

  2. #2
    Join Date
    Feb 2005
    Location
    The Netherlands
    Cell: E680 flashed to E680i
    Posts
    1,368

    Default Re: Mack Connectivity Pack

    Woot way to go! Thanks! Ohyeah you could connect to internet from laptop thru bluetooth already with MPT, but good to be able to do it outside windows.
    Ps: you lose newbie status if you have more than 50 posts. So start postwhoring then!
    Yes, but does it run Linux?

  3. #3

    Default Re: Mack Connectivity Pack

    Quote Originally Posted by maxx_730
    woot way to go! Thanks!
    Ps: you lose newbie status if you have more than 50 posts. So start postwhoring then!
    You're welcome. Let me know if it works for you.

    As for newbie status - I know, but I figured some kernel hacking ought to be worth something.

  4. #4
    Join Date
    Feb 2005
    Location
    Singapore
    Posts
    3,206

    Default Re: Mack Connectivity Pack

    i'll make u still a newbie no matter what! xD

    kidding
    My favorite Motorola development site!


  5. #5
    Join Date
    Mar 2005
    Location
    NZ
    Posts
    459

    Default Re: Mack Connectivity Pack

    really want to try this but for some reason i can't get BTPPP connect to the pc after i reinstalled my windows :S
    always get timeout from connecting...

  6. #6

    Default Re: Mack Connectivity Pack

    beauty work mack!!! thanks!!!

    has anyone else tried this on an e680/i? (I know this is a 780 thread, but I cant help but try out cool ideas, so i'm hoping other e680 users read this 780 thread as well) I am pretty sure that the fake gprsv0 device is coming up ("ip route list" shows gprsv0 as default) and the forwarding is working okay on the host as I can ping anwhere from the phone (i'm assuming that the ping will go via the defaulted gprsv0), but neither opera or the kvm is respecting the connection.

    for reference, i did change all occurances from 10.1.1.1 to 10.1.1.101 to avoid confilcting w/ my router's internal ip address (in both the ip forwarding script on the host and inet-bt script on the phone), but since the ping seems to work (over the assumed default gprsv0) I don't know if this is a problem or not. any thoughts or suggestions would be most appreciated.

  7. #7
    Join Date
    Mar 2005
    Location
    NZ
    Posts
    459

    Default Re: Mack Connectivity Pack

    finally got my e680i btppp connected..
    i am not quite sure how to do 1st step...
    "When ppp0 is up and running, set your laptop to route and NAT the fake"
    when i run the script thats given it says the dund command is not found..

  8. #8
    Join Date
    Sep 2005
    Location
    Germany, Berlin
    Posts
    109

    Default Re: Mack Connectivity Pack

    try to add and edit the lines:

    iptables -D FORWARD -i ppp0 -j ACCEPT >/dev/null 2>&1
    iptables -I FORWARD -i ppp0 -j ACCEPT
    iptables -D FORWARD -o ppp0 -j ACCEPT >/dev/null 2>&1
    iptables -I FORWARD -o ppp0 -j ACCEPT
    iptables -t nat -D POSTROUTING -s 10.1.1.1 -j MASQUERADE >/dev/null 2>&1
    iptables -t nat -I POSTROUTING -s 10.1.1.1 -j MASQUERADE
    route add 10.1.1.1 dev ppp0

    to your iptables-firewallscript...
    restart the firewall so that the iptablesstuff is working...

    start mack's script when bluetooth is connected..

    #!/bin/sh

    dund -n -P 5 -c <MY_A780_BT_ADDRESS> noauth 192.168.1.3:192.168.1.4 netmask 255.255.255.0 local

    while ! ping -c 1 192.168.1.4 >/dev/null 2>&1 ; do echo -n "."; sleep 1; done

    iptables -D FORWARD -i ppp0 -j ACCEPT >/dev/null 2>&1

    iptables -I FORWARD -i ppp0 -j ACCEPT

    iptables -D FORWARD -o ppp0 -j ACCEPT >/dev/null 2>&1

    iptables -I FORWARD -o ppp0 -j ACCEPT

    iptables -t nat -D POSTROUTING -s 10.1.1.1 -j MASQUERADE >/dev/null 2>&1

    iptables -t nat -I POSTROUTING -s 10.1.1.1 -j MASQUERADE

    route add 10.1.1.1 dev ppp0

    echo Ready


    (maybe without the iptables stuff, 'cause this is allready running at this time)




    the phone will ask
    for an SSP connection...
    then take leoppp to get ppp over bluetooth running and then start
    MackInetBT.lin. after this it works for me on my a780

  9. #9

    Default Re: Mack Connectivity Pack

    I tried to work over belcarra usbnet connection with my e680i, native apps works flawless, but opera only says "connecting..." and doesn't stop(if the script is triggered from the console some numbers(1, 2 and 8 ) popups at random intervals of time)... I changed ppp0 of cell script to usbl0 and changed the ip of gw also(192.168.55.1 host computer IP). Cellphone has the 192.168.55.6 and gprs still with 10.1.1.1.

    About the native apps, if I try to access host internal webserver it reports the 192...6 ip. There is no log file with opera attemps to access the server.
    Realplayer seens to access something but I had no compatible file to test at this time.

    logs:
    192.168.55.6 - - [15/Sep/2005:03:21:37 -0300] "GET /inicio.shtml HTTP/1.0" 200 2545 "http://192.168.55.1:800/inicio.shtml" "Lynx/2.6 libwww" "-"

    10.1.1.1 - - [15/Sep/2005:03:22:40 -0300] "GET /fotos/d.rm HTTP/1.1" 404 867 "-" "RMA/1.0 (compatible; RealMedia)" "-"

  10. #10
    Join Date
    Mar 2005
    Location
    NZ
    Posts
    459

    Default Re: Mack Connectivity Pack

    still not sure what i should do after i get leoppp connected thorugh BT
    now i have my phone assigned to 192.168.1.11 and my pc as 192.168.1.2
    how do i set your laptop to route and NAT the fake GPRS IP?


 
+ Reply to Thread
Page 1 of 7 12345 ... LastLast

Similar Threads

  1. I want PC internet sharing via Bluetooth
    By wasim2007 in forum E6 General Chat
    Replies: 30
    Last Post: 03-28-2010, 08:13 AM
  2. Replies: 3
    Last Post: 02-02-2009, 04:08 PM
  3. *Help, plzz. about sharing GPRS connection with PC by usbnet
    By hch680 in forum E680i General Chat
    Replies: 1
    Last Post: 08-08-2007, 01:28 AM
  4. Sharing Internet Service
    By Flavinha_ in forum A1200 General Chat
    Replies: 1
    Last Post: 07-18-2007, 07:10 PM
  5. Internet Connection Sharing
    By aapurohit in forum A1200 General Chat
    Replies: 3
    Last Post: 11-23-2006, 09:34 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Single Sign On provided by vBSSO

Search Engine Optimization by vBSEO 3.6.0 RC 1