Android tethering
Tethering is a way to have internet access on your PC through your smartphone using its network connection. USB tethering and Wi-Fi access point tethering are natively supported since Android 2.2 "Froyo". USB #Reverse tethering, to have internet access on your smartphone through your PC, is also possible.
Natively
USB tethering
USB tethering is available since Android 2.2 "Froyo" and usually provides a more reliable connection than Wi-Fi while being faster than Bluetooth. Since USB tethering is a wired method, it also consumes less power then wireless methods for a comparable connectivity quality.
- Connect the phone to your computer via USB (the USB connection mode -- Phone Portal, Memory Card or Charge only -- is not important, but please note that you will not be able to change the USB mode during tethering)
- Enable the tethering option from your phone. This is usually done from one of:
- Settings > Wireless & networks > Internet tethering (or Tethering & portable hotspot, for more recent versions)
- Settings > More... > Tethering & mobile hotspot > USB tethering
- Install the usb_modeswitch package. See Mobile broadband modem#Mode switching for more information.
- Follow Network configuration.
If you are using a cellular data plan and you have recently entered a new billing period, you may need to restart your phone.
Using systemd-networkd with udev
Using systemd-networkd you can automatically adjust the networking to use the phone as the gateway when plugged in.
/etc/udev/rules.d/90-android-tethering.rules
# Execute pairing program when appropriate ACTION=="add|remove", SUBSYSTEM=="net", ATTR{idVendor}=="18d1" ENV{ID_USB_DRIVER}=="rndis_host", SYMLINK+="android"
You may have to adjust the idVendor
attribute depending on your phone. You can check using udevadm:
$ udevadm info /sys/class/net/enp0s26u1u2
Then create the corresponding systemd-networkd file:
/etc/systemd/network/50-enp0s26u1u2.network
[Match] Name=enp0s26u1u2 [Network] DHCP=yes
Wi-Fi access point
Using an Android phone as a Wi-Fi access point (to a 3G/4G mobile internet connection) is available for devices running Android 2.2 "Froyo" or newer.
Enable it via one of the following:
- Settings > Wireless & networks > Internet tethering > Wi-Fi access point
- Settings > More... > Tethering & mobile hotspot > Mobile Wi-Fi hotspot
- On some phones, this method will discharge the battery rapidly and tends to cause intense heating, unlike USB.
- On some phones, it is only possible to tether the mobile data and not "bridge" the Wi-Fi Signal.
Tethering via Bluetooth
Android (from at least 4.0 onwards, possibly earlier) can provide a Bluetooth personal-area network (PAN) in access point mode.
NetworkManager can perform this action and handle the network initialisation itself; consult its documentation for more details.
Alternatively: pair and ensure you can connect your computer and Android device, as described on Bluetooth, then, substituting the address of the Android device (here given as AA_BB_CC_DD_EE_FF
), do:
$ dbus-send --system --type=method_call --dest=org.bluez /org/bluez/hci0/dev_AA_BB_CC_DD_EE_FF org.bluez.Network1.Connect string:'nap'
This will create a network interface bnep0
. Finally, configure a network connection on this interface; Android offers DHCP by default.
USB tethering with EasyTether
Get the easytether linux client software. The commands to set it up and run it are as follows.
# pacman -U easytether-0.8.5-2-x86_64.pkg.tar.xz # easytether-usb # dhcpcd tap-easytether
Make sure you have the EasyTether android app installed on your phone for it to connect to. Note: The Lite app disables some connections and you must have the paid app for full functionality. For this reason, using the AziLink setup is recommended instead.
Reverse tethering
Reverse tethering is to provide internet connection to Android through PC. gnirehtetAUR provides reverse tethering.
Connect your phone to your computer via USB like mentioned above and start:
$ gnirehtet run
Tethering with SOCKS proxy
With this method tethering is achieved by port forwarding from the phone to the PC. This is suitable only for browsing. For Firefox, you should set network.proxy.socks_remote_dns
to true
in about:config
( address bar )
Tools needed
- The android-tools and android-udev packages
- USB connection cable from your phone to PC
- Either Tetherbot, Proxoid, or Android Proxy Server
Instructions
Tetherbot
Tetherbot is an experimental SOCKS proxy and Port Bouncer that should allow you to connect your laptop to the internet using the internet connection (EDGE, 3G or Wifi) of your T-Mobile G1 Cellphone. It is discontinued and its website is down, but still can be accessed from Wayback Machine[1] where its APK can also be downloaded from.
In order to do SOCKS proxy via Tetherbot to connect your browser to the Internet, do:
- For your phone, open the application Tetherbot, decline Phone & Storage permissions, and press the Start Socks button
- Forward the port to your local computer:
# adb forward tcp:1080 tcp:1080
- Now go to your web browser's proxy settings, set a manual proxy configuration with the proxy host address
localhost
and port1080
, leaving the rest blank.
Proxoid
Follow the instructions demonstrated in the following link.
Android Proxy Server
Currently available on the Google Play store and supports HTTP/HTTPS, Socks5, Shadowsocks, and TCP Relay proxies.
To initiate a SOCKS proxy to connect your browser to the Internet, do:
- Open the app Android Proxy Server, and enable the Socks5 Proxy ticker
- Forward the port to your local computer:
# adb forward tcp:1088 tcp:1088
- Now go to your web browser's proxy settings, set a manual proxy configuration with the proxy host address
localhost
and port1088
, leaving the rest blank.