jdwpv4
Posts: 3
Joined: Mon Apr 28, 2014 12:24 am

Connecting rPi to PC

Mon Apr 28, 2014 12:31 am

Good evening, I have a noob question.

I am trying to connect my rPi to my windows 7 laptop using a single network cable from the rPi's ethernet port to the laptop's ethernet port.

I know this can be done because I have seen it done, but I am not having success.

The IP address of my rPi is 192.168.0.2 I have Putty on the windows 7 laptop. I do putty, SSH, port 22, to that IP address, nothing. Times out.

I do ping to that IP address, nothing, cannot ping that address.

I unhook the network cable from my laptop and plug it in to an open port on my home network router and reboot the pi, and voila, now I can ping the address and SSH into the rPi.

But I want to be able to do it anywhere, not just at home where I have the router. Hence I want to eliminate the router from this equation.

Im told that you need a DHCP server on your laptop. I don't know what DHCP is or how it works, but I googled it and found a free program and downloaded and installed it and black box appeared on my screen for a half a second and then a new service appeared in my list of running services.

But no change to the ability to directly connect to the rPi.

Any suggestions?

Thank you
Josh

texy
Forum Moderator
Forum Moderator
Posts: 5161
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: Connecting rPi to PC

Mon Apr 28, 2014 6:54 am

Hi Josh and welcome to the forum.
First question is - how is the ip of the Pi set? How do you know that the ip is set to 192.168.0.2? Because thats what the router has set it to that doesn't mean
it will be set to that when you connect it to your laptop. I suspect that 192.168.0.2 has been set temporarily via DHCP by your router when it is connected to that, but as your laptop isn't running a DHCP server then it is not allocating an ip to the pi.
Of course I could have it wrong and you have manually set the pi to 192.168.0.2..........

Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

suicidal_orange
Posts: 217
Joined: Sun Mar 16, 2014 10:56 am

Re: Connecting rPi to PC

Mon Apr 28, 2014 7:09 am

Hi Josh

You need a slightly different cable to connect two computers instead of a computer and a router as the send and receive wires need switching - it's called a crossover cable :)

Then you will need to give both a static IP address; there's no point setting up a DHCP server when there are only two computers...

EDIT Or not - see below (thanks MrEngman :))
Last edited by suicidal_orange on Mon Apr 28, 2014 7:24 am, edited 3 times in total.

MrEngman
Posts: 3946
Joined: Fri Feb 03, 2012 2:17 pm
Location: Southampton, UK

Re: Connecting rPi to PC

Mon Apr 28, 2014 7:18 am

suicidal_orange wrote:Hi Josh

You need a slightly different cable to connect two computers instead of a computer and a router as the send and receive wires need switching - it's called a crossover cable :)

Then you will need to give both a static IP address; there's no point setting up a DHCP server when there are only two computers...
You do not need a crossover cable to connect a Pi to another computer. The Pi can automatically reconfigure to take care of the cable and connection.


MrEngman
Simplicity is a prerequisite for reliability. Edsger W. Dijkstra

Please post ALL technical questions on the forum. Please Do Not send private messages.

fruitoftheloom
Posts: 21593
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: Connecting rPi to PC

Mon Apr 28, 2014 7:23 am

jdwpv4 wrote:Good evening, I have a noob question.

I am trying to connect my rPi to my windows 7 laptop using a single network cable from the rPi's ethernet port to the laptop's ethernet port.

I know this can be done because I have seen it done, but I am not having success.

The IP address of my rPi is 192.168.0.2 I have Putty on the windows 7 laptop. I do putty, SSH, port 22, to that IP address, nothing. Times out.

I do ping to that IP address, nothing, cannot ping that address.

I unhook the network cable from my laptop and plug it in to an open port on my home network router and reboot the pi, and voila, now I can ping the address and SSH into the rPi.

But I want to be able to do it anywhere, not just at home where I have the router. Hence I want to eliminate the router from this equation.

Im told that you need a DHCP server on your laptop. I don't know what DHCP is or how it works, but I googled it and found a free program and downloaded and installed it and black box appeared on my screen for a half a second and then a new service appeared in my list of running services.

But no change to the ability to directly connect to the rPi.

Any suggestions?

Thank you
Josh
Windows 7 setup Internet Connection Sharing, this will assign 192.168.0.1 to the Laptop and it will run a basic DHCP server so when the cable is plugged in the Pi will be offered 192.168.0.2


http://windows.microsoft.com/en-gb/wind ... =windows-7
Retired disgracefully.....
......to a more gentile life !

skullbucks.in
Posts: 11
Joined: Sun Apr 27, 2014 11:55 am
Location: india
Contact: Website

Re: Connecting rPi to PC

Mon Apr 28, 2014 8:10 am

jdwpv4 wrote:Good evening, I have a noob question.

I am trying to connect my rPi to my windows 7 laptop using a single network cable from the rPi's ethernet port to the laptop's ethernet port.

I know this can be done because I have seen it done, but I am not having success.

The IP address of my rPi is 192.168.0.2 I have Putty on the windows 7 laptop. I do putty, SSH, port 22, to that IP address, nothing. Times out.

I do ping to that IP address, nothing, cannot ping that address.

I unhook the network cable from my laptop and plug it in to an open port on my home network router and reboot the pi, and voila, now I can ping the address and SSH into the rPi.

But I want to be able to do it anywhere, not just at home where I have the router. Hence I want to eliminate the router from this equation.

Im told that you need a DHCP server on your laptop. I don't know what DHCP is or how it works, but I googled it and found a free program and downloaded and installed it and black box appeared on my screen for a half a second and then a new service appeared in my list of running services.

But no change to the ability to directly connect to the rPi.

Any suggestions?

Thank you
Josh
follow these steps:
1:install putty in your pc
2:install xming in your pc
3:connect your raspberry pi to ur modem and power it up
4:go to login page of your modem and check for raspberry pi IP address
5open xming
6:open putty in ur pc and type in that IP address ,dont forget to enable X11 in ur putty settings
a window will pop out like command promt
login id as pi and password as raspberry
wait for while
$.......something like this will come then type startlxde and press enter wait for while
your xming will show u your raspberry pi desktopscreen

skullbucks.in
Posts: 11
Joined: Sun Apr 27, 2014 11:55 am
Location: india
Contact: Website

Re: Connecting rPi to PC

Mon Apr 28, 2014 8:23 am

jdwpv4 wrote:Good evening, I have a noob question.

I am trying to connect my rPi to my windows 7 laptop using a single network cable from the rPi's ethernet port to the laptop's ethernet port.

I know this can be done because I have seen it done, but I am not having success.

The IP address of my rPi is 192.168.0.2 I have Putty on the windows 7 laptop. I do putty, SSH, port 22, to that IP address, nothing. Times out.

I do ping to that IP address, nothing, cannot ping that address.

I unhook the network cable from my laptop and plug it in to an open port on my home network router and reboot the pi, and voila, now I can ping the address and SSH into the rPi.

But I want to be able to do it anywhere, not just at home where I have the router. Hence I want to eliminate the router from this equation.

Im told that you need a DHCP server on your laptop. I don't know what DHCP is or how it works, but I googled it and found a free program and downloaded and installed it and black box appeared on my screen for a half a second and then a new service appeared in my list of running services.

But no change to the ability to directly connect to the rPi.

Any suggestions?

Thank you
Josh
for using dhcp server
download it and install it in your pc
go to network adapter settings and set your ipv4 IP as 192.168.2.1 and subnet mask as 255.255.255.0
open your dhcp server program and set ip range in that as 192.168.2.100 to 192.168.2.110
go next
make sure you clicked on run server icon
then click on next and then finish
click on continue running server popout message
now connect your raspberry pi to ethernet port and power it up
you will gwt a ip popout in desktop screen
go to putty and type in that ip address and your r done
make sure you closed all your firewalls
any query ir full image tutorial write us (Mod edit: Keep support within the forum.)

jdwpv4
Posts: 3
Joined: Mon Apr 28, 2014 12:24 am

Re: Connecting rPi to PC

Tue Apr 29, 2014 2:45 pm

Hi, thank you. Sorry for the confusion. The IP is different when using the router. But I am able to tell what the IP is at any time because I also have the rPI hooked up to my TV via the HDMI cable and a USB keyboard for direct access.

I type /sbin/ifconfig and it tells me a bunch of stuff including the IP address.
The actual address is 192.168.0.2 when hooked up directly to my laptop
and 192.168.10.116 when hooked up to my router

Thanks
Josh
texy wrote:Hi Josh and welcome to the forum.
First question is - how is the ip of the Pi set? How do you know that the ip is set to 192.168.0.2? Because thats what the router has set it to that doesn't mean
it will be set to that when you connect it to your laptop. I suspect that 192.168.0.2 has been set temporarily via DHCP by your router when it is connected to that, but as your laptop isn't running a DHCP server then it is not allocating an ip to the pi.
Of course I could have it wrong and you have manually set the pi to 192.168.0.2..........

Texy

jdwpv4
Posts: 3
Joined: Mon Apr 28, 2014 12:24 am

Re: Connecting rPi to PC

Tue Apr 29, 2014 2:55 pm

Thank you to everyone for your time and especially to Fruitoftheloom who had the easiest solution.

I set up internet connection sharing and now the rPi receives its IP address from the laptop and the address is different than it was before. I can now SSH into it from the laptop. Yay!

The only thing that could make this better is how to set the IP up to always be the same so that I don't have to hook it up to a monitor to see what it is?

Thanks
Josh

Return to “Beginners”