Using Android’s tethering in OpenWrt


OpenWrt - Android

If your router has a USB port you can use Android’s USB tethering to connect to Internet when your regular service provider is down. To do so just follow these steps::

  1. Update the package list
      opkg update
  2. Install the following components::
      opkg install kmod-usb-uhci kmod-usb-net-rndis
  3. Once installed, connect your Android device and enable the USB tethering.
  4.  

    USB tethering Anclaje

  5. In the router, check if the device has been detected:
      root@OpenWrt:~# logread
      May 22 03:16:51 OpenWrt user.info kernel: usb 1-1: USB disconnect, address 4
      May 22 03:16:51 OpenWrt user.info kernel: usb 1-1: new high speed USB device using ar71xx-ehci and address 5
      May 22 03:16:51 OpenWrt user.info kernel: usb 1-1: configuration #1 chosen from 1 choice
      May 22 03:16:51 OpenWrt user.info kernel: usb0: register 'rndis_host' at usb-ar71xx-ehci-1, RNDIS device, 82:ab:00:f2:6d:9c
      root@OpenWrt:~# ifconfig usb0
      
      usb0      Link encap:Ethernet  HWaddr 82:AB:00:F2:6D:9C
                BROADCAST MULTICAST  MTU:1500  Metric:1
                RX packets:0 errors:0 dropped:0 overruns:0 frame:0
                TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
                collisions:0 txqueuelen:1000
                RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
  6. Now you must choose usb0 as the wan interface by editing the /etc/config/network file or using the web interface:
  7. OpenWrt - Android tethering

  8. Bring down the wan interface, then bring it up:
      ifdown wan
      ifup wan

If you check the network interfaces in LuCi you should see this:

OpenWrt - Android tethering - WAN

Reference: USB tethering an Android phone to an OpenWRT router

, ,

  1. #1 by Luis Gallardo on 04/02/2014 - 8:26 pm

    @Agustín thanks for comment. Maybe my router had kmod-usb-acm loaded before. This module handles phone’s modem functions. Best regards!

  2. #2 by Agustín Dall'Alba on 04/02/2014 - 7:34 pm

    For a Galaxy S3 on Barrier Braker, I needed kmod-usb-net-rndis and kmod-usb-acm.

  3. #3 by Luis Gallardo on 21/01/2012 - 6:31 pm

    @karl I don’t recommend you to compile OpenWrt. Just follow the instructions in the article, but you will need an internet connection on your router, therefore you can download the needed packages. In particular, opkg is like apt-get/aptitude on Debian/Ubuntu, it downloads the packages and its dependecies automagically. Thanks for your comments about the blog. Best regards!

  4. #4 by karl on 21/01/2012 - 12:02 pm

    Yeah tethering works fine it’s what i always do but would like to use router to connect more computers, mainly to pentest. I’m not experienced enough to compile my own module and i really like the router so i don’t want to damage it, i’ll work out a way to do it though i’m sure. Thankyou so much for your feedback and your posts are really informative, i can see many people have benefited from them, i hope to see more soon. All the best for 2012.

  5. #5 by Luis Gallardo on 21/01/2012 - 10:10 am

    @karl you can try to compile the module, but you need to know what you’re doing because you can damage your router badly!…and you’ll need to download openwrt source files and Ubuntu’s tools for compiling, so you will need a broadband connection.

    By the way, did you try to use your Android phone with your PC? I mean, tethering to your PC directly.

    Best regards!

  6. #6 by karl on 21/01/2012 - 5:53 am

    After posting i did realise my mistake and saw opkg was openwrt specific but my phone is my only internet connection so i can’t update/download until my router accepts my android phone, otherwise when i tether my pc while router is connected the eth0 gets priority and again leaves me offline, do you have any ideas to help me get around this? Could i take router to friends house with Broadband connection update/download files to unlock router or do the files need to be on my computer? Sorry for being a pain Luis i just need that kmod-usb-uhci kmod-usb-net-rndis package is there anyother way to get it? Thankyou.

  7. #7 by Luis Gallardo on 20/01/2012 - 9:29 pm

    @karl opk works on OpenWrt, whic means, you MUST logging into the router using ssh. On Ubuntu you can reach your router by typing (assuming you have the defaults):

    ssh [email protected]

    Then you follow the instruction in the article.

    Cheers!

  8. #8 by karl on 20/01/2012 - 4:39 pm

    i can’t get opkg to work in linux mint 12 kde I am trying to tether Samsung Galaxy to TP-LINK 3240 via openwrt, any suggestions would be appreciated, i’m new to Linux but am a quick study so a simple step by step guide would help but not essential, thanks again Luis

  9. #9 by Luis Gallardo on 15/01/2012 - 10:32 am

    @karl you are welcome. I hope it helps you. Regards!

  10. #10 by karl williams on 15/01/2012 - 10:27 am

    I’ve been asking this question as to wether you can tether this product and after days of searching i not only found the answer but you gave detailed install instructions, thanyou so very very muck :)

(will not be published)