flaghacker
Posts: 13
Joined: Thu Sep 15, 2016 3:47 pm

Share internet to RPi over USB

Sat Dec 17, 2016 9:50 pm

Hey guys!

I have a Windows 10 laptop connected to the internet, and I have a RPi zero connected to that laptop using a USB cable. Is it possible to share the network connection from my laptop to the RPi?

When I try to ping something this is the result:
Image

I have already tried to enable network sharing on the RPi ethernet adapter:
Image
But that doesn't work.

This is the result of "ip addr show":
Image
and I can ping that IP address "169.254.102.139" from my laptop. I can not ping my laptops' IP from the RPi though.

Do you guys have any ideas on how to solve this problem? If you need any more info, feel free to ask!

fruitoftheloom
Posts: 20493
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: Share internet to RPi over USB

Sat Dec 17, 2016 9:56 pm

flaghacker wrote: I have a Windows 10 laptop connected to the internet, and I have a RPi zero connected to that laptop using a USB cable. Is it possible to share the network connection from my laptop to the RPi?

Will not work as both USB Ports are Slaves, you will need to put the Raspberry Pi in Gadget (Master) Mode:

http://blog.gbaman.info/?p=791
Last edited by fruitoftheloom on Sat Dec 17, 2016 10:01 pm, edited 2 times in total.
Retired disgracefully.....

flaghacker
Posts: 13
Joined: Thu Sep 15, 2016 3:47 pm

Re: Share internet to RPi over USB

Sat Dec 17, 2016 10:01 pm

fruitoftheloom wrote:
flaghacker wrote:...

Will not work as both USB Ports are Slaves, you will need to put the Raspberry Pi in Gadget (Master) Mode:

http://blog.gbaman.info/?p=791
Yes I did that, I can successfully SSH into it.

drgeoff
Posts: 9759
Joined: Wed Jan 25, 2012 6:39 pm

Re: Share internet to RPi over USB

Sat Dec 17, 2016 10:01 pm

fruitoftheloom wrote: Will not work as both USB Ports are Slaves, you will need to put the Raspberry Pi in Gadget (Master) Mode:
USB ports on Windows PCs are always USB hosts (=masters). You need the RPI in Client mode (=gadget mode.)

fruitoftheloom
Posts: 20493
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: Share internet to RPi over USB

Sat Dec 17, 2016 10:02 pm

flaghacker wrote:
fruitoftheloom wrote:
flaghacker wrote:...

Will not work as both USB Ports are Slaves, you will need to put the Raspberry Pi in Gadget (Master) Mode:

http://blog.gbaman.info/?p=791
Yes I did that, I can successfully SSH into it.
The Windows Machine will then install a RNDIS Driver for the USB Network Interface and in Windows enable Internet Sharing and it should autmagically assign IP Addresses
Retired disgracefully.....

fruitoftheloom
Posts: 20493
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: Share internet to RPi over USB

Sat Dec 17, 2016 10:03 pm

drgeoff wrote:
fruitoftheloom wrote: Will not work as both USB Ports are Slaves, you will need to put the Raspberry Pi in Gadget (Master) Mode:
USB ports on Windows PCs are always USB hosts (=masters). You need the RPI in Client mode (=gadget mode.)
YES I GOT IT THE WRONG WAY ROUND, YET AGAIN :oops: :oops: :oops: :oops: :oops: :oops: :oops:
Retired disgracefully.....

drgeoff
Posts: 9759
Joined: Wed Jan 25, 2012 6:39 pm

Re: Share internet to RPi over USB

Sat Dec 17, 2016 10:04 pm

flaghacker wrote:
fruitoftheloom wrote:
flaghacker wrote:...

Will not work as both USB Ports are Slaves, you will need to put the Raspberry Pi in Gadget (Master) Mode:

http://blog.gbaman.info/?p=791
Yes I did that, I can successfully SSH into it.
Did you reboot the Zero AFTER setting up Internet Connection Sharing on the PC?

flaghacker
Posts: 13
Joined: Thu Sep 15, 2016 3:47 pm

Re: Share internet to RPi over USB

Sat Dec 17, 2016 10:09 pm

drgeoff wrote:
flaghacker wrote:...
Did you reboot the Zero AFTER setting up Internet Connection Sharing on the PC?
I think I did, but I just tried again to be sure. I still doesn't work.

fruitoftheloom
Posts: 20493
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: Share internet to RPi over USB

Sat Dec 17, 2016 10:15 pm

flaghacker wrote:
drgeoff wrote:
flaghacker wrote:...
Did you reboot the Zero AFTER setting up Internet Connection Sharing on the PC?
I think I did, but I just tried again to be sure. I still doesn't work.
Did you give the RPi Zero a static IP Address ?? it is probably easier to let Windows assign IP Addressing.......



Did you set up Windows Internet Connection Sharing correctly ?

Laptop WiFi - ICS - Laptop USB - USB Cable - RPi 0
Retired disgracefully.....

flaghacker
Posts: 13
Joined: Thu Sep 15, 2016 3:47 pm

Re: Share internet to RPi over USB

Sun Dec 18, 2016 8:38 pm

fruitoftheloom wrote: Did you give the RPi Zero a static IP Address ?? it is probably easier to let Windows assign IP Addressing.......
Where do I need to give it an IP address? I tried doing it in the network and sharing center for the Rapberry PI's Network adapter:

Image

But it still doesn't work. Do I need to set it in the RPi too? And if so, how?
fruitoftheloom wrote: Did you set up Windows Internet Connection Sharing correctly ?
Laptop WiFi - ICS - Laptop USB - USB Cable - RPi 0
Well I don't really know how to check it, and what do you mean with the "-" stuff?

recklessfb
Posts: 37
Joined: Wed Jul 06, 2016 12:26 am

Re: Share internet to RPi over USB

Sun Jan 01, 2017 6:07 pm

I was having the same problem. This is what did it for me. https://learn.adafruit.com/turning-your ... net-tweaks
As mentioned in the article adding those lines are very important.

Code: Select all

    auto lo usb0
    allow-hotplug usb0
    iface usb0 inet manual
Good luck.

Return to “Beginners”