Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am working on passing through the internet from my computer to my phone (running Android) over USB. I'm not sure how to achieve this, but I know I will need a usb network interface, such as usb0. This interface is not automatically created when plugging in the phone.

How do I create this USB network interface? Can this be done within Linux or must it be done from the Android phone?

Note: If I enable USB tethering on the phone, then a corresponding USB interface is created in Linux. However this is automatically configured to use the phone as a network device (or a gateway?) and pass the internet from my phone to my computer, which is the opposite of what I'm trying to do.

share|improve this question
    
Are you done with this thing? Please, I was eagerly waiting for something like this in Linux/Unix! Please respond. – Am_I_Helpful Feb 19 '15 at 19:19
1  
@shekharsuman Unfortunately, I was never able to get this to work and have given up on it. – drs Feb 19 '15 at 19:21
    
@drs-Nevertheless, you tried at least such an awesome concept. You've provided me a very good project to work on. Really thanks. I'll start working on this coming June. THANKS A LOT. – Am_I_Helpful Feb 19 '15 at 19:23

Actually USB tethering creates a symmetric connection between your phone and PC. The direction your traffic can go is only defined by the network interface configuration and the services running on each side.

In order to let the traffic go from the phone to the PC, you could (for example):

  • configure your PC to run DHCP and share its internet connection
  • activate USB tethering on your android phone:
  • run a dhcp client on your android phone (as root):

netcfg usb0 dhcp

Or

dhclient usb0

Different phones may have different names for the interface, including rndis0, rmnet0 etc. Those can be discovered via ifconfig.

In case of problems, it may also be worth a try to load the g_ether kernel module on your phone manually.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.