Is it possible to SSH in to an RPi without a network connection?

I could imagine that you could do it using a LAN cable from the computer to the RPi or maybe using a USB cable.

I do actually have access to a network, however it doesn't allow incoming connections (even from local IP's) to any ports except 80 and 443 I would imagine.

  • 3
    Just use a crossover cable, I guess that that is the solution you need ;). Connect all cables in the UTP cable like this: numitechsolutions.com/wp-content/uploads/2012/01/… then connect it with your PI and PC. Give them an IP, done ;). – Laurence Dec 7 '12 at 13:41
  • Regarding the connectiong process, there is a great article: Raspberry Pi Remote Connections – Without A Network!. It explains both Mac and Windows laptop configuaration. – Tomáš Zato Jun 19 '14 at 19:30
  • 1
    With modern Ethernet adapters, crossover is no longer needed. On a Windows box, just 'share' your WIFI network connection (open adapter properties, sharing) with your LAN. The RPI will get IP address from there. This will give you SSH access from the Windows box to your RPi but not external access. – fcm Mar 3 '16 at 13:46
  • As fcm comments crossover cables are mostly a thing of the past now; contemporary ethernet interfaces including those on the pi will physically cross-over themselves when plugged together. – goldilocks Oct 28 '16 at 7:33
  • I just stuck with this problem also and now I can do it. So I need to share my solution. You can see as this link, topboxbox.blogspot.com/2017/11/… – TopBoxBox Nov 18 '17 at 18:56

Regular Ethernet cable + RPI 2 + Raspbian Jessie Lite 2017-04-10 + Ubuntu 18.04 host

Link the Ethernet cable from your laptop directly to the Pi:

On Ubuntu 17.04 to work around this bug as mentioned on this answer you first need:

sudo apt-get install dnsmasq-base

Then open the network manager:

nm-connection-editor

And go:

  1. + sign (Add a new connection)
  2. Ethernet
  3. Create
  4. IPv4 Settings
  5. Method: Shared to other computers
  6. Set a good name for it
  7. Save

enter image description here

Find the IP of the Pi on host:

cat /var/lib/misc/dnsmasq.leases

outputs something like:

1532204957 b8:27:eb:0c:1f:69 10.42.0.160 raspberrypi 01:b8:27:eb:0c:1f:69

10.42.0.160 is the IP, then as usual:

ssh pi@10.42.0.160

I also have the following in my .bashrc:

piip() ( cat /var/lib/misc/dnsmasq.leases | cut -d ' ' -f 3; )
pissh() ( sshpass -p raspberry ssh "pi@$(piip)"; )

From inside the Pi, notice that it can access the internet normally through your host's other interfaces:

ping google.com

For example on my laptop, the Pi takes up the Ethernet, but the host is also connected to the internet through WiFi.

The crossover cable is not required if the host network card supports Auto MDI-X. This is the case for most recent hardware, including for example the 2012 Lenovo T430 I tested with, which has an "Intel® 82579LM Gigabit Network Connection" which documents support for Auto MDI-X.

Now you can also:

This is a more concise version of: http://www.interlockroc.org/2012/12/06/raspberry-pi-macgyver/ which was mentioned by: https://raspberrypi.stackexchange.com/a/4294/33424

Serial to USB cable

Another alternative if you just want to get a shell on the Pi, is to use a serial cable.

This does not use SSH or networking itself, but rather the older, simpler, more direct, more reliable, lower bandwidth, lower distance serial interface. The Pi won't have access to the Internet with this method.

You just need a cheap serial to USB connector like this one: https://thepihut.com/products/adafruit-usb-to-ttl-serial-cable-debug-console-cable-for-raspberry-pi

Then, you attach the sockets to the corresponding GPIO serial pins (TX, RX, 5V and ground) as documented at: https://www.raspberrypi.org/documentation/usage/gpio/README.md

Finally, plug the USB side of the connector to your host computer, and get a shell with:

sudo apt install screen
sudo usermod -a -G dialout $USER
screen /dev/ttyUSB0 115200

Exit with Ctrl-A \.

Desktop computers still have a serial port which you can connect directly wire to wire with the Pi, but these are hidden in most laptops, and then we need the USB adaptor, see also: https://unix.stackexchange.com/questions/307390/what-is-the-difference-between-ttys0-ttyusb0-and-ttyama0-in-linux/367882#367882

