Bridge Wifi to Raspberry Pi using Ethernet Cable
Asked Answered
R

2

8

I am not finding this question in SF history, which was a surprise, so I'll go ahead and ask it.

I am working on an IoT Raspberry Pi project with Windows 10 and need to connect it to the internet via an Ethernet/USB adapter. The adapter itself is made by Belkin. Using this, I can see an ip of 169.stuff get generated for my Pi, which is a private ip. I can deploy code to that from my connected box, however other devices are not able to reach it, and it is not able to make connections out to any servers.

I'm wondering if anybody knows how to bridge the connection.

I am attempting to use the new Azure IoT Hub and the SDK with this in case that makes any differences as that is not a simple rest interface and I believe is some form of socket connection.

Additional Notes: I have installed a DCHP Server and the Pi gets the ip address: 192.168.0.3 assigned to it. Unfortunately the Pi still can not ping external sites, such as google.com

Latest Discoveries: I am on a corporate box, which has internet sharing disabled by the system admin. Following these instructions: http://zizhujy.com/blog/post/2013/07/07/Solved-Internet-Connection-Sharing-has-been-disabled-by-the-Network-Administrator.aspx Fails. It shuts down all connectivity to my box and I cannot ping anything or reach the internet or anything.

Thanks, ~David

Regelate answered 2/11, 2015 at 17:13 Comment(0)
L
8

The 169 address means it isn’t getting a DHCP address assigned.

Since you don't have a router for the Ethernet, you can use Internet Connection Sharing, however we will need to run the following commands against the Pi to set a static IP, gateway, and dns server, since internet connection sharing botches this up a bit at times:

Set-Item WSMan:\localhost\Client\TrustedHosts -Value 192.168.137.2
Enter-PSSession -ComputerName 192.168.137.2 -Credential 192.168.137.2\Administrator

set-executionpolicy unrestricted

netsh int ip set address "Ethernet" static 192.168.137.2 255.255.255.0 192.168.137.1

netsh int ip set dns "Ethernet" static 8.8.8.8            
netsh interface ipv4 show config

set-executionpolicy remotesigned

You may need to reboot the Pi at this point then test pinging 8.8.8.8 and google.com to make sure resolution is working. You should be all set!

One other thing, if you have a group policy on the machine that is restricting Internet Connection Sharing then take a look at this article to fix the issue. Note if your organization is constantly sending down the policy then you may have to re-enable Internet Connection Sharing often which is aggravating but at least it will work. http://zizhujy.com/blog/post/2013/07/07/Solved-Internet-Connection-Sharing-has-been-disabled-by-the-Network-Administrator.aspx

Laveralavergne answered 5/11, 2015 at 21:28 Comment(0)
L
4

I do this by creating a DHCP server on my laptop and connecting the Pi directly to it. I followed these instructions to get it working:

  1. Download DHCP Server for Windows. It is a 100kB download.
  2. Go to the IPv4 properties page of the Ethernet adapter and set a fixed IP address, say 192.168.2.1
  3. Run the DHCP Server Wizard (downloaded above)
  4. Select the Ethernet adapter from the list shown
  5. Save the configuration file and start up the DHCP Server
  6. Click the 'Continue as tray app' button in the server control panel.
  7. Boot up the Raspberry Pi
  8. A popup notification shows the IP address assigned by the DHCP server to the Raspberry Pi.
  9. Use a SSH client, like PuTTy, to connect to the IP address shown

Hope this works!

Limy answered 2/11, 2015 at 23:34 Comment(2)
Appears to be having issues still reaching the outside network. I am able to ping from my local box, it has been assigned the ip address: 192.168.1.2 however it cannot establish an outside connection still. Perhaps I need some form of forwarding?Regelate
Set the gateway to the same ip address as the gateway on your computer NIC. I will try this again with mine and see what my settings were to get it to work.Limy

© 2022 - 2024 — McMap. All rights reserved.