After having setup the Raspberry Pi to work in headless mode directly without installing anything on it as described in this post, we then tinkered on to share WiFi internet connection with the Raspberry Pi through the LAN/Ethernet connection which we established in our earlier post.


What you want to do:

  1. Share PC/Laptop’s WiFi internet connection with Raspberry Pi through LAN/Ethernet connected to Raspberry Pi

What you have:

  1. Raspberry Pi running the latest Raspbian Wheezy
  2. PC/Laptop with WiFi Internet connection and a Ethernet Jack (LAN Connector / RJ45)
  3. A working SSH connection with Raspberry Pi (direct access, explained here)

What you don’t have:

  1. Display Device for the Raspberry Pi (HDMI enabled display unit / Old TV)
  2. Direct Internet connection for the Raspberry Pi (LAN or WiFi)

Extra Stuff you need:

  1. Standard Network Cable (Cat 5, Standard or Crossover)
  2. PutTTY Software (will be used to SSH into the Pi)
  3. SD Card Writer

Edit: 2nd Jan, 2015. Video Tutorial Added:



A large part of this post assumes you’ve read the earlier post on directly accessing the shell on Raspberry Pi through a Ethernet/LAN connection. In this post, we’ll go about setting up the Raspberry Pi to access internet through the Ras-Pi’s Ethernet/LAN port from a Laptop/PC’s shared WiFi connection.



  1. Firstly, enable the WiFi adapter of the PC/Laptop and make sure it’s connected to a WiFi hotpspot. Open any Internet Browser and confirm internet access by opening any website.


Note: I’m using my Android device (Nexus One) configured as a WiFi hotspot J

  1. Now, go to Network and Sharing Center (Network Settings in Win XP) and then head to the Change Adapter Settings page. As shown below, we’re connected to ‘Wireless Network Connection’ on ‘Android 4’. Do remember the ‘Local Area Connection’ to which we’ll eventually share this connection


  1. Now, right click the above Network → Properties and then select the Sharing tab


  1. From the drop down list, choose ‘Local Area Connection’ and enable both the checkboxes and hit OK. Once done, head back to the Adapter Settings page and you should now see the Shared info message on the Wireless Network Connection



  1. Now, right click ‘Local Area Connection’ → Properties and then select Internet Protocol Version 4 and then click the Properties Button


Once the properties tab pops up, make sure that the ‘Obtain IP address automatically’ checkbox is selected. If not, check it and hit OK


  1. Now, power up the Raspberry Pi (making sure that the Ras-Pi and the Laptop/PC are connected to each other through the LAN/Ethernet cable) and wait a minute or two while the Ras-Pi boots. Now, repeat step 5 (previous one) to make sure ‘Obtain IP Address Automatically’ is still checked.
  2. Open up command prompt using the hotkey Windows Key + R and then typing in cmd or simply keying in cmd in the start menu (Win 7)
  3. In the command prompt, key in ipconfig and scroll to the top of the info shown


Note the IPv4 address which is in this example. Please make a note of what you see as this will be required further.

  1. Now, power off the Raspberry Pi and plug the Ras-Pi’s SD card into a card reader and connect it to the PC. Once the disk opens up, open the cmdline.txt file in any editor



You’d probably have an entry as ip= which we set up in our previous post

  1. Now, to this entry, append the IPv4 which we got earlier preceded by two colons as shown below:


