如何在USB上设置反向系数? -- usb 领域 和 networking 领域 和 tethering 领域 和 reverse-tether 领域 和 usb-tethering 领域 android 相关 的问题

How to set up reverse tethering over USB?


简体版||繁體版
132
vote

问题

中文
  1. 我的htc g2手机植根于植物和运行cyanogenmod 7
  2. 我没有数据计划。
  3. 有时我想在没有Wi-Fi的时候将手机连接到Internet,更新市场应用程序,将SMS消息备份到Gmail,从Gmail同步新联系人等。我不能用USB质量做的事情存储模式。
  4. 我有一个连接到互联网的Windows 7专业计算机,但我不允许设置Ad-hoc Wi-Fi网络。 (如果我这样做,他们会注意到并追捕我。)

是否有一种方法可以通过与计算机的USB连接访问互联网?如果是,我如何设置它?

英文原文
  1. My HTC G2 phone is rooted and running Cyanogenmod 7
  2. I don't have a data plan.
  3. Sometimes I want to connect the phone to the Internet when there isn't Wi-Fi, to update Market apps, backup SMS messages to Gmail, sync new contacts from Gmail, etc. Things I can't do with USB mass storage mode.
  4. I have a Windows 7 Professional computer connected to the Internet, but I'm not allowed to set up an ad-hoc Wi-Fi network. (If I do, they will notice and hunt me down.)

Is there a way for the phone to access the Internet through the USB connection to the computer? If so, how do I set it up?

              
   
   

回答列表

47
 
vote

我最近发现了 simplert 它非常适合Linux(也很明显OSX)。只需在设备上启用USB调试(无根),安装 APK从您的设备中的Page 链接,并通过USB将其连接到您的PC,然后在PC上运行二进制文件。

它将将连接设置为VPN隧道( AbcDefghijklmnabcdefghijklmn0 默认情况下),您的设备应提示您(a)允许sportert创建/监督VPN连接以及(b)当设备配置为特定的USB附件时是否运行它(这是二进制文件)。

该项目不包括预先构建的二进制文件,所以我上传了我为ubuntu 建造的一个。


以下是一种手动方法,应该在Linux或Windows上工作: http://blog.mathieu.carbou.me/post/60454997009/reverse-usb-tEthering-with-android-2-2

步骤1:

for Windows:从Android SDK安装USB驱动程序

为linux:没有什么可以做的

步骤2:

在Nexus上:连接USB电缆并激活USB系列。您应该在Linux或Windows上看到新的网络接口。

步骤3:

在Linux计算机上,设置桥:

  # usb0 is the new network interface # eth0 is the main interface connected to internet (or a gateway)  sudo ifconfig eth0 0.0.0.0   sudo ifconfig usb0 0.0.0.0   sudo brctl addbr br0   sudo brctl addif br0 eth0   sudo brctl addif br0 usb0   sudo ifconfig br0 up   sudo dhclient br0   

看 https://help.ubuntu.com/community/networkconnectionBridge 设置桥梁< / p>

在Windows上,桥接2网络接口

步骤4:

手机的USB0接口。您必须选择:

  1. 从计算机执行:

     ./ adb shell netcfg usb0 dhcp 
  2. 或在手机上的根终端中,键入:

     su netcfg USB0 DHCP 

您现在应该能够使用计算机的互联网连接在手机上连接到Internet。

试着做一个ping www.google.com来确定!

步骤5:

关闭反向系数,您计算机上的第一个Unbridge接口:

 sudo ifconfig eth0 down sudo ifconfig usb0 down sudo ifconfig br0 down sudo brctl delbr br0 sudo ifconfig eth0 sudo dhclient eth0 
然后在手机上,取消选中USB系列选项!

您还可以使用Windows创建WiFi网络(使用 Connectify )并将您的设备连接到: http ://www.nexusoneforum.net/forum/nexus-one-faq-how-tos/3133-reverse-tether-getting-internet-your -phone.html

 

