-
Notifications
You must be signed in to change notification settings - Fork 2
2. Connecting to your RPi
You'll use SSH to connect to your Raspberry Pi from your computer. This enables you to access the command line of a Raspberry Pi from another computer or device on the same network.
By default, SSH is disabled on a new RPi installation, but if you've completed all previous steps, you should have enabled it in the Preferences
screen. If not, go check Enable SSH on the first page.
First off, you'll have to make sure that the Raspberry Pi and the computer you are using are connected to the same network. This can be a wifi network or a mobile hotspot on your smartphone.
Connecting to a network is probably easiest in desktop mode, when a monitor is attached to the RPi. However, when preparing a network connection to e.g. a personal hotspot, it might prove useful to configure all network settings in advance in 'SSH-mode'. Changes to network configuration (WiFi passwords etc.) can be done manually with
nano /etc/wpa_supplicant/wpa_supplicant.conf
More info about the wpa_supplicant
file
Once your laptop and the RPi are on the same network, connecting to the RPi with SSH is easy:
ssh <username>@<raspberrypi-IP>
So, this could look like this:
The username should be known. This could be pi
, rttf
or some other name you chose while configuring the RPi.
Now you'll need to determine which IP your Raspberry Pi is using. There are several options available to do this.
If you have a screen connected to your RPi:
- Turn on your Raspberry Pi, and make sure it's connected to a network.
- Open a terminal on your Pi.
- Enter the command
hostname -I
in the terminal. - Your Pi's IP address is the first part of the output: it will contain four numbers separated by periods, e.g. like so: 192. xx. x.x. This is the IP you're looking for.
You can try pinging the RPi. ping
sends a small package to a given device in the network, to which it will respond if it's available.
ping raspberrypi
If it responds, you'll see the RPi's IP in the output. There is no guarantee that the RPi will respond, though, so you might have to resort to the next step.
You can use a network mapping tool to find the IP of your RPi. This will be a bit more tricky.
- Install nmap on your computer, using
sudo apt install nmap
- Find your local IP address:
hostname -I
- Let's say your IP address is
192.168.1.45
. We know that the subnet range is192.168.1.0/24
. Just swap out the last number with 0/24 to get your subnet range. Using 0/24 is the equivalent to saying it ranges from 1 to 255. - Now, we'll scan the subnet range for devices that respond to a ping call, using the
nmap
tool:
sudo nmap -sn 192.168.1.0/24
- In the resulting list, you'll be able to see the devices in the network range that respond to a
ping
call. Trace down your RPi in this list and you'll see the IP address that was assigned to it.
MAC Address: B8:27:EB:EA:E0:D4 (Raspberry Pi Foundation)
Nmap scan report for 192.168.0.174
More info and a complete guide, including other operating systems
If you successfully connected to your RPi, let's get going and install all the necessary software on the RPi. Check out this page for a detailed description.
© Race to the Future 2023 - by PXL-Digital, VOKA Young & Strong & Corda Campus