NEWS‎ > ‎

    Concurrent 3G/4G & WiFi for Android

    posted Aug 27, 2012, 8:12 PM by Arpit Gupta   [ updated Aug 27, 2012, 8:34 PM ]
    This is a pressing issue and there are various arguments for and against this concept. In my opinion the kind of progress   MPTCP  is making and the fact that their effort is backed by biggies like Intel, Google and Nokia, the day when MP will be officially supported is not far.

    Currently Android supports only usage of one default interface at a time. It has a defined priority list based on which it turns OFF interfaces with lesser priorities. One general solution to this issue is to locate where in Android's source code is the logic to ensure single interface is turned ON. This approach was provided by Mobisocial Research group. After reading response from the people who tried this approach, I concluded that it is confusing to start with and may not always work. Also such a solution will affect data packets of all applications, which is not always desired. 

    Another alternate is to use an approach similar to Android WiFi Tether , in which tethered phone uses its internet connection through 3G/4G interface and serves as AP to associated client (infrastructure mode). I designed a solution which simplifies the methodology used for WiFi Tether to enable concurrent usage of both 3G/4G and wifi interface. Such a solution will enable usage of multiple interfaces for specific applications. This gives us better control of things, which is usually desired. Also approach is simple to follow (I think so). 



    Solution:

    System:
    Tested on HTC Evo3D (rooted) and Ubuntu (10.04 & 11.04).
    WLAN interface for this device was eth0
    AP to connect had essid='TEST_AG'

    Get Started:
    login to the shell of ur phone:
    "adb shell"
    request root access:
    "su"

    Enable WiFi:

    Make sure your 3G/4G interface are turned on before you carry out these steps.

    If WiFi is turned ON:
    1. "svc wifi disable"
    Else:
    1. Load your wifi driver module "insmod /system/lib/modules/bcm4329.ko" .This is platform dependent, refer the configuration file from Android Tether source code for wifi module PATH for your phone.
    2. Now turn the interface up using "busybox ifconfig eth0 up" . U will need to install busybox, use busybox installer app from play store for the purpose.
    3. Initiate the association process to desired AP using "iwconfig eth0 mode managed essid TEST_AG" . I followed this link to enable iwconfig functionality for my phone. Also make sure that u maintain this sequence , ie mode followed by essid.
    4. Commit ur changes "iwconfig eth0 commit".
    5. Assign appropriate IP adress to the WLAN interface using "dhcpcd eth0" . This will start dhcp discovery to obtain appropriate IP address for eth0 interface.
    6. use ip route show to check if you have appropriate routing table to forward the packets. For my case it looks like:

    21.83.91.93 dev rmnet0  scope link 
    21.83.91.92/30 dev rmnet0  proto kernel  scope link  src 21.83.91.94 
    192.168.1.0/24 dev eth0  proto kernel  scope link  src 192.168.1.108 
    default via 21.83.91.93 dev rmnet0 
    default via 192.168.1.1 dev eth0 

    Most of the time this routing table update will be automatically done. In case it does not looks familiar or u are not able to ping desired network gateway, follow this link.

    Test your connection:

    Above Routing table uses source routing which ensures that packets from different sources are routed on different interfaces. To check if your connection are working as desired use "ping -I eth0/rmnet0 www.google.com"
    -I (capital i) option for ping ensures the source interface/IP for ping request. If you observe disparate RTTs for the two ping requests, this means everything has worked perfectly.

    I searched for guidance from various forums and wanted to give back by sharing my progress. This makeshift approach can be used until official support from Google is floated. Hope it helps and will be glad to answer questions.

    Thanks,
    Arpit.
    Comments