I recently discovered SimpleRT which works very well with Linux (and apparently OSX as well). Simply enable USB Debugging on your device (no root required), install the APK linked from that page on your device and connect it to your PC via USB, and then run the binary on your PC.

It will set up the connection as a VPN tunnel (tun0 by default) and your device should prompt you to (a) allow SimpleRT to create/oversee the VPN connection as well as (b) whether to run it when the device is configured as a particular USB accessory (which is what the binary does).

The project does not include a pre-built binary, so I've uploaded one I built for Ubuntu.


Below is a manual method that should work on Linux or Windows: http://blog.mathieu.carbou.me/post/60454997009/reverse-usb-tethering-with-android-2-2

STEP 1:

For Windows: Install USB drivers from Android SDK

For Linux: Nothing to do

STEP 2:

On Nexus One: Connect USB cable and activate USB Tethering. You should see on linux or windows a new network interface.

STEP 3:

On Linux Computer, setup a bridge:

# usb0 is the new network interface # eth0 is the main interface connected to internet (or a gateway)  sudo ifconfig eth0 0.0.0.0   sudo ifconfig usb0 0.0.0.0   sudo brctl addbr br0   sudo brctl addif br0 eth0   sudo brctl addif br0 usb0   sudo ifconfig br0 up   sudo dhclient br0 

See https://help.ubuntu.com/community/NetworkConnectionBridge to setup bridges

On windows, Bridge the 2 network interfaces

STEP 4:

Setup usb0 interface of your phone. You have to options:

  1. From your computer, execute:

    ./adb shell netcfg usb0 dhcp
  2. Or in a root terminal on your phone, type:

    su netcfg usb0 dhcp

You should now be able to connect to Internet on your phone using your computerxe2x80x99s Internet connection.

Try to do a ping www.google.com to be sure !

STEP 5:

To shut down the reverse-tethering, first unbridge interfaces on your computer:

sudo ifconfig eth0 down   sudo ifconfig usb0 down   sudo ifconfig br0 down   sudo brctl delbr br0   sudo ifconfig eth0 up   sudo dhclient eth0

Then on your phone, uncheck the USB Tethering option !

You can also use Windows to create a WiFi network (using Connectify) and connect your device to that: http://www.nexusoneforum.net/forum/nexus-one-faq-how-tos/3133-reverse-tether-getting-internet-your-phone.html

 
 
         
         
19
 
vote

还有更多的可能性 - 但我都知道需要一个扎根的设备。

使用反向系绳 app

首先,有一个名为反向系绳< / a>在播放商店免费提供(这是一个有限的试用版,这限制了您可以连接的时间 - 但至少您可以通过这种方式测试您的设备是否完全支持;完整版本约为5)。根据一个在androidauthority 的文章,设置应该简单1-2-3:插上USB电缆,启动应用程序,让它自动配置(手动配置也可以使用) - 以及在那里。您还可以让它要求您在找到USB连接时连接。

使用WiFi的手动方法

我知道,这不是USB - 但对于完整性(并提供替代品)我认为我也可以添加它们:

摆弄系统并修补

几种手动方法也是可用的(并在 xda ) - 但它们大多是技术上复杂的,并且期望您修补系统文件;不是每天用户,而是为了技术怪胎。

终端并转到

但是,另一个很好的方法应该涉及终端中的3行,并在帖子 here
  su ifconfig wlan0 up iwconfig mode auto; iwconfig wlan0 essid "your SSID" channel 11 mode auto ifconfig wlan0 10.0.0.x netmask 255.255.255.0   

操纵某些配置文件

另一个非常简单的方法也被描述在这里,并涉及编辑 wpa_supplicant.conf 文件一次(手动添加您的Ad-hoc Wifi网络)。

易于释放方法

我需要说,真的吗?使用WiFi路由器。甚至有一些小的"旅行路由器" 左右少于USD 50.然后将手机连接到您用来将其连接到其他WiFi网络...

 

There are some more possibilities -- but all of them I know of require a rooted device.