where the first half is the static IP for Raspberry Pi ( and the other half is the IP of the IPV4 or Ethernet Adapter ( which we obtained earlier.

  1. Save this file and plug the SD card back into the Raspberry Pi. Power up the Raspberry Pi and wait for a min or two. Establishg a direct SSH connection with the Raspberry Pi as explained in the previous post.
  2. Now, to verify if our Ras-Pi is Internet-Connected, type in this command in the Shell (PuTTY terminal connected to the Ras-Pi)


and you should see response from the servers as shown below:


Voila!!! Your Raspberry Pi is now connected to the World Wide Web 🙂

  1. Going one step further, lets direct access the Raspberry Pi’s desktop and open up the midori browser. Verify Internet connectivity on the Ras-Pi by opening any website


Please let me your feedback or questions through comments.

Thanks 🙂




anthonyvenable110 · August 12, 2013 at 10:41 AM

Reblogged this on anthonyvenable110.

Valentino Shoes · August 20, 2013 at 3:40 PM

I enjoy what you guys tend to be up too. Such clever work and reporting! Keep up the fantastic works guys I’ve included you guys to our blogroll.

Chiheb · October 1, 2013 at 8:51 PM

Hi there !
I’m new to RPi, and I managed to connect my laptop to the Pi in headless mode (with direct SSH through the ethernet cable), but I couldn’t connect it to the internet, although I followed your indications. I always get the ping error “ping: unknow host name”. What can I do to fix that ?

Thanks ! 🙂

DavidM · February 22, 2014 at 1:56 AM

If you are having trouble accessing the sharing tab options on your wireless connection try enabling the microsoft virtual wifi adapter. Look at this instructable:

The command I used was:
netsh wlan set hostednetwork mode=allow ssid=yourssidname

Just replace yourssidname with whatever name you want the virtual wlan to be. The name was important to me. It wouldn’t work without it.

Thanks for the tutorial!!

    anwaarullah · February 24, 2014 at 5:28 AM

    Thanks David for sharing that.

irawan · May 13, 2014 at 11:17 AM

Hello Anwar
You have written perfect tutorials for us.
I’m very thankfull for your efforts.
I have followed your tutorials on direct connected Rasp Pi to computer via ethernet cable, it all work seamlessly.
However I’d like to have Rasp Pi’s independent internet connection via wifi (connected direct to wifi router, instead connected to computer via internet connection sharing), while in the same time the rasp pi also can be accessed via ethernet cable to computer.
So, the idea is that the rasp pi has its own wifi adapter, its own power (not depends to computer usb’s) thus after the computer executes rasp pi command (example: downloading a large file), user can then shut down the computer while the rasp pi keep downloading the file because it has it own internet connection and its own power.
Can we do that? How is the internet/ ipv4 thing setup?

Thanks in advance

    anwaarullah · May 16, 2014 at 12:28 AM

    If you’d like to have the Pi connect to the Router, you may use a USB WiFi dongle and have it setup using wicd-curses utility on the Pi. I’ve not tried a simultaneous connection on WiFi and Direct Access Lan; However, what I’ve tried is connecting the Pi to the Router via WiFi and LAN at the same time. You can then connect your Computer to the same network and schedule large file downloads.

Shekhar Menon · January 15, 2015 at 7:57 PM

success thank you very much 🙂

    anwaarullah · January 15, 2015 at 8:56 PM

    Glad it helped 🙂

Detlef Meyer · March 23, 2015 at 9:56 PM

Thanks for the explanation. Much better than to install additional software on the
Windows Laptop.
A note: Windows has changed the Ethernetadapter to static after sharing the Internetconnection of the WLAN.
So I had to change the cmdline.txt and take the new address.

    anwaarullah · March 23, 2015 at 10:08 PM

    Yep, Windows sometimes assigns a static IP after WLAN interconnection. Instead of again changing the cmdline.txt file, you can plan at simply changing the adapter settings back to Obtain IP Automatically.

nijeesh · July 17, 2015 at 10:19 PM

i got a little problem here
my local area connection cable is said to unplugged even if i have connected it
when i connect my rpi it connects to Ethernet

    anwaarullah · July 17, 2015 at 10:26 PM

    Can you please try with a different LAN Cable? Do you see those LAN lights on the Pi Blinking?

logan · September 24, 2015 at 4:42 AM

I dont have a drop-down list in the sharing tab, i completed the tutorial up until using ping, and the response is unknown host

    anwaarullah · September 24, 2015 at 4:45 AM

    I also faced this issue recently but don’t remember why it occurred and what I did to resolve it 🙁 Do you have admin rights on your PC?

    logan · September 24, 2015 at 4:45 AM

    I am also running windows 10

      anwaarullah · September 24, 2015 at 4:46 AM

      Hmmm. I haven’t moved to Win 10 yet so can’t debug it at my end. Can you try bridging the connections instead of sharing them?

      logan · September 24, 2015 at 4:47 AM

      i have admin rights

        anwaarullah · September 24, 2015 at 4:51 AM

        Have you made sure that the Obtain IP Automatically radio button in the LANs Network Setting is set to Automatic after enabling the Share feature of the WiFi adapter?

          logan · September 24, 2015 at 5:06 AM

          yes, the radio is set to obtain the ip automaticly

Muddassir · October 4, 2016 at 3:29 PM

When i connect my raspberry pi3 with raspbian jessie with pixel installed on my sd card to the laptop via ethernet, there is no detection of network. However, if i edit the cmd.txt file and add an ip address like, only then i can see unidentified network on my laptop. However whenever i try to use it to access putty.I’m unable to do so..Could you please help me in this?

Muddassir · October 4, 2016 at 4:13 PM

Whenever i install the raspbian jessie with pixel or raspbian jessie 2016/5/27 on my sd card, put it in the raspberry pi 3 and connect ethernet from my laptop to rpi3, do sharing from wireless to local area connection, the laptop does not even locate that there is a local area connection. If i modify the cmd.txt file from the sd card by adding for example, then after rebooting there is unidentified network which i can see from my connections. However even after i go to local area connection and go to ipv4 and set it to and subnet mask is automatic as, whenever i want to connect to rpi via putty, it is not working. Also i noticed that the subnet mask for wireless and local area network is not same. However whenever i run my previous microsd card having raspbian jessie 2016/5/27 which i did before, it has no problem to login via putty. So i presume that the error here is not linked to the subnet mask.Could anyone please help me out with setting this up?

Raspberry pie – getting started with Arduino | Yapale blog – finally code examples are working · March 28, 2015 at 2:16 PM

[…] 3. For networking : if you dont have wifi dongle for PI , you can use your windows internet sharing :… […]

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *