如何在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

 
 
   
   

相关问题

3  为什么我本田飞行员不支持三星Galaxy S(Captivate)USB?  ( Why is samsung galaxy s captivate usb not supported in my honda pilot ) 
关于如何解决"不支持的USB" 错误我的车辆(本田飞行员)在通过USB插孔连接电话(Galaxy S Captivate)时显示"USB" 错误? 提前感谢! ...

9  如何使用Android设备作为蓝牙USB DONGLE?  ( How to use an android device as bluetooth usb dongle ) 
有没有办法将我的Android设备用作蓝牙USB加密狗,而不会扎根于它? ...

5  是否有可能在连接到USB时防止屏幕锁定  ( Is it possible to prevent the screen from locking while connected to the usb ) 
一般来说,当手机上有一个USB电缆时,它不在我的口袋里,所以屏幕锁定对我没有任何用途,我想禁用它。 ...

24  您可以将USB设备连接到Android手机吗?  ( Can you connect usb devices to an android phone ) 
我有一个htc的愿望,并希望将USB设备连接到它,例如外部USB拇指驱动器传输文件或USB键盘。 这一点是可能的吗? ...

0  Android Studio 3在Ubuntu 17.04中没有看到连接设备中的Nexus 7运行应用程序  ( Android studio 3 in ubuntu 17 04 not see nexus 7 in connected devices to run the ) 
我在Ubuntu 17.04和Nexus 7中使用了Android Studio 3.1.1。 Android Studio未在窗口中的"连接设备" 列表中未查看设备以运行应用程序: 设备已被激活为具有MTP USB类型的调试USB,并且我已经选择"确定" ,以便每次提示都要求与PC连接USB连接。 它在连接...

7  最佳Linux发行版安装到SD卡用作PC的USB-Bootloader?  ( Optimal linux distro to install to sd card to use as usb bootloader for pc ) 
许多人在USB驱动器上安装基于Linux的发行版,主要是基本的PC故障排除。有没有人尝试在他们的Android手机的SD卡上安装这样的东西?这样,而不是携带一个USB驱动器和手机,可以简单地插入手机,从USB启动PC,并设置关于执行任何必要的行动。有没有人对最适合这项任务的Linux的特定口味有任何建议? ...

3  如何通过USB在Android中将文件复制到Micro SD中?  ( How to copy a file into micro sd via usb in android ) 
如何将文件复制到通过USB连接到带有Windows的PC的Android手机的Micro SD? ...

2  三星平板电脑一直要求在通过USB插入PC时允许数据访问  ( Samsung tablet keeps asking to allow data access when plugging to pc by usb ) 
我不能通过USB访问平板电脑上的数据,因为当我插入时,它会导致对话框允许访问,当我选择允许时,对话框再次弹出,依此类推。 这是三星Galaxy Tab A,我的电脑在Ubuntu上。 更新:在一些测试之后,我确定如果当我通过USB将平板电脑插入PC时,平板电脑屏幕打开,它可以正常工作。但是,如果我用屏幕插上平板电...

1  Android 6.0.1(rooted)阻止WiFi连接的USB系列(载体没有问题)  ( Android 6 0 1 rooted blocking usb tethering of wifi connection carrier has no ) 
我知道有许多关于类似主题的问题,但我相信我的问题是不同的,让我解释: 我在西班牙,运营商确实允许USB连接WiFi连接(手机连接到WiFi网络,我想通过USB连接到我的笔记本电脑,所以笔记本电脑使用WiFi连接电话)。我知道这是可能的,因为在我的三星Galaxy笔记1上使用Android 4.4我可以做到,没问题。 ...

7  每次我通过USB插入我的手机,它会自动安装SD卡  ( Every time i plug in my phone via usb it automatically mounts the sd card ) 
我有一个motorla droid运行cm6(基本上是Android 2.2)。我通过USB连接到Windows 7机器。每次通过USB插入手机时,它会自动将SD卡安装为外部存储。 如何停止这种行为?我在启动时没有真正注意到,我安装了cm6后的某个时候? ...

13  我可以将我的Android设备转换为网络摄像头吗?  ( Can i turn my android device into a webcam ) 
如果是这样,怎么样?可以通过USB,蓝牙或Wi-Fi连接来实现吗? ...

7  如何在全尺寸键盘中键入短信?  ( How to type sms in a full sized keyboard ) 
我必须发送短信的唯一方法是通过我的Android手机,因为我没有GSM / 3G调制解调器。 我想用我的桌面的键盘键入那些SMSES。 是否有任何应用程序,可以通过蓝牙或USB电缆键入Android设备中的键盘和击键键,并通过蓝牙或USB电缆? ...

3  我可以用我的Android TouchPad推出USB网络摄像头吗?  ( Can i drive a usb webcam with my android touchpad ) 
我有一个Android触摸板和USB网络摄像头...我可以使用垫控制网络摄像头吗? ...

29  转移巨大文件的最快方法是两个Android供电设备的推移?  ( What is the fastest way to transfer huge files beween two android powered device ) 
在两个Android供电设备之间传输巨大文件(例如500MB)的最快方法是什么?蓝牙? WiFi Direct?光束?或许USB On-Go? ...

1  通过OTG和2个USB相机是立体视觉吗?  ( Is stereoscopic vision via otg and 2 usb cameras possible ) 
我正在考虑通过使用通过OTG(C型)连接到我的Android手机的USB摄像机进行立体夜视设备。我已经测试了1个USB相机和来自播放商店的一些VR应用程序,这是成功的。 如果通过USB分离器/某种枢纽连接到相同的OTG电缆,则将2个摄像机工作?有没有办法(或应用)以在屏幕的一半上显示一个相机和另一个相机的另一个相机?...




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


Licensed under cc by-sa 3.0 with attribution required.