Using the Reverse Tether App

First, there's an App named Reverse Tether available for free on the Play Store (it's a limited trial, which restricts the time you can be connected -- but at least you can test this way whether your device is fully supported; the full version is about USD 5). According to an article at AndroidAuthority, setup should be as easy as 1-2-3: Plug in the USB cable, start the app, let it auto-configure (manual configuration is available as well) -- and there you go. You can also let it ask you to connect when it finds an USB-connection.

Manual methods using Wifi

I know, this is not USB -- but for completeness (and giving alternatives) I thought I might add these as well:

fiddling with the system and patching around

Several manual methods are available as well (and described e.g. at XDA) -- but they are mostly technically complex, and expecting you to patch system files; not for the every-day-user, but rather for the tech-freak.

Terminal and go

However, another nice method should just involve 3 lines in the terminal, and is described in a post here, to connect to an ad-hoc Wifi network. Basically, it should go like this:

su ifconfig wlan0 up iwconfig mode auto; iwconfig wlan0 essid "your SSID" channel 11 mode auto ifconfig wlan0 10.0.0.x netmask 255.255.255.0 

manipulating some config file

Another quite easy method is also described here, and involves editing the wpa_supplicant.conf file once (manually adding your ad-hoc Wifi network).

Easy-Peasy method

Do I need to say, really? Use a Wifi router. There are even some small "Travel routers" around for less than USD 50. And then connect your phone like you use to connect it to other Wifi networks...

 
 
7
 
vote

嘿!有一个应用程序为此

Android USB端口转发
http://www.codeproject.com/kb/android/usbportforward.aspx

我有点困惑如何使用它,请告知如果您完美地工作。

 

Hey! there is an app for that

Android Usb Port Forwarding
http://www.codeproject.com/kb/android/usbportforwarding.aspx

I am a bit confused how to use it, please inform if you get it working perfectly.

 
 
   
   
6
 
vote

我知道这是甚至后来的回答,但值得一提。

无根必需!

无应用应用程序安装!* 如果您没有其他互联网连接,那么甚至可能。

有一个名为 gnirehtet 。

  1. 安装 adb 进入主机PC(Windows / Linux / Mac)
  2. 将gnirehtet zip文件下载到主机
  3. 解压缩它
  4. 运行命令

就是这样!有关更多信息,请阅读其网站上Gnirehtet的Readme文件。

* =在场景后面,它将通过USB连接将APK文件安装到您的设备上。

 

I know this is an even later answer, but it is worth mentioning it.

No rooting needed!

No app installation needed!* Which is not even possible if you do not have some other internet connection.

There is a project called gnirehtet.

  1. Install adb on to the host PC (Windows/Linux/Mac)
  2. Download the gnirehtet zip-file to the host
  3. Unzip it
  4. Run the command

That's it! For more information, read the readme file of gnirehtet on their website.

*=Behind the scenes it will install an apk file on to your device via the USB connection.

 
 
   
   
3
 
vote

我已经找到了一个很好的工具,用于在XDA开发人员论坛上反向束缚。它被称为 Android反向Tethering 。它适用于Windows并需要扎根的手机。
它在我的HTC Desire HD运行MIUI v4上工作正常。

 

I've found a good tool for reverse tethering on xda-developers forum. It's called Android Reverse Tethering. It works with Windows and requires a rooted phone.
It works fine on my HTC Desire HD running MIUI v4.

 
 
   
   
3
 
vote

Android反向系数步骤:

注意:仅在rooted android手机中工作。

  1. 通过USB连接Android设备。
  2. 使能USB系列。为此,请转到设置→更多...→tethering&amp;移动热点→USB系列

  3. 在主机上,网络管理器可以检测USB系束连接。
    它的名字将是"有线连接2" (或3)。
    您必须将其编辑为"IPv4 /方法" 到"共享给其他计算机" 。

3.1。没有网络管理器,您必须手动执行:

      $ sudo ifconfig usb0 10.42.0.1 netmask 255.255.255.0      $ echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward   

现在,如解释为在step1的末尾您有要修改 iptables :sudo iptables -t nat -A POSTROUTING -j MASQUERADE 。但是......喜欢允许网络管理员在可能的情况下进行。

    在Android设备上,您可以使用终端发出这些命令,其中包含 abcdefghijklmn3 在那里使用adb:
      $ adb shell su -c "netcfg rndis0 dhcp"   

    如果它没有得到IP地址,或者如果您使用的是静态IP地址是可取的"WebKey for Android" 应用程序的应用程序,则手动分配:

      $ adb shell su -c "ifconfig rndis0 10.42.0.2 netmask 255.255.255.0" $ adb shell su -c "route add default gw 10.42.0.1 dev rndis0"   

现在互联网将在Android手机工作。

要检查,在 adb shell 或Android终端,尝试命令 ping www.google.com

它适用于我。

 

Android reverse tethering steps:

Note: Works only in a rooted Android phone.

  1. Connect Android device via USB.
  2. Enable USB tethering. To do so, go to Settings xe2x86x92 More... xe2x86x92 Tethering & mobile hotspot xe2x86x92 Usb tethering.

  3. At host machine, the usb tethering connection may be detected by the network manager.
    Its name will be something like "Wired connection 2" (or 3).
    You must edit it's "IPV4/Method" to "Shared to other computers".

3.1. Without the network manager, you will have to do it manually:

    $ sudo ifconfig usb0 10.42.0.1 netmask 255.255.255.0      $ echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward 

Now, as explained here at the end of Step1 you have to modify iptables with sudo iptables -t nat -A POSTROUTING -j MASQUERADE. But... prefer allow network manager to do it if possible.

  1. At Android device, you can issue these commands using a terminal with su there, or from your host machine by using ADB:

    $ adb shell su -c "netcfg rndis0 dhcp" 

    If it doesn't get the IP address, or if you are using some application that a static IP address is desirable like "Webkey for Android" App, then assign it manually:

    $ adb shell su -c "ifconfig rndis0 10.42.0.2 netmask 255.255.255.0" $ adb shell su -c "route add default gw 10.42.0.1 dev rndis0" 

Now internet would be working in the Android phone.

To check, at adb shell or android terminal, try the command ping www.google.com.

It works for me.

 
 
   
   
3
 
vote

Unrooted 设备

我知道这是一个迟到的答案,但随着所有现有答案建议,如果您的设备植被扎根或具有反向系列的系统支持,则只有USB反向系列,我仍然值得指出选项:

我正在寻找一个反向的系列解决方案,它将在我的大型设备上工作,并用MacBook工作,但我只是找不到任何东西。最终,我开始开发自己的解决方案。结果是一个适用于在客户端的Android 4.0或更高版本的设备上运行的应用程序,以及主机侧的所有主要桌面OSS。

reversetethetheping norooot应用程序

应用程序可在Google Play上获得: reversetetheter noroot

 

For unrooted devices

I know this is a late answer, but as all existing answers suggest that USB reverse tethering is only possible if either your device is rooted or has system support for reverse tethering, I though it'd be worth pointing out there's one more option:

I was looking for a reverse tethering solution that would work on my unrooted devices and with a MacBook, but I just could not find anything. Eventually, I started to develop my own solution. The result is an app that works on devices running Android 4.0 or higher on client side, and all major desktop OSs on the host side.

The ReverseTethering NoRoot app

The app is available on Google Play: ReverseTethering NoRoot

 
 
   
   

相关问题

2  如果我的笔记本电脑无法通过系列连接到互联网,我应该经过什么检查?  ( What checks should i go through if my laptop cant connect to the internet throu ) 
我需要通过智能手机通过智能手机将我的笔记本电脑连接到互联网,我正在使用带有Android 4.2.2的Galaxy GT-S7270,带Windows 7的笔记本电脑和带Windows 8的平板电脑。 每当我尝试使用WiFi热点时,我可以通过我的平板电脑连接和访问Internet,笔记本电脑连接到智能手机后获得有限...

