6

I have a Raspberry Pi directly connected to my Windows laptop through Ethernet, so I can make a SSH connection with PuTTy, everything works fine except that my Pi has no access to the internet.

Whenever I enable "Internet Connection Sharing" option on my Wi-Fi adapter of my laptop (Windows), my laptop immediately disconnects from my Pi and I will not be able to connect again. Unless I disable the "Internet Connection Sharing" option.

The operating system installed on my Pi is: Raspbian Wheezy, Kernel version: 3.12. I also have given my Raspberry Pi a static IP address by adding an IP address in the cmdline.txt file and also by adjusting the /etc/network/interfaces file.

My core questions is:

Why do I get a disconnected? and how can I get internet access on my Pi with direct Ethernet connection to my laptop?

  • 2
    Are you trying to use the same WiFi to connect to the Pi and internet? This won't work. Use Ethernet for one or the other. – Milliways Oct 1 '14 at 23:49
  • Valid point, didn't think of that. I was assuming that there would be two network adapters of the laptop be used. – Ghanima Oct 2 '14 at 9:07
  • It is possible I'm very sure about it, my classmates got it work, but for some reason it doesn't for me. – Kil'jaeden Oct 2 '14 at 20:43
  • @Kil'jaeden I know it is possible, but requires additional software and a sophisticated understanding of IP. It can't be done with ICS. This is NOT a question about the Pi, but Windows. – Milliways Oct 2 '14 at 23:46
4

If I am not wrong, your network setup is -

Router <--wifi--> Laptop(Windows 7) <--ethernet--> Raspberry-Pi

You need to share your windows 7 (wifi) connection to your Pi (ethernet) port. (http://www.dummies.com/how-to/content/how-to-share-an-internet-connection-in-windows-7.html)

and sometimes, your Raspberry Pi will not be able to get IP Address. If that happens,

Step 1

  1. Open Root Terminal.

  2. Try ifup eth0 or ifdown eth0

Still not getting an IP address,

Step 2

  1. Open Root Terminal.

  2. Enter cd /var/lib/dhcp (For other linux versions, it is cd /var/lib/dhcpd)

  3. Enter rm Filename. Filename will be dhclient.eth0.leases or something similar to that name. This command will remove the specified file. Warning : For step 3. Be sure to backup the file that you are going to delete.

  4. Reboot.

  • The sharing window requires you to specify your "home network connection" - I assume this is the network that is at the end of the pipe, receiving the new connection. When I go to the WIFI properties window and select ETHERNET as my "home network connection", putty can no longer connect, getting a "Network Error: Network Unreachable". When I flip them, opening the ETHERNET properties and selecting WIFI in the drop-down, my laptop loses internet connection, and my RPi remains without one as well. Any ideas? – snickers10m May 7 '15 at 7:11
1

I had the same problem. After lurking forums for quite some time, I found a solution in the comments of a blog post.

This has been reported to work for Windows 8, and it worked for me in Windows 7.

  1. Make sure that everything is in its original state (no changes in cmdline.txt [including not giving a static address to the Pi], no changes in interfaces, no changes in your Windows networks).

  2. Go to your Wireless Network properties, then check allow sharing. If there is a dropdown, select the Local Area Network which your Pi will connect to.

  3. If you check your Local Area Network properties, and IPv4 properties, you should see that it is using a fixed address, something like 192.168.137.1. Do not change this. In particular, do not check the dynamic address box.

  4. Power up your Raspberry and connect it via Ethernet to your computer. Give it a minute or two to be ready.

  5. Now you may be thinking, how will I connect to the Raspberry if I don't know its address? In Putty (or whatever you use for SSH) enter the address raspberrypi.mshome.net. You can also ping this address and you'll see that it translates to a regular address.

And that is all it took to have my Raspberry (Model B, Raspbian Wheezy) share the internet connection with my laptop, in headless mode.

0

You'll need to establish a so called "brigde" for the network adapters on your windows laptop - assuming you use different adapters for both tasks (say wifi at the laptop to connect to your home router and wired connection to connect to the RPi). How to do that depends on the windows you're using (specify to get more details) but could be looked up on the internet or microsoft's help center. But for any reasonable current windows this should be working out of the box.

0

Further to afsantos' answer and the comment suggesting the need to establish a bridge. The above suggestion worked flawlessly for me without a bridge. For the last couple of years now I have been connecting to my pi from a Windows 7 laptop using SSH/PuTTY after having set a static IP, 192.168.137.101, on the Pi and sharing the ethernet/LAN connection with my THREE braodband SIM. Note having set a static IP on the Pi. However, since upgrading to Windows 10 I have had problems with the ethernet cable knocking out my broadband connection. After logging into the Pi through the ethernet cable the broadband connection switches to 'NO INTERNET' and I cannot access the internet from either my laptop or update from the Pi. Unplug the ethernet cable and the after a few seconds the broadband switches back to the normal 'Internet access' and while losing access to the Pi I can now access the internet from my laptop.

Following the above advice and restoring the Pi to dhcp, pinging 'raspberrypi.mshome.net' from the laptop worked. Logging on to 'raspberrypi.mshome.net' through PuTTY also worked without knocking out the broadband internet connection and I could update/upgrade, e.t.c., from the Pi and access the internet from my laptop.

Note: If you plan to run multiple Pi's on the network you have to change the default hostname from 'raspberrypi' to something unique for each Pi. The name has to be changed in both /etc/hostname and /etc/hosts - then ping/SSH 'raspberrypi.mshome.net', 'raspberrypi-2.mshome.net', e.t.c.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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