Here is a video by Adafruit showing it: https://www.youtube.com/watch?v=zUBPeoLW16Q

You can easily do it by connecting your pi to laptop via LAN cable. Please make sure that (at list while you are doing it first time) you have dhcp server working on your laptop and listening on LAN interface you are using to connect with pi. You need somehow assign address to raspberry.

  • You don't need dhcp. – Laurence Dec 7 '12 at 13:44
  • 1
    If you have IP configured statically you don't have to. If not you need something to give you an IP address. – codewarrior Dec 7 '12 at 14:14

For me, the most convenient way is to use USB Tethering on my Android device, connect it to the raspberry and then SSH from my phone to the raspberry.

see this post SSH from Android to rPI using USB?

The problem is that you want to connect 2 devices of the same type. But it's still possible. You can use a Crossover cable for this (Method 1), or you could use a switch or hub to automatic make a crossover connection (Method 2). Or just use a simple router (Method 3).

Make a connection possible

Method1:

Use a Crossover cable and connect your PC and PI:

An Ethernet crossover cable is a type of Ethernet cable used to connect computing devices together directly. Normal straight through or patch cables were used to connect from a host network interface controller (a computer or similar device) to a network switch, hub or router. A cable with connections that "cross over" was used to connect two devices of the same type: two hosts or two switches to each other. Owing to the inclusion of Auto-MDIX capability.

You need to connect the cables in the UTP cable like this: http://www.incentre.net/wp-content/uploads/2015/02/ethcablerj45cr.gif

Source: http://en.wikipedia.org/wiki/Ethernet_crossover_cable

Method2:

You also can use a modern twisted pair Ethernet cable to connect to your PI. But you need a hub or switch for this:

connections can be made with a straight-through cable by means of an MDI-X port, also known as an "internal crossover" or "embedded crossover" connection. Hub and switch ports with such internal crossovers are usually labelled as such, with "uplink" or "X". For example, 3Com usually labels their ports 1X, 2X, and so on. In some cases a button is provided to allow a port to act as either a normal or an uplink port.

Source: http://en.wikipedia.org/wiki/Ethernet_over_twisted_pair

More information:

Introduced in 1998, this made the distinction between uplink and normal ports and manual selector switches on older hubs and switches obsolete. If one or both of two connected devices has the automatic MDI/MDI-X configuration feature there is no need for crossover cables. Although Auto-MDIX was specified as an optional feature in the 1000BASE-T standard, in practice it is implemented widely on most interfaces. Besides the eventually agreed upon Automatic MDI/MDI-X, this feature may also be referred to by various vendor-specific terms including: Auto uplink and trade, Universal Cable Recognition and Auto Sensing.

Source: http://en.wikipedia.org/wiki/Ethernet_crossover_cable

Method 3

Use a Router and connect both the PI and PC to the Router.

Make the connection

Give them both an IP in the same range, for example:

PC: 192.168.1.10 Subnet: 255.255.255.0
PI: 192.168.1.11 Subnet: 255.255.255.0

You can find here how to do this: http://www.cyberciti.biz/faq/linux-configure-a-static-ip-address-tutorial/

Enable SSH

http://steve.dynedge.co.uk/2012/05/29/enabling-ssh-on-debian-raspberry-pi/

Connect to the PI

On Windows use for example Putty.

Other method:

You also can look here: http://www.linux-usb.org/usbnet/

  • How does method 2 work? Don't I need an active network connection on my computer? – Tyilo Dec 7 '12 at 14:01
  • I didn't finished that part jet. Give me 1 sec. – Laurence Dec 7 '12 at 14:07
  • 4
    I thought that the time when people have to use crossover cables gone forever :) Right now each and every new ethernet card is able to do crossing without the need of having crossover cable. – codewarrior Dec 8 '12 at 15:06
  • You never know what kind of PC he has, besides that, you always can try a UTP cable. – Laurence Dec 9 '12 at 16:12
  • Normal straight Ethernet cables work on PI 2, read somewhere that its interface can recognize that. Just tested on Ubuntu 16.04, RPI 2 Raspbian 2016.05. – Ciro Santilli 新疆改造中心 六四事件 法轮功 Aug 22 '16 at 18:29

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.