0  Android系绳检测旁路不适用于三星Galaxy S8  ( Android tether detection bypass not working on samsung galaxy s8 ) 
我已经将Dun与 settings put global tether_dun_required 0 在我的Galaxy S8上设置了几个月,它很棒。在过去的几天里,它已经停止了工作,我不确定问题是什么。设备上的TTL设置为65,因此不应该是一个问题。我检查了DUN是否设置为0,其中 settings get glo...

5  如何在Jellybean设备上启用USB系列?  ( How do i enable usb tethering on a jellybean device ) 
JellyBean是否支持USB系绳? 是否有一种方法编译jb源,因此始终启用USB系绳? 我想通过操作系统拥有支持,而不是依赖于应用程序。 ...

13  当设备插入PC时,自动启用USB系列  ( Automatically enable usb tethering when device is plugged into a pc ) 
我在nexus 5上运行了Android棉花糖5.我通过USB将其定为我的笔记本电脑。有没有办法配置事物,以便在插入事物时自动发生USB系列? (接触USB系束度需要5-6次接触。) ...

2  如何在系列时限制数据下载  ( How to limit data download when tethering ) 
当我将Android Mobile连接到我的笔记本电脑时,我通过USB系列使用3G数据。我的笔记本电脑上的几个背景活动(赢8.1赢了),例如常规更新。这排出了每月包,分配的下载/上传限制无时间耗尽。 有没有办法监控系束缚连接和拒绝/块背景下载,任何文件大于5-10MB的文件? ...

132  如何在USB上设置反向系数?  ( How to set up reverse tethering over usb ) 
我的htc g2手机植根于植物和运行cyanogenmod 7 我没有数据计划。 有时我想在没有Wi-Fi的时候将手机连接到Internet,更新市场应用程序,将SMS消息备份到Gmail,从Gmail同步新联系人等。我不能用USB质量做的事情存储模式。 我有一个连接到互联网的Windows 7专业计算机,但我不...

85  如何通过USB电缆在Android手机上使用Windows Internet  ( How to use windows internet on android phone through usb cable ) 
我正在使用Android 4.4.2(在 micromax联合2 - A106 )。在家中我有一个Windows PC,具有高速宽带互联网连接。我没有无线路由器或接入点。我只想在手机上使用PC的Internet连接。我尝试了多种方法,但没有似乎工作。 方法1:使用本机Android 4.4.2选项 在我的手机中...

2  如何从WiFi Hotspot访问USB系扣设备?  ( How can i access usb tethered device from wifi hotspot ) 
所以我发现了USB系绳IP为192.168.52.x的艰难方式,WiFi地址为192.168.53.x。 我的目标是能够从WiFi访问USB系列设备(Raspberry PI),就像它是相同的网络一样。 如果我有特定的端口,那就没关系,但如果可能的话,我想避免这种情况。我找到了这个xda post 关于反向系列(共享...

1  互联网共享 - Ubuntu  ( Internet sharing ubuntu ) 
我有一个智能手机(来自本地制造商)。它有一个选择"通过USB电缆共享Windows PC Internet" 的"USB Internet" 。 我的第一个问题是我是否可以通过这个选项桥接我的Ubuntu Internet连接? 当我将手机连接到我的PC网络管理器时,显示一个新的以太网连接"有线连接2" ,其中包含名...

1  用root手动配置USB Tethering  ( Configuring usb tethering manually with root ) 
我已经用尽了以编程方式启用USB系列: service 方法在我的手机上不起作用(三星注4)。它似乎是某种保护的API,并从 adb 戳戳它没有效果。 shell input 方法不适用,因为它要求设备已解锁,并且似乎没有以编程方式和非破坏性解锁设备锁定的方式指纹。 所以,我正在寻找实现这个目标"...




© 2022 it.wenda123.org All Rights Reserved. 问答之家 版权所有