Wednesday 29 March 2017

Connect Your Raspberry Pi to Wifi or Ethernet in Systemd OSs (when /etc/network/interfaces does not work)


NOTICE: THIS BLOG HAS MOVE TO GRAFT ROBOTICS BLOG PAGE, AS PART OF THE NEWLY FORMED GRAFT ROBOTICS COMPANY.

Getting your Raspberry Pi to connect to your local home network with wifi or ethernet by editing the file /etc/network/interfaces can be tricky, especially with the most recent operating systems using systemd. Assuming you have a fresh operating system using systemd, the following steps should get your Raspberry Pi connected to your home/local network using the files /etc/dhcpcd.conf and/or /etc/wpa_supplicant/wpa_supplicant.conf. If you are interested in a low cost solution for controlling a GoPro while attached to a drone, RC car, camera trap, or for a custom home project using a Raspberry Pi, check out our FREE GoPie software.

Ethernet

You will most likely only need to plug your ethernet cable between your Raspberry Pi and your home modem/router. The following steps are for configuring a static ip.
  1. open the file /etc/dhcpcd.conf
  2. at the end of the file add:

    interface eth0
    static ip_address=<your ip address>/<your bit mask number>
    static routers=<your gateway>
    static domain_name_servers=<your dns>

  3. Reboot to apply changes

An example:

interface eth0
static ip_address=192.168.1.164/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1 

where the bit mask number of 24 represents a subnet mask of 255.255.255.0. If you don't know how to calculate these numbers, then you can use a reference table. If your are connecting your pc/laptop directly to the pi via ethernet, then you won't need the last two line (gateway and dns details).

Wifi

The following steps will explain how to add the wifi details on to the Raspberry Pi. 
  1. open the file /etc/wpa_supplicant/wpa_supplicant.conf
  2. make the entire contents of the file as follows:

    ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
    update_config=1 network={
    ssid="your wifi name"
    psk="your wifi password"
    }

  3. reboot to apply changes

If these changes are too simplified for you, then you should consider reading a more detailed explanation.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home