SSH troubles


9 posts
by 6677 » Tue Jan 01, 2013 12:04 am
Right now its kinda awkward to use my pi sometimes and I think the ideal solution is to use SSH.

I connected it to my computer via ethernet cable straight into the back of my PC (windows 8 pro), other end in the pi. Now there is no bridging set up or anything, its just plain A-B. However IPconfig on windows doesnt list any IP address for the pi and on the pi "ip address show" just returns 127.0.0.1 and a bunch of what appear to be hex strings (looking at it, 6 sets of double digit). Yet when I try and connect putty to the pi on port 22 using that IP it returns "Network error: connection refused".

I am running raspbian wheezy 2012-10-28

on bootup there is a message about SSDH being opened which apparently is the SSH demon so it should work should it not?

I literally have no idea whats wrong.
Posts: 382
Joined: Wed Mar 14, 2012 9:23 pm
by pluggy » Tue Jan 01, 2013 12:14 am
The Pi and the Windows machine both need an ip address one way or another. The most straightforward way is to connect both machines to a router with DHCP. Failing that allocating static IP addresses to each machine (different but in the same subnet) will work. 127.0.0.1 is just a localhost IP address and doesn't work across a network.
Don't judge Linux by the Pi.......
User avatar
Posts: 2298
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK
by aTao » Tue Jan 01, 2013 12:27 am
When you connect 2 ethernet ports together directly instead of through a router/switch/hub you have to use a crossover cable, most network cables are straight.
Also you need to configure the port on one computer so it "understands" this connection. If I remember correctly Windows has an obvious setting for this something ,like "share this connection" for when one PC has an internet connection and one other one dosent.
>)))'><'(((<
User avatar
Posts: 439
Joined: Wed Dec 12, 2012 10:41 am
Location: Swine Town UK
by pluggy » Tue Jan 01, 2013 12:34 am
The Pi like most recent ethernet implementations is auto-sensing, so will work direct with either a straight or crossover cable.
Don't judge Linux by the Pi.......
User avatar
Posts: 2298
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK
by aTao » Tue Jan 01, 2013 1:16 am
pluggy wrote:The Pi like most recent ethernet implementations is auto-sensing, so will work direct with either a straight or crossover cable.


Well, what will "they" think of next. Thanks pluggy, I didnt know that.
>)))'><'(((<
User avatar
Posts: 439
Joined: Wed Dec 12, 2012 10:41 am
Location: Swine Town UK
by JustThisGuy » Tue Jan 01, 2013 1:45 am
You might try looking at http://elinux.org/RPi_Remote_Access.
Any conversation about a sufficiently complex subject is indistinguishable from babble.
Posts: 114
Joined: Thu Jan 05, 2012 11:22 pm
by 6677 » Tue Jan 01, 2013 12:01 pm
JustThisGuy wrote:You might try looking at http://elinux.org/RPi_Remote_Access.

thats what I was using already

Anyway, no idea why the pi wont connect to the desktop via ethernet, I do have both patch and crossover cables and neither one works but the pi happily connects to routers so I'll just have to dig an old one out maybe (or finally get it a wifi dongle of its own so it can connect to my main router). Even if the pi wasnt autosensing my desktop is. My laptop happily connects to the desktop by ethernet though so honestly I have no idea what is going on and probably never will.

I'll give it another shot later now that its on a router.
Posts: 382
Joined: Wed Mar 14, 2012 9:23 pm
by pluggy » Tue Jan 01, 2013 12:32 pm
Theres no chance of it connecting if both machines don't have an IP address in the same subnet, and by default without a DHCP server in the equation (like a router), theres nothing to give them one. SSH works straight off on recent Raspdian if you've got IP addresses that mean something. The most straight forward way of achieving it is to give each machine a static IP address. The gateway address needs to be set on the client end as well.

On the pi, this generally means editting the /etc/networking/interfaces file and on a Windoze box you need to butcher the IPV4 settings relating to the ethernet card buried in network configuration.

If you have a wireless internet connection on your Windows box its usually possible (but don't ask me where it is) to enable Internet sharing which sets up the windows box with a DCHP server which will then dole out an IP address to the Pi and set up the routing for it to be able to see the internet. As a by product it gets IP addresses onto both machines so you can use SSH or any other client/server protocols.

As I said earlier the gender (straight or crossover) of the cable is irrelevant, either will work. Pretty much all ethernet gear made in the last 5 years is auto-sensing and will switch it so it works itself. I have done this for real with a decade old PC (which isn't autosensing) and a Pi and it works. It only needs auto-sensing at one end.
Don't judge Linux by the Pi.......
User avatar
Posts: 2298
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK
by 6677 » Tue Jan 01, 2013 8:47 pm
well it worked fine connected to the router at my dads house today.

Its just my main router is downstairs with no screen nearby, only screens in the house at all are all big TV's and kinda impractical to move around, might have to see can I log into my wireless router and get an IP address for the pi from there or something.
Posts: 382
Joined: Wed Mar 14, 2012 9:23 pm