1.6. Connecting to Wi-Fi

The Vesta Gateway supports 802.11n on 2.4Ghz and 5.8GHz bands.

Wi-Fi may either be configured by an on-board application, or from the command line.

1.6.1. Setup Wi-Fi with the Wi-Fi configuration app

The IoT Gateway Setup feature will allow you to easily configure the Wi-Fi network on the Gateway using a simple web interface. This is useful when you cannot connect the Gateway to a local network using a standard Ethernet cable.

To enable the IoT Gateway Setup feature, follow these instructions:

  1. Supply power to the Rigado Gateway and wait for it to complete the booting process. The LED on top of the case will illuminate a solid green when the boot sequence has completed.

  2. Press and hold the button on top of the case until the LED starts to flash green, approximately 15 seconds. This indicates that the Gateway is being reconfigured as a Wi-Fi access point.

  3. Once the Gateway has been reconfigured, the LED will become a solid red. To connect to the Gateway, redirect your computer’s Wi-Fi network connection to:

    • SSID: Iot-Gateway-Setup
    • Password: none

    Note

    This may take a minute to become visible on your computer.

  4. After successfully connecting your computer to the IoT-Gateway-Setup access point, open your web browser and direct it to http://192.168.0.1:8000 and follow the on-screen instructions to complete the setup.

    ../_images/wifi-config-app.png

    Figure 1.1 The Wi-Fi configuration app

1.6.2. Setup Wi-Fi with the command line

First, log in to gain access to the Gateway.

1.6.2.1. Modifying the Config file

Wi-Fi can be set up by modifying the wpa_supplicant.conf file:

root@080030717-00055:~# vi /etc/wpa_supplicant.conf
  1. Delete the line:

    key_mgmt=NONE
    
  2. Add the following lines:

    ssid="GatewayTest"
    psk="password"
    

    Alternatively, you can run the wpa_passphrase command to generate a hash of the passphrase so it is not available in plain text:

    root@080030717-00055:~# wpa_passphrase <MYSSID> <passphrase> > /etc/wpa_supplicant.conf
    

    Example:

    root@080030717-00055:~# wpa_passphrase FreeWiFi isntreallyfree > /etc/wpa_supplicant.conf
    root@080030717-00055:~# cat /etc/wpa_supplicant.conf
    network={
         ssid="FreeWiFi"
         #psk="isntreallyfree"
         psk=3f3de609fcda4728e9ba60c99a94528aa324f267eaeb66275f6fe96d89f1d45f
    }
    

    Delete the #psk="<your-secret-passphrase>" if you want to reduce exposure.

1.6.2.2. Adding additional networks to the Config file

You can add more networks to the wpa_supplicant.conf file in the same format. Use >> instead of > if you want to add another with wpa_passphrase without overwriting the first.

1.6.2.3. Testing your connection

Now that you have a config file for the wireless network, you can test your connection by running the following commands from the command line:

root@080030717-00055:~# wpa_supplicant -Dnl80211 -iwlan0 -c/etc/wpa_supplicant.conf &
root@080030717-00055:~# udhcpc -i wlan0

You can verify that you have an IP address with ifconfig and you can check connectivity with a ping command.

1.6.2.4. Automatically connecting to Wi-Fi upon boot

The procedure outlined above works well for testing purposes, but you will probably want the system to automatically connect to Wi-Fi when booted.

Configure this in the /etc/network/interfaces file:

# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)

# The loopback interface
auto lo
iface lo inet loopback

# Wireless interfaces
auto wlan0
# allow-hotplug wlan0 alternative to auto, but requires a trigger after boot is complete
iface wlan0 inet dhcp
        wpa-driver nl80211
        wpa-conf /etc/wpa_supplicant.conf

# Wired or wireless interfaces
auto eth0
iface eth0 inet dhcp

With this in place, the system will attempt to connect the networking when it enters runlevel 5.