Introduction: Direct Network Connection Between Windows PC and Raspberry Pi

Here's a simple method to connect to your Raspberry Pi through SSH from a Microsoft Windows based PC or Laptop.

All you need is :

1. A Windows based machine with an Ethernet adapter
2. An Ethernet cable (a normal patch cord or a crossover cable - both work)
3. A Raspberry Pi Model B

Unlike most of the other methods described online, you do not need to :

1. Use an Ethernet or WiFi router
2. Have a monitor or any display connected to the Raspberry Pi
3. Have a keyboard connected to the Raspberry Pi
4. Edit any files on the Raspberry Pi's SD Card


Here's how to proceed.

1. Download DHCP Server for Windows. It is a 100kB download available here.
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

Voila ! You are connected to your Raspberry Pi.

Comments

author
OscarHace (author)2017-03-24

Hello,

After a lot of trials, this way of connecting raspberry pi and my laptop works for me. I do not know the details of dhcp, or how to do it manually on windows 7 , but it works. Thank you for sharing the info.

Thank you very much for the info.

author
JaroslavK (author)2015-04-13

Is there some limitation causing that I'm not able to connect my RPiB+ over patchcord (directly connected to laptop) USING FIXED IP ADDRESS?

I wanted RPiB+ to use fixed IP address instead of DHCP, so I set it; now it works when RPiB+ is connected to my local LAN over switch (and router), but when I connect it directly to my laptop (with accordingly changed IP address of laptop), it does not work!? I have already tried a lot of possibilities, but still no ping...

Does RPiB+ remember previous MAC address of router, so after connecting laptop with other MAC address it refuses to connect? Or something else? Thanks for any idea... #J

author
TheFireMan (author)JaroslavK2016-10-07

An older thread, but I'm posting some info for those who are reading this.

"Does RPiB+ remember previous MAC address of router,"

Simple home-type switches and routers do NOT use MAC or IP addresses.

author
FedorG (author)2016-07-05

Needed to disable firewall for ethernet connections and only then my B+ connected.

author
ObaidallahE (author)2016-04-29

Thanks a ton

author
AadarshK (author)2015-11-14

can i also share pc internet on my pi via this method

author
nasser3 (author)2015-09-17

what if my rasberrypi runs a windows 10 IOT??

author
Alan_M_Knight (author)2015-07-11

I have followed your instructions but get the following error:

"Network error: Connection refused", when I try to run PuTTy.

Please help.

Thanks

Alan

author
Alan_M_Knight (author)2015-07-10

Tried this but DHCP server still disabled & unable to obtain status from DHCP server.

Any ideas ?

Alan

author
Pri_de (author)2015-05-10

Thanks for the help :)

author
knielen (author)2015-04-28

yay, thanks for the tutorial, after some attempts I got it running

author
Mark Chambers (author)2015-03-17

Fantastic start! Some extra info:

You can connect the R.Pi to the internet by adding some routing info like this:

  • sudo ip route delete default dev eth0
  • sudo ip route add default via <windows box ip address>
  • author
    h3manth (author)2013-12-23

    Its fine till step 7, but I did not get any pop-up notification. I've tried it twice and checked everything.How do I get it to work?

    author
    nprasan (author)h3manth2013-12-23

    hi h3manth, i'm not sure why the pop-up notification is not coming up. when selecting the ethernet adapter while installing the dhcp server, ensure that it shows the IP address you configured previously. If it is showing 0.0.0.0 next to the ethernet adapter, it may cause a problem.

    author
    bhulsey1 (author)nprasan2014-07-13

    The IP address is showing 0.0.0.0 in the dhcp server, and you're right, it's causing a problem. I don't ever get a pop up. As far as I can tell I have my local area connection ipv4 set up correctly according to your video. I've tried several different IPs but it just keeps showing 0.0.0.0. How do I fix this?

    author
    ealston (author)bhulsey12014-10-25

    Hello bhulsey1,

    Did you get your problem solved. I am having the same problem. If you did get this fixed, could you tell me what you did?

    author
    WeijianL (author)ealston2015-03-11

    Hi

    i experienced the same issue too. However, once i tried booting up the Rpi and connecting it to the laptop via the ethernet cable, then followed by setting up of DHPC wiz, the problem is gone.

    Hope that helps the rest who are experiencing the 0.0.0.0 issue.

    author
    NeelimaS (author)2015-02-23

    thank you!! worked for me ... as my raspberry pi address was in different network and my laptop was connected to different network, I had to set the gateway address equal to the ip assigned by dhcp to my laptop .

    author
    PriyaG (author)2015-02-19

    sir if i connect my raspberry pi to router of my pc with ethernet cable and use the steps of this in my pc will this post help me?

    author
    AlonsoS1 (author)2015-02-17

    Thanks! It works perfect.

    author
    laser_dude (author)2015-01-04

    This is a fantastic article. Thanks! By the way, I also had a problem getting the pop-up. I had to disable the Windows firewall by going to firewall properties, and under the public profile, there is a button for 'protected network connections'. I unchecked the local ethernet connection, and it worked. Also, when you run the DHCP Server wizard, you can check the 'HTTP Protocol' in the configuration. This allows you to see what connections the DHCP Server has assigned by going to 127.0.0.1 in your browser.

    author
    vishruth.kumar (author)2015-01-01

    please help me!!!..I'm getting a afatal error saying connection timed out. Tried it several times and even checked my firewall, still no improvement,

    author
    vishruth.kumar (author)2015-01-01

    hello

    ive got a fatal error..."conection timed out". Tried it 50 times, but no improvement Please help me out.

    author
    navneetcsgowda (author)2014-12-07

    can i use b+ model

    author
    jakes4 (author)navneetcsgowda2014-12-24

    yes.

    author
    shriyash.warghade (author)2014-12-18

    Worked With B+....... Thanks

    author
    ŁukaszS (author)2014-11-07

    Thanks for helpfull explanation

    author
    nprasan (author)ŁukaszS2014-11-24

    Thank you LukaszS !

    author
    erwxyz (author)2014-10-02

    Hey, Nice Instructable.

    My Problem only comes in the end. After running PuTTY and entering the IP address assinged,the terminal is opened. but after about 20s, I get a "Network error: Connection timed out"
    Please help asap!
    thank you

    author
    nprasan (author)erwxyz2014-10-09

    Hey, thanks !

    The issue you are facing could possibly be due to a faulty ethernet cable or an improper configuration of either the Pi or the PC's firewall. First, ensure that your network cable is working (It should preferably be a straight patch cable and not a crossover cable). If the cable is fine, try checking the PC's firewall settings. Good luck!

    author
    IkaA (author)2014-08-02

    hi i really need helping to connect my raspberry to internet conection. i use ssh for display rpi. i want sharing internet conection from the laptop to rpi with utp cable. my laptop conect to internet with wifi tethering form my handphone. internet was successfull to access lan adapter from sharing conection. but why if i want to update in my raspberry always failed. thanks for read my question. sorry if my english not over good. please for answered :)

    author
    anki_dao (author)2014-05-23

    Everything work fine until the end, Putty give me a fatal error: Network error: Connection Refused. What does that mean?

    author
    nprasan (author)anki_dao2014-05-25

    The error means that it is able to reach the Pi over the network but the Pi is refusing the incoming connection. Either the ssh service is not running on the Pi or it is not properly configured. Ensure that the ssh service is up and running on the Pi.

    author
    anki_dao (author)nprasan2014-05-25

    How do I know if the ssh service is up and running on the Pi? Do I have to do anything with my raspberry pi other than boot it up?

    author
    Hassan Shafiq (author)2014-05-11

    Works Ok..

    But I have a question...I am running a solution in c++ over Raspberry that requires to send data to the Host computer through Sockets...I am passing the address 192.168.2.1..but it gets stuck on Connect() call...any body got any ideas what i am doing wrong...

    author
    nprasan (author)Hassan Shafiq2014-05-11

    Hi Hassan,

    Try disabling the Windows Firewall. Windows classifies the network connection as a Public Network by default and the firewall may be blocking your Sockets request.

    Good luck !

    -nprasan

    author
    vishal_r (author)2014-04-10

    It works perfect! I do have a question that how to connect to internet via the internet connection of the PC through this Ethernet? Thank you

    author
    nprasan (author)vishal_r2014-04-10

    Hi vishal,

    It should be possible to share an internet connection using a proxy server program on your PC/Laptop. The full version of Connectify is capable of doing this, but unfortunately it is paid. But, there should be free equivalents that will do the trick.

    author
    krishnaprajeeth (author)2014-03-04

    Works perfectly!!!!

    Thank you :)

    author
    nprasan (author)krishnaprajeeth2014-03-16

    You are welcome !

    author
    WDHBGS (author)2014-03-16

    Hi, i have a notebook with wireless internet connection. It all works, but i don't have internet connection anymore. The gateway is 192.168.1.1. Can you help me, please?

    author
    nprasan (author)WDHBGS2014-03-16

    Hi,
    If you use the same IP address range for your wired and wireless connection, it may result in your internet getting screwed up. If your wireless internet is using an IP address in the 192.168.1.x range, use an IP address in another range, say 192.168.5.x or something for the wired connection. That might help.
    Good luck!

    author
    Treth (author)2013-12-01

    This sounds great.
    I'm new to the Raspberry Pi and often don't have access to the TV!
    Can I just confirm that with this arrangement I can then develop and run code on the RaspPi directly from my laptop, i.e. use the laptop display, key board and mouse?

    author
    nprasan (author)Treth2013-12-01

    Hi Treth, With this arrangement you can develop and run code on the RaspPi using your laptop display and keyboard. Do note that this is limited to editing and running code from a terminal. You cannot actually view the video output of the Pi, say like a video playing. You can program as well as run code in a terminal - thats it. I hope I was clear.

    author
    raokk (author)nprasan2013-12-03

    Is there any possibility of building a " TV tuner cord" with this " Raspberry Pi ".
    We are having Digital TV signals and a Monitor. How to build that ? you can try & inform me. kkrao22@gmail.com

    author
    nprasan (author)raokk2013-12-03

    Hi raokk, It should be possible to view Digital TV signals using Raspberry Pi. You can use a USB TV Tuner or a USB DVB-T receiver with the Raspberry Pi to do this. A list of compatible devices are available at http://elinux.org/RPi_VerifiedPeripherals#USB_TV_Tuners_and_DVB_devices

    author
    Treth (author)nprasan2013-12-01

    Thanks for fast reply.
    I shall investigate further, with your nicely detailed project.
    You just received my vote.

    author
    nprasan (author)Treth2013-12-02

    Thanks Treth ! Good luck for your RaspPi projects.

    About This Instructable

    136,893views

    113favorites

    License:

    Bio: Engineer. Educator. Entrepreneur.
    More by nprasan:Generating Lissajous Figures using a PC/Laptop Sound CardUse your Windows Phone device as a Wireless MicrophoneUse your smartphone mic with your PC
    Add instructable to: