How to connect directly to a Raspberry Pi without Internet

The versatility of Raspberry Pi means that at some point you may have to use it outside or out of range of wireless networks. So how can you use it without plugging in the keyboard and screen?

The versatility of Raspberry Pi means that at some point you can use it outdoors or out of wireless network connectivity. So how can you use it without plugging in the keyboard and screen?

There will be external power requirements to do this (unless you use a dedicated and portable Pi touch screen).

A better solution is to connect via another device, such as a notebook. Although direct connection via Wi-Fi is not currently supported by Raspberry Pi, you still have two options for SSH connection directly without a wireless network.

How to connect directly to a Raspberry Pi without Internet

  1. When you can use wireless connection
  2. Connect to your Raspberry Pi via Ethernet
  3. Say Bonjour!
  4. Connect your PC to the Raspberry Pi Zero via USB
  5. Two reliable direct connections

When you can use wireless connection

Wireless connection with Raspberry Pi, whether connected via Ethernet to the router or not, is definitely more convenient. It is almost certainly the preferred choice, whether you're at home, at school or at an event.

However, this is not always ideal for every situation.

How to connect directly to a Raspberry Pi without Internet Picture 1How to connect directly to a Raspberry Pi without Internet Picture 1

For example, if you are using your Pi with the camera module, you may want to take it out to take some photos. If you don't have a wireless network to connect to your Pi via SSH, you'll need a different solution, one that will work via PC or possibly a mobile device.

This is the time for direct connection. You have two reliable options here: Ethernet and USB.

Connect to your Raspberry Pi via Ethernet

The most obvious option for such a connection is through an Ethernet cable. All Raspberry Pi computers have Ethernet ports, making this option work best.

To do this, you will need:

  1. Raspberry Pi (Type B, B +, 2, or 3).
  2. New Raspbian installation (for best results).
  3. Micro USB cable and power supply.
  4. Micro SD card.
  5. Ethernet cable, with RJ45 connector at each end.

Standard Ethernet cables are the best in this case, because Raspberry Pi can reconfigure ports. Previously, a cable would be used to connect two computers, but that's not necessary here.

You will need to set up Pi to accept the SSH connection. This feature is not enabled by default, but there are two ways to activate it.

  1. Boot with keyboard and screen to activate SSH via raspi-config.
  2. Insert the SD card into your computer, browse to / boot and create an empty file called ssh. (This file is detected by the Raspbian operating system at startup, and is considered a guide to enabling SSH.)

Everything you need to connect to Pi via SSH is now available. All you need is the device's IP address. You can find this by connecting to your router (usually 192.168.0.1, but you will need to recheck the router to find the correct IP) or by starting Pi with the keyboard and screen, then enter:

 ifconfig 

You will need to check if Pi starts correctly and SSH is working properly, before continuing.

When you have checked the Pi boot and wireless operation via the router nothing is wrong, turn off the device.

 sudo shutdown 

Now, connect your Raspberry Pi to your PC with an Ethernet cable.

Say Bonjour!

To do this, you will need a specific software: Bonjour Zeroconf. This Apple software is a device that identifies network devices and is preinstalled in MacOS. Windows users can install Bonjour Print Services v2.0.2 from the Apple website.

With this setting and connecting the cable directly to the Pi has been set up, once this small computer is powered on and started completely, you will be able to connect to it.

However, you should be patient. First, Pi fetches the IP address from the DHCP server. If it fails, the IP address will default to 169.254.xx You may also find it helpful to switch your PC or laptop to Airplane mode, to make sure there is no confusion. Other devices on the network. When IP is assigned, Bonjour will set the domain address .local .

After a short time, just open your SSH tool and connect to raspberrypi.local (or pi@raspberrypi.local), with the default password "raspberry".

Windows users may need to force the operating system to give up the IP address assigned to the router. This is quite easy, by opening the Command Prompt and typing:

 ipconfig / renew 

This will select a random private IP within 169.254.xx

Connect your PC to the Raspberry Pi Zero via USB

If you have a Raspberry Pi Zero, you can also connect it directly to the USB port of a PC or laptop, although this also requires Bonjour on Windows and Mac or avahi-daemon on Linux (avahi-daemon preinstalled with Ubuntu).

How to connect directly to a Raspberry Pi without Internet Picture 2How to connect directly to a Raspberry Pi without Internet Picture 2

Start with a new copy of Raspbian Jessie or Raspbian Jessie Lite on your SD card. Before inserting it into your Pi Zero, use the file explorer to find the boot partition and find the file config.txt. Open in text editor (such as Notepad on Windows) and scroll down to the bottom. At the end, add:

 dtoverlay = dwc2 

Once you've done this, save and close the file, then find and open the cmdline.txt file . Find 'rootwait' and insert it immediately:

 load-modules = dwc2, g_ether 

Make sure they are on the same line and separated by spaces, as shown below:

How to connect directly to a Raspberry Pi without Internet Picture 3How to connect directly to a Raspberry Pi without Internet Picture 3

Save and close, then push the microSD card out. You can then insert it into the Raspberry Pi Zero and connect it to your PC before starting the device. Connection must be via USB port.

Use the raspberrypi.local as the address in your SSH software (again, you can also try pi@raspberrypi.local if using the Linux command line). Note that you may need to turn off the wireless network if you have any other Raspberry Pi on your home network. This will ensure you connect Pi Zero via USB port.

If you encounter any problems, try switching your USB cable.

Two reliable direct connections

It would be great to be able to connect via Bluetooth or wirelessly connect from a mobile device - perhaps Android or iOS - and while this is theoretically possible, it is currently not supported. Although there are some accounts that work with either of these methods, it is not really reliable.

If you have any questions, please let us know in the comment section below!

Good luck!

See more:

  1. How to connect Raspberry Pi remotely to a Windows computer
  2. 5 great apps that make your Raspberry Pi really useful
  3. 20 great applications from micro-Raspberry Pi computers
4.3 ★ | 13 Vote