networking - Share Windows computer internet connection with Raspberry Pi

07
2014-07
  • Harlandraka

    I have a Raspberry Pi that can't have physical access to the router, but I have a PC that does.

    I would like to share internet connection from the PC to the Raspberry via the USB cable*, not via the ethernet cable, so that it receives both power and internet connection from the PC it is connected to.

    Is it possible?

    If yes, is there a way to make this connection look like a bridged connection, like virtualbox/vmware do? I would like to have a different IP address for the RPi.

    Thanks!

  • Answers
  • MariusMatutiae

    In Linux, support for Ethernet over USB is in-bult: there are the drivers cdc_ether and rndis. To the best of my knowledge, there is no such thing in Windows. However, you can buy an Ethernet over USB adapter, for something around 10 euros, and plug an ethernet able from that to the Windows pc. This way, Windows will see a connection over Ethernet, and Raspbian (which is a Linux distro, basically Debian for arm architectures) already has the proper driver for Ethernet over USB.

  • Jonny Wright

    I don't think it is natively supported by Windows but did find this very cool looking project on GitHub.

    https://github.com/mindboards/ev3dev/wiki/Setting-Up-Windows-USB-Ethernet-Networking

    I know its not intended for use with a Pi but could be an interesting little project. I think I may give it a go myself.


  • Related Question

    linux - How to share a folder as an USB mass storage device (from a raspberry pi)
  • Cerber

    I'd like to do something quite simple ... in my mind.

    I've got an "old" photo frame with an usb port and SD card slot (but without networking) that I would like to keep in sync with my NAS "Photo folder"

    Since I'm looking forward to buy a PI, I'd like to know how I could achieve this ... in a cheap way ($ and computing power).

    My main guess would be to connect both on USB.

    Looking at other answers I found Serve up PC hard drive as USB mass storage and What is a USB WiFi dongle device that can emulate virtual mass storage device for home video player? and on the PI board itself Emulate USB mass storage device

    So from what I found so far I have two options : an Host-to-Host USB cable or a Wifi-to-USB adapter (Both as expensive as the PI itself)

    The problem is that both device are Windows only and neither seem to allow to select a specific folder to share.

    Getting back to my goal, does any of you have an idea on how to to connect both on USB ?

    Bonus question : is there a way to do this multiple times on the same "server" to connect different folders to differents clients (other frames/radios/...) ?

    Thanks for the time spent reading my (long) question !


  • Related Answers
  • haimg

    Basically USB protocol requires one device to act as a Master, and others as Slaves. Master-master connections are not supported. Master devices typically have A-type connectors: computers, photo frames that support external USB media, etc. Slaves are your typical USB sticks, mice, etc. Master supplies power to slave over USB bus.

    To cloud the water, USB OTG specification allows devices that support it to behave both as a master and as a slave (some Android phones, etc.).

    Your photo frame is a master device, you need your Raspberry Pi acting as a slave. As far as I know, it is rather tricky, if possible at all: As a computer, Raspberry Pi supports USB master mode, but apparently USB slave mode also should be possible on some devices. Quoting the forum you mentioned in your question:

    The model B has a built in 2 port USB hub, which does not know how to act as a USB device. The model A directly connects the processor USB interface, which can be configured either as a USB device or USB host.

    Obviously, that won't work until people have Model A's to develop on, and someone has the talent, the time, the inclination, and the documentation, to write the device driver.

    Bit-banging a slow speed USB device over GPIO should be possible on the model B.

    This all will require some very significant hacking, many hours of programming/debugging time. In my opinion, waste of time.

    My suggestion: Throw out your photo frame, get some second-hand/cheap small LCD display, connect it to your Raspberry Pi and use it as a photo frame. Much easier, faster, etc.