Raspberry Pi 3 Starter Kit Hookup Guide

Pages
Contributors: MTaylor
Favorited Favorite 14

Configuring the Pi

This section goes over configuring the keyboard, wired, and wireless internet.

Configuring the Keyboard Layout

The Raspbian distribution comes defaulted to European hardware. With US keyboards, the " (quotation mark) symbol is replaced by @ (commercial at) and our number sign # is replaced by the European pound sign £. This can make it aggravating when trying to #define things. Invoke the config tool with "sudo raspi-config," and take the following actions:

  • Set the default locale for the system

    • Select "Internationalisation Options"
    • Select "Change Locale"
    • Deselect en_GB.UTF-8 UTF-8
    • Select en_US.UTF-8 UTF-8, (Ok)
    • Set default to en_US.UTF-8, (Ok)
  • Change the keyboard layout -- from the Internationalisation Options menu,

    • Change Keyboard Layout
    • Leave set as: Generic 105-key (Intl) PC (Ok)
    • Select Other (Ok)
    • Select English (US) (Ok)
    • Select English (US) (Ok)
    • Select default (Ok)
    • Select No compose key (Ok)
    • Set Ctrl+Alt+Bksp function (Ok)
  • Finish with the dialog and get back to the shell

    • Try the " and # keys at the prompt. It may be necessary to restart the pi at this point.

Configuring the Internet Interfaces

Automatic Configuration

Raspbian does a good job of configuring wireless networks automatically. By default, DHCP is configured so that the Pi will receive an IP address when a network cable is plugged it to the Ethernet port or when a wireless network is connected.

To use the graphical network tool, right click on the icon on the right side of the task bar, and click "WiFi Networks (dhcpcdui) Settings". Then, select the interface desired (wlan0 or eth0) to disable the DHCP and set your own IP, if necessary.

To connect to a wireless network, click on the icon, select the desired network, and enter the password.

Hovering over the icon will bring up a status of wlan0 and eth0 that also shows the IP address.

Manual (text-based) Configuration

At this time, the network configuration works out of the box so there's really nothing to configure, but in case something goes awry, here's the basics of what can be played with and a known-working configuration to compare with.

A configuration file, interfaces, configures both wired and wireless devices. Enter the following command into a terminal to edit the interfaces file.

language:bash
sudo nano /etc/network/interfaces

Replace "nano" with "leafpad" if you prefer graphics. Here's what our Pi 3 is using:

language:bash
# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

iface eth0 inet manual

allow-hotplug wlan0
iface wlan0 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

allow-hotplug wlan1
iface wlan1 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

By default, this file is set up to get its configuration from /etc/wpa_supplicant/wpa_supplicant.conf, which is really the proper place for wifi information. Here are the contents:

language:bash
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
        ssid="myNetworkSSID"
        psk="mySuperSecurePassword"
        key_mgmt=WPA-PSK
}
A note on network configuration: Try the gui tool first, and only modify the files as a last resort. If you find the tool doesn't work, save your configuration files as a backup, and don't be afraid to try your hand at a manual configuration.

Applying the Changes

Sometimes the link should be cycled for a new configuration to take. Rather than shutting down the pi and restarting, use 'ifdown' and 'ifup' to bring the link down and back up.

For wireless connections, use

sudo ifdown wlan0

and

sudo ifup wlan0

For wired connections, use

sudo ifdown eth0

and

sudo ifup eth0