Saturday, February 1, 2014

Connecting to Pi from Laptop's Ethernet Port

One of the aspects of Raspberry Pi that makes it incredible useful is its size. Due to its compact size, Pi can be used to provide computing power at locations where it would be impractical to locate a full desktop or laptop. Often the Pi is run as a headless unit, ie there is no monitor or keyboard connected to the Pi. All troubleshooting is done by connecting to the Pi over the network using SSH or any of the remote desktop protocols. However, there could be various scenarios, especially in outdoor projects, where there is no network connectivity. You still need to be able to connect to the Pi from a laptop for troubleshooting purposes. This post describes how you may connect to Pi from a Windows 7 laptop by connecting an ethernet cable from laptop's ethernet port to Pi's ethernet port. We utilize a feature of Windows 7 called we called internet connection sharing (ICS) to easily connect to the Pi. It is my understanding that internet connection sharing is a feature that is built into most linux desktop distributions and Mac OS. Therefore, you should be able to perform steps similar to the one described below, if you are attempting to connect to the Pi from a linux laptop and Mac OS.


Setup the Pi to run as a headless unit as described in Setting up truly portable Raspberry Pi System
A laptop with wireless network card and ethernet port

The true purpose of internet connection sharing is to share the internet connection of the laptop with a device connected through the ethernet port. We enable this feature so that your Windows 7 laptop will act as DHCP server and the Pi can automatically obtain an IP address from the Windows 7 laptop. The primary benefit of this approach is that one does not have to manually set any IP addresses or gateways on the laptop or the Pi. Therefore, this method is much less error prone. As an added bonus, the Pi also gets the share the internet connection of the laptop, if the laptop is connected to the internet through its wireless card.

Steps to enable internet connection sharing:

1) Connect the ethernet port of the laptop to the ethernet port of Raspberry Pi.
2) From the start menu on the laptop, search for "View Network Connections" and open it as shown below.

3) Atleast two network connections should be visible as below. One indicates you wireless network connection and the other indicates the ethernet connection. Right-click on the wireless network connection and select "properties".

4)  In the properties window, select the "Sharing" tab. Select both checkboxes, and click "OK".

5) Restart your laptop. Restarting is important as I have never got the internet sharing to work without restarting the laptop. The Pi will be automatically obtain an IP address from the DHCP server on the laptop upon restart.

In order to connect to the Pi using SSH, you need to know the IP address that is assigned to the Pi. You can easily find this out using the command

ping <hostname>

The default hostname of Raspberry Pi is "raspberrypi" . I have changed the hostname to "trasparent". See the IP address of the Pi received as a response to the ping command.

More details about finding the dynamically assigned IP address from any OS is described in the post Setting up truly portable Raspberry Pi System


Some users may have multiple network connections on your laptop. In that case you will have a drop down in the sharing tab of the wireless network connection. Make sure you select the Local Area Connection to which you have connected the Pi.

If you don't see the drop down or an incorrect connection is selected, you might have to uncheck the check boxes in sharing tab and restart and repeat the steps to see the drop down and select the right connection. 


  1. Thanks for an awesome guide! It worked perfectly and saved me many ours of work!
    I also learned a bit more about the possibilities in Windows (the network sharing is very smart!) and I love the fact that you have a bit of "troubleshooting" at the end, because the menu you describe in there is default in W8.1 Pro and not in W7, so it was nice not to be confused since you had already showed the answer to an upcoming question - perfect!
    Keep up the good work! :)

  2. Hi, very nice and simple tutorial. I tried this once on my own, i think the restart was the problem.

    Now i want to access the Windows pc's samba share. But i cannot find the hostname nor the ip. Do you have any clue how to access the windows PC?

  3. Hi, very nice tutorial!

    Do you know how to access the windows pc directly? I want to access the samba share and the hostname and the ip wont work. With normal wifi connected pi it does.

  4. yes it works ,but i m still not be able to access internet in rpi .can you help me to getting out of it ?? thanks in advance

  5. Hi I'm using usb dongle in ma laptop to connect it to internet.How I have to connect my raspberryPi to connect it to internet through laptop.
    I followed the above steps.But I'm getting like this "ping request could not find host raspberrypi. Please check the name and try it again".

    what I have to do?Please guide me to get into it.

    1. "ping request could not find host raspberrypi. Please check the name and try it again"

      Are you seeing this message when you try to ping raspberrypi from your windows laptop? Have you installed samba on your raspberrypi?

    2. Install samba using the command

      sudo apt-get install samba

    3. My RaspberrPi is not getting connected to internet itself ,then how can I install it?

    4. Okay I have very little information about your setup.
      1) Is your pi connected to a monitor and keyboard.
      2) If yes, find out the ip address that has been assigned to your pi.
      3) Also clarify when you see this message ""ping request could not find host raspberrypi"

    5. @krish - You could try ping
      This works fine for me. Although I have come across your question several months later, this might help someone else who comes across the same problem.

    6. @krish - Thank you so much. You helped me get over the hurdle with this, Really appreciate it!

  6. Hi,
    Nice tutorial.
    I installed everything on the Pi, plugged the pi into my laptop, enabled internet sharing as you described etc.
    I ping but nothing happens. I had a ping response when it was connected through the router.
    Any clue?

    Thanks in advance

  7. Could you connect your Pi to a monitor and verify that it is getting an IP from the windows machine.

  8. nope, i only have my laptop.

  9. Hi, I tried to enable internet sharing as you described it, but everytime I clicked 'ok' I got an error message:
    "The dependency service or the dependency group could not be started"

    Do you have any idea what is wrong?

    Thanks in advance :)

  10. Nice Information! I personally really appreciate your article. This is a great website. I will make sure that I stop back again!.
    Laptops South Africa 

  11. Hi, I tried the steps. The raspberry pi is getting a ip address. The ping test is also working. But the internet is not enabled in the raspberry pi. What could be the possible problem? I installed the raspbian via Noobs

  12. These ethernet cable can be found pre-prepared with fix length, However sometime these pre-made cables are of not the desired length and then we are required to prepare a custom length Cable.

  13. Stupid question - Does this method require putty to do this, or does something happen when you ping the Pi? The iP you get from the pinging process, is that what you would put in putty?

    1. You run ping from the windows command line. The IP that is returned from the pinging process should be entered in putty to connect to your PI

  14. I'm running windows 8, using an alienware alpha gaming computer, i can't find wireless network connection.. help?

  15. I am using Windows 10 now. How many connections do you see in your "Network Connections" window. Make sure your wireless card is enabled.

  16. Worked! Thanks! I have windows 10 and had no trouble. Then once you ssh into the Pi, you can sudo apt-get install tightvncserver and/or xrdp and then connect to the GUI using tightvncviewer downloaded on your PC, or by remote desktop connection.

  17. Thank you so much for this guide - After loosing a whole night's sleep trying all the other methods I found, I came across yours. It was 06h00 by now, so I bookmarked it, and at 09h00 I started following your instructions - By 09h15 the job was done.

    I about to go on a touring holiday, and have just remembered that my 2 x 4Tb USB Drives are not compatible with my lap-top [XP - Don't laugh...] Now taking the Pi and can transfer my entertainment to the L/Top and Tablets.

    Thanks again

    Fred F.

    1. Thanks for the kind words. I am glad it worked for you.