Working out your Raspberry Pi’s IP address
Since we’ve got a console cable, it’s easy for us to find out our Raspberry Pi’s ip address by using the
ifconfig (interface config) command. This command lists all our Pi’s network ports (both wired and wireless).
en0is our ethernet port
wlan0is our Wi-Fi module
Run the command
ifconfig now and see your output.
This device has been given the IP: 192.168.3.19 by the wifi router.
If you do not see an inet address, your raspberry pi hasn’t connected to wifi successfully.
To only get our wlan’s IP address we use:
ifconfig wlan0 | grep -i inet
What’s that weird
| character you’re seeing and what is that
| symbol is known as the pipe character (and it’s found above your return key). On Linux we use the pipe symbol to pipe the output of one command into the input of another. E.g
program1 | program2 | program3. So in our example we’re taking the output of the
ifconfig command and sending it to
grep. The question then beckons, what’s this
Grep is a command-line utility for searching plain-text data sets for lines matching a regular expression. In layman’s terms it looks for a snippet of text (we call them strings) and outputs any match to the screen. The
-i flag or argument to grep tells it to ignore case. Lastly, the
inet section is the snippet of text we want to match, if you look at the output of
ifconfig you’ll notice that the ip addresses are on the line with the snippet
SSH on Mac or Linux
SSH-ing on Mac or Linux is easy. To SSH onto your Raspberry Pi use the command:
Whoa! What’s this? ‘Connection refused’? That’s correct, SSH access is disabled by default, and that’s a good thing, too. If that wasn’t the case, then, as soon as a new RPi appeared on a network, it could be accessed easily with the default login and password. (Speaking of which, let’s change that later on.)
Enabling SSH access
and you’ll see Setup Options. Select ‘8. Advanced Options’. Then select ‘A4 SSH Enable/Disable’ remote command line access to your Pi using SSH’. Finally, select ‘Enable’.
Press ‘ESC’ a few times until you’re back out in the command line. Now try to SSH again:
You may receive a message along the lines of:
The authenticity of host '10.0.1.9 (10.0.1.9)' can't be established. RSA key fingerprint is 64:4a:97:2d:4c:ff:3a:f3:8d:02:c0:e0:38:66:a1:0d. Are you sure you want to continue connecting (yes/no)?
Go ahead and answer yes by pressing the ‘Y’ key.
You’ll get prompted for a password, just use the same password raspberry as you did when logging in via the console cable.
SSH on Windows
SSH isn’t built into Windows, so you’ll need to use putty to connect.
- Select SSH, Enter your IP address and leave the port number at 22.
- If you get a security alert, click “Yes”.
- Enter pi as the username, and raspberry as the password.
Time for a sanity check! Let’s sanity check that you’re on the right Raspberry Pi by playing some audio out of the headset port