Share WIFI from PC over USB


Question

All the questions with similar titles are the inverse of what I want. I would like to connect my tablet (that is "blocked" on the Wifi) to my Windows 10 computer over a USB cable and have the computer "share" the Wifi. Is this possible?



EX: My tablet is blocked from the internet (home policy) but you can get Wifi by asking and staying in the main rooms, I want to have my tablet access the internet by having the computer "share" the internet with the tablet. I don't know if this is possible and if it is would like to know how.



I have a Nexus 7 2013 32GB Wifi on 6.0


Answer

Different ways of sharing interet connection from Windows to other devices



Nowadays there is a lot of ways to share internet connection to other devices and each method has its pros and cons.



Here is a breakdown of methods:




  1. Using Windows 10 Mobile Hotspot Feature:



Windows 10 hotspot



Newer editions of windows 10 (after 1607 anniversary update) have a built in mobile hotspot feature which allows internet sharing to other devices



pros




  • easy to use as its built-in


  • no extra tools needed


  • internet is shared over Wi-Fi (no need for cables)




cons




  • some network types are not recognised e.g 3g dongles.







  1. Using 3rd party tools



    Nifty tools such as mhotspot, or Connectify provide the ability to share internet to other devices by making use of Microsoft Virtual Wi-Fi Adapters




pros




  • provide many additional tools to monitor and customising created networks


  • improved encryption


  • internet shared over Wi-Fi




cons




  • some of these are commercial softwares and are relatively expensive



Connectify






3a. USB Reverse tethering



Reverse tetherng is a relatively newer method of sharing internet especially from devices that do not have a wireless adapter.
It uses the USB cable to share internet from the computer to the target device and oftern requires 3rd party tools and drivers as well as system modification of target devices.




  • Reverse Tethering (root)
    Requires the target devices to be rooted prior to connection and a USB server application or server to be installed on android. For better coverage this method often requires another Xposed module Hack connectivity service to increase internet coverage to most apps if not all.




    • Reverse tethering (no root)
      Similar to root based method but requires extra programs to be installed on windows




Specific requirements of reverse tethering no root:





pros
- can provide faster connections usually with low latency
- reverse tethering (no root) works on windows, linux and mac



cons




  • requires usb cable

  • installs additional apps on PC and phone

  • connections can be difficult to establish

  • some of these workarounds only work for some apps and not every app is guaranteed to have internet access, but from my experience browser, Gmail, google play were working just fine



Reverse tethering (root) interface






Update



3b. Using adb to reverse tether



Using bash script



alias t='r && sz $tether && r && sz $n'
tether='am start -n com.android.settings/com.android.settings.TetherSettings && input keyevent 66 && input keyevent 66'
n='netcfg rndis0 dhcp'
alias sz='ad shell'
alias de='ad devices -l'
alias r='ad kill-server && ad start-server'
alias ad='adb'
alias pu='adb push'


Special thanks to user42276 for this script



Pros




  • One good thing about scripting is that it eliminates the need for third party apps which may bloat the device/PC



Cons




  • Pretty much similar to method 3a above







  1. Using Windows ICS



Another way is to just use ICS in Windows with no third party software involved:



Requirements:




  • Terminal Emulator on your Android


  • Alternatively using adb shell commands (to use adb, you need to enable "USB debugging" on your Android).


  • Optional, BusyBox on your Android.




Instructions




  • Connect your Android to PC by USB cable and enable "USB tethering". You are still allowed to enable this option even when your 3g/wifi on your Android is off.

  • Windows will automatically search Windows Update and install driver for you.

  • Open "Network Connections" in Control Panel. Right click on an Internet connection that you have i.e WiFi connection (other connections like LAN also work), so right click on WLAN connection with Internet, and select "Properties".



    enter image description here




    • In tab "Sharing" click "Allow other network users to connect through...", then select the USB connection in dropdown list below.




enter image description here




  • Click OK. Windows will automatically setup your USB network connection and assign to it an IP address (usually 192.168.xxx.xxx or similar; for Win 7 and later its 192.168.137.1)

  • Your Internet connection is now "Shared" and your USB connection is now "Unidentified network".



Type the following command in Terminal Emulator:



netcfg rndis0 dhcp



The name for usb interface inside Android may vary. It is usually rndis0 or usb0. Type busybox ifconfig to identify the name.



It can happen that automatic dhcp method does not work. In this case we have to do it manually:



Type these following commands in Terminal Emulator:



ifconfig rndis0 192.168.137.2 netmask 255.255.2 route add default gw 192.168.137.1 dev rndis0


If route fails, try:
busybox route add default gw 192.168.137.1 dev



Some applications (download in Google Play, Gmail, Facebook...) don't recognize the internet connection. You can try this way:




  • Enable temporarily 3G connection on your Android


  • Type: ifconfig rmnet0 0.0.0.0
    The name for 3G interface inside Android may vary: ppp0, rmnet0... (Type busybox ifconfig to identify the name).




This will make applications see your Internet connection via USB as 3G/4G



Well its up to user to know which method suites them best. Hope it helps


Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes