SSH Direct connection between Pi and Putty ie no router.


21 posts
by andrewstillie » Mon Oct 01, 2012 11:51 am
Hi there,

Is it possible to SSH into my Pi using putty and a single Ethernet connection between the Pi and my Laptop.

Does the Pi have a default IP address?

Thanks in advance.
Posts: 53
Joined: Tue Sep 18, 2012 11:26 am
by andrewstillie » Mon Oct 01, 2012 11:52 am
P.S.

Do I need a special type of Ethernet patch cable?
Posts: 53
Joined: Tue Sep 18, 2012 11:26 am
by RaTTuS » Mon Oct 01, 2012 11:58 am
you can do this - no special cable is needed as the RPI port will auto sense
you will have to setup a dhcp server or have Internet sharing setup on your laptop -
what OS are you using on your laptop
1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX - Prosliver FTW
"That's not right, the badgers have moved the goalposts."
User avatar
Posts: 4675
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
by malakai » Mon Oct 01, 2012 12:01 pm
Pi does not have a default IP address you could go static ip on both

http://wiki.debian.org/NetworkConfiguration#Configuring_the_interface_manually
http://www.raspians.com - always looking for content feel free to ask to have it posted. Or sign up and message me to become a contributor to the site. Raspians is not affiliated with the Raspberry Pi Foundation. (RPi's + You = Raspians)
User avatar
Posts: 1383
Joined: Sat Sep 15, 2012 10:35 am
by andrewstillie » Mon Oct 01, 2012 2:09 pm
RaTTuS wrote:you can do this - no special cable is needed as the RPI port will auto sense
you will have to setup a dhcp server or have Internet sharing setup on your laptop -
what OS are you using on your laptop


I am running Ubuntu on my Laptop, last night I installed Putty.

How do I setup DHCP server on Ubuntu or set Internet sharing?

Thanks.
Posts: 53
Joined: Tue Sep 18, 2012 11:26 am
by Mortimer » Mon Oct 01, 2012 2:20 pm
User avatar
Posts: 710
Joined: Sun Jun 10, 2012 3:57 pm
by andrewstillie » Mon Oct 01, 2012 2:24 pm
Posts: 53
Joined: Tue Sep 18, 2012 11:26 am
by pluggy » Mon Oct 01, 2012 2:27 pm
I wouldn't bother with putty on Ubuntu, the default operating system just does it. Just use

Code: Select all
ssh pi@192.168.1.23


at the command line. Adjust the IP address to suit obviously. You can also use 'Connect to server' in Nautilus (default file manager) and get a nice GUI to move files around and you can right click to edit them directly on your laptop. I always considered putty a workaround for less capable operating systems (Like Windoze ;) )

One way or another you need to get an IP address in the same subnet on both the Pi and the Laptop. I'd go for statics myself if the much easier router method wasn't an option.
Don't judge Linux by the Pi.......
User avatar
Posts: 2310
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK
by andrewstillie » Mon Oct 01, 2012 2:38 pm
Ok, from another angle - once I have DHCPserver configured will I also beable to connect directly over wifi?
Posts: 53
Joined: Tue Sep 18, 2012 11:26 am
by pluggy » Mon Oct 01, 2012 2:47 pm
Now you're getting complex, now you have to start getting involved in ad-hoc wifi networks on top of the IP address problem as well.

http://compnetworking.about.com/cs/wire ... reless.htm
Don't judge Linux by the Pi.......
User avatar
Posts: 2310
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK
by andrewstillie » Mon Oct 01, 2012 2:50 pm
Ok, I will attempt the wired implementation first.

(as you can probably guess I am quite new to all this!!)

Thank again.
Posts: 53
Joined: Tue Sep 18, 2012 11:26 am
by pluggy » Mon Oct 01, 2012 3:27 pm
If you're using Ubuntu on one machine and Raspbian on the Pi

Make the /etc/network/interfaces file match this on both machines :
Code: Select all
auto lo

iface lo inet loopback
#iface eth0 inet dhcp

# The primary network interface
auto eth0
iface eth0 inet static
  address 192.168.1.248
  netmask 255.255.255.0
  network 192.168.1.0
  broadcast 192.168.1.255
  gateway 192.168.1.1


On one of them, (the Pi for arguments sake), change the address line to

Code: Select all
address 192.168.1.249


Reboot both machines, connect 'em together with the ethernet cable and on the Laptop at the command line :

Code: Select all
ssh pi@192.168.1.249


Robert should be your uncle.........
Don't judge Linux by the Pi.......
User avatar
Posts: 2310
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK
by andrewstillie » Wed Oct 03, 2012 7:12 pm
thanks pluggy - that worked a treat!!!
Posts: 53
Joined: Tue Sep 18, 2012 11:26 am
by andrewstillie » Wed Oct 03, 2012 7:26 pm
ahhh..but now I get a failure when I run:
sudo apt-get update

Does the ssh connection not pass through my laptops connection to the internet?
Posts: 53
Joined: Tue Sep 18, 2012 11:26 am
by pluggy » Thu Oct 04, 2012 3:41 am
No.
How is your laptop configured to use the internet ?
Don't judge Linux by the Pi.......
User avatar
Posts: 2310
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK
by andrewstillie » Sat Oct 13, 2012 5:17 pm
Hi guys,

I have the following setup in my interfaces file on my host computer (not pi).

auto lo
iface lo inet loopback


iface lo inet loopback
#iface eth0 inet dhcp

# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.1.248
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1

I am able to connect to the Internet on the host ubuntu machine....but I get the following message when I try to SSH into the pi using
ssh pi@192.168.1.249

ssh: connect to host 192.168.1.249 port 22: No route to host
Posts: 53
Joined: Tue Sep 18, 2012 11:26 am
by pluggy » Sat Oct 13, 2012 5:28 pm
What changed since you said it worked ?

If your computer can see the intenet with those settings it suggests you have a router (or something very close to a router) at 192.168.1.1, so why not hook the Pi up to it as well ?
Don't judge Linux by the Pi.......
User avatar
Posts: 2310
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK
by jackokring » Sat Oct 13, 2012 6:00 pm
If the pi manages to get an IP address from a shared connection, in the IPv4 tab of the connection (on the combo box with automatic change type). It will inform the ubuntu laptop of it's host name.

Code: Select all
ssh -X pi@raspberrypi.local


Will connect and forward any X calls (you must not startx on the pi, sshd will forward as ssh does the smart thing with the -X option). In this way you do not have to find the IP address. If some other device is working as the dhcp server, the .local cache will not be updated until you have used the IP of the pi.
Pi=B256R0USB CL4SD8GB Raspbian Stock. https://sites.google.com/site/rubikcompression/strictly-long https://dl.dropboxusercontent.com/u/1615413/Own%20Work/Leptronics.pdf https://groups.google.com/forum/#!topic/comp.compression/t22ct_BKi9w
User avatar
Posts: 784
Joined: Tue Jul 31, 2012 8:27 am
Location: London, UK
by andrewstillie » Sat Oct 13, 2012 7:32 pm
Nice one...
Posts: 53
Joined: Tue Sep 18, 2012 11:26 am
by andrewstillie » Sun Oct 14, 2012 11:10 am
Ok - I have now got the RaspberryPi pluged into the router and I have Internet access on my Host Ubuntu machine. I can SSH into the Pi using 192.168.1.249 or I can connect the wifi dongle to the Pi and this allows me to SSH into the Pi over wifi using 192.168.1.69.

My next step was to install proftpd.

sudo apt-get install proftpd

Running this gives the following...

Code: Select all
sudo apt-get install proftpd
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'proftpd-basic' instead of 'proftpd'
The following extra packages will be installed:
  libfile-copy-recursive-perl update-inetd
Suggested packages:
  openbsd-inetd inet-superserver proftpd-doc proftpd-mod-ldap
  proftpd-mod-mysql proftpd-mod-odbc proftpd-mod-pgsql proftpd-mod-sqlite
The following NEW packages will be installed:
  libfile-copy-recursive-perl proftpd-basic update-inetd
0 upgraded, 3 newly installed, 0 to remove and 6 not upgraded.
Need to get 2,553 kB of archives.
After this operation, 4,227 kB of additional disk space will be used.
Do you want to continue [Y/n]? Y
WARNING: The following packages cannot be authenticated!
  libfile-copy-recursive-perl update-inetd proftpd-basic
Install these packages without verification [y/N]? y
Err http://mirrordirector.raspbian.org/raspbian/ wheezy/main libfile-copy-recursive-perl all 0.38-1
  Could not connect to mirrordirector.raspbian.org:80 (89.16.177.202). - connect (113: No route to host)
Err http://mirrordirector.raspbian.org/raspbian/ wheezy/main update-inetd all 4.43
  Unable to connect to mirrordirector.raspbian.org:http:
Err http://mirrordirector.raspbian.org/raspbian/ wheezy/main proftpd-basic armhf 1.3.4a-2
  Unable to connect to mirrordirector.raspbian.org:http:
Failed to fetch http://mirrordirector.raspbian.org/raspbian/pool/main/libf/libfile-copy-recursive-perl/libfile-copy-recursive-perl_0.38-1_all.deb  Could not connect to mirrordirector.raspbian.org:80 (89.16.177.202). - connect (113: No route to host)
Failed to fetch http://mirrordirector.raspbian.org/raspbian/pool/main/u/update-inetd/update-inetd_4.43_all.deb  Unable to connect to mirrordirector.raspbian.org:http:
Failed to fetch http://mirrordirector.raspbian.org/raspbian/pool/main/p/proftpd-dfsg/proftpd-basic_1.3.4a-2_armhf.deb  Unable to connect to mirrordirector.raspbian.org:http:
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?


Any ideas?
Posts: 53
Joined: Tue Sep 18, 2012 11:26 am
by pluggy » Mon Oct 15, 2012 3:43 pm
The suggestion in the last line :

E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

usually works (with sudo).
Don't judge Linux by the Pi.......
User avatar
Posts: 2310
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK