Filter results by

Wi-Fi Client

This article explains how to configure and use Wi-Fi® as the client of an external Wi-Fi access point (such as a home gateway-router). Setting up your ARTIK system as a Wi-Fi client is prerequisite to most of the development work you will do.

Configuring Wi-Fi

On ARTIK Linux-based systems, Wi-Fi operations go through the Wi-Fi Protected Access (WPA) Supplicant services program wpa_supplicant – it supports authentication and encryption for a wireless LAN.

First-time setup

Follow these steps to get your system set up quickly. We provide a more advanced approach, using Connection Manager, later in this article.

  1. Make sure the Wi-Fi antenna is attached as noted here.

  2. Configure the wpa_supplicant.conf file to include your Wi-Fi router settings. You only need to set up the password information once.

    1. Change to the WPA supplicant directory.
      cd /etc/wpa_supplicant
    2. Use the wpa_passphrase command to write your router SSID and password into the WPA supplicant configuration file.
      wpa_passphrase "SSID" "PASSWORD" >> wpa_supplicant.conf

      For example,
         wpa_passphrase MyAP abcd1234 >> wpa_supplicant.conf

      Connecting to an unsecured Wi-Fi access point? Put in any password here; we'll delete it below.

  3. Use an editor to verify and clean up the file contents.
       vi wpa_supplicant.conf

    1. If using secure Wi-Fi, delete your cleartext personal passphrase (the line that starts with #psk), leaving only the encrypted version.

      If you are connecting to unsecured Wi-Fi, delete both psk lines and use:

    2. Check whether the file contains multiple network login assignments. If it does, you may want to comment out the ones you do not need to prevent them from being selected instead of your chosen network.

    3. Make sure that the first two lines of the file look like this. If not, add them in.

    4. Save and exit when finished.

  4. Type reboot to write open files and reset your system.

If your connection is through a company proxy server, you have more work to do! Refer to the Proxies article for details.

For more advanced Wi-Fi security settings, you can refer to this page or other online resources.

Initialization on each startup

Every time you restart the system, the WPA supplicant service must be called to start the wireless LAN. You will then use the DHCP client services program dhclient to request a WLAN IP address from your DHCP server.

  • systemctl start wpa_supplicant should start automatically.
       – Run systemctl status wpa_supplicant to check
       – Run systemctl start wpa_supplicant if you need to start it.

  • dhclient wlan0 must be run manually or through a start-up script.

After both services are running, you'll want to execute
   ifconfig wlan0
to check whether the previous command succeeded in assigning an IP address. This will be your "localhost" IP address as we refer to it in our articles.

If you don't see a valid IP address, verify that your wpa_supplicant.conf file is correct – it should look very similar to this:


  psk=27d496e9b...961761af7a78b466 }

If you edit the file, you need to start everything up again.

  1. Kill DHCP (if needed) with dhclient -r
  2. Run systemctl restart wpa_supplicant to restart the WLAN service
  3. Run dhclient wlan0 again.

If it still doesn't work, execute a reboot and try once more.

If successful, you are finished with Wi-Fi setup. The sections below are optional for more advanced users.

Run dhclient from a script

You can configure your system to automatically reconnect Wi-Fi after each reboot. One way of doing this is to edit your system init script.

If you are using Fedora 22 or later, you can create your own init script for re-establishing the Wi-Fi connection after each power cycle. Under your /etc/init.d/directory, generate a script named wlan. Here is a sample of what wlan looks like:

#! /bin/bash
#chkconfig: - 99 10

/usr/sbin/dhclient wlan0

kill dhclient


case "$1" in
    echo "Usage:$0 {start|stop|restart}"

exit 0

Save the script, change its file mode to be executable, and enable it for reboot:

chmod a+x /etc/init.d/wlan

chkconfig --add wlan

chkconfig --level 12345 wlan on

If you are using Fedora 20, in your /etc/rc.d/rc.local file, you will find a chunk of code that enables Wi-Fi. Simply adding dhclient wlan0 to the end of the chunk will get your board auto-connected when it reboots.

Connection Manager

Starting with Fedora 24 ARTIK firmware releases, the Connection Manager (connman) service is provided. This network manager has a lot of functionality – to get an idea, type:
and then type technologies at the prompt. You'll see that it even integrates Bluetooth® management, which we use in our related article.

With all its convenient features, Connection Manager is a bit overwhelming and can sometimes interfere with your intended connection configurations. Here we discuss how you can make minimal use of it, but for best results refer to Web articles like this one that provide more detail.


For both Fedora 22 and Fedora 24, Wi-Fi operations go through wpa_supplicant services. Connection Manager adds automation (and complexity) on top of wpa_supplicant. Here's how it figures in.

Fedora 22 systems use /etc/wpa_supplicant/wpa_supplicant.conf to store Wi-Fi access point names and encrypted passwords.

  • You use wpa_passphrase to encrypt your password, and then write it to the configuration file for future use.
  • You have to start wpa_supplicant followed by dhclient to get Wi-Fi access.
  • The boot default is to enable wpa_supplicant but leave dhclient to be run manually or by a startup script.

Fedora 24 and later releases are built with Connection Manager. It provides a more structured approach with a registration agent.

  • Connection Manager is enabled by default, but just enough to leave the system backwards-compatible with the Fedora 22 build.

  • It starts wpa_supplicant automatically using wpa_supplicant.conf and leaves it to you to run dhclient wlan0.

  • However, once you choose to use the registration feature of Connection Manager, it takes over control such that wpa_supplicant.conf settings are ignored.

The sections below show you ways you can start using Connection Manager. Using these features is optional; you can stay with the configuration file method if you prefer.

Selecting an Access Point

  1. Attach a Wi-Fi antenna as noted here.
  2. Scan for wireless access points. Enter commands as follows.
    1. connmanctl to get the > prompt.
    2. scan wifi to scan for available access points (wait until finished).
    3. services to list them.
  3. Select an access point. Still within the > prompt, enter commands as follows.
    1. agent on if you want Connection Manager to prompt you for a password.
    2. connect wifi_xxxx to pick the desired access point (you can use the tab key to start, and to auto-complete, your entry).
    3. Respond to the agent query for a password if needed.
    4. quit when finished.

You won't need to repeat this process in the future: Connection happens automatically from now on.

Controlling net interfaces

At the connmanctl> prompt where you typed technologies to get a list of everything available, you can control those interfaces easily. For example, if the Ethernet controller is powered up and you need to turn it off, simply enter
ethernet disable
to take care of it.

Reverting to default operation

If you later need to revert to the default backwards-compatible approach, you can run
   systemctl disable connman
   systemctl enable connman
to get back where you started.

Problematic operation

There are times that Connection Manager can get in the way of intended operations by "stealing" connections. You will likely encounter this scenario if you are trying to run through a proxy and see connection errors or timeout errors during transfers.

Troubleshooting Tip. Getting errors within a half-minute or so of booting? Try route -n before and after the failure to see if the routing is being changed by connman. Reconfigure or disable connman if needed.

To block the p2p interface that sometimes is the cause of the problems:

  1. Bring up the /etc/connman/main.conf file for editing.

  2. Search for blacklist (in vi type /blacklist and hit Enter).

  3. To the line starting with NetworkInterfaceBlacklist, add
    to the existing list.

  4. Save the file and reboot.

To permanently disable Connection Manager, type:

systemctl disable connman.service

and reboot your system. From that point forward, you will need to manually run
systemctl start wpa_supplicant
followed by
dhclient wlan0
on each reboot.

Note that if you have disabled Connection Manager, you can still use wpa_cli scan_results to get a list of available access points after you have started the WPA supplicant services.

To temporarily stop or start Connection Manager once it is enabled, you can use
systemctl stop connman
systemctl start connman

Extra Credit: Linux scp and ssh

Once you have a network connection between your PC and ARTIK, you can use scp to transfer files. For example, if you're not fond of editing in vi, you can compose a C code file on your local PC editing program and then copy it over to your ARTIK board.

You can read online for the general usage of the command. As a quick example,
scp testfile.c root@
copies testfile.c from your current PC directory to the root directory of the ARTIK board on the network noted. The system will ask for your login password (default 'root') before completing the transfer.

  • For Mac® and Linux® systems: You can enter the scp command line in the terminal emulator.
  • For Windows® systems: You will need to open a Git bash window (not a DOS command window). You could instead install an scp client for Windows like FileZilla or WinSCP.

You can also run an ssh session for more complex tasks. With SSH, you generate two mated keys, one public and one private. You initially send the public key to any server you'll be transacting business with. Then during authentication, the server verifies that you have the private mate of the public key that it has on file.

Go to the directory at /etc/ssh and you'll see several ssh_host_... files. At any time, you can delete these and use the procedure in Troubleshooting to regenerate these mated key pairs.

SSH keys are a separate topic from the SSL certificate environment described here.

Once again, you can read online for more information on these topics.


Running into this error trying to ssh to ARTIK?

ssh: connect to host XXX.XXX.XXX.XXX port 22: Connection timed out 

If so, the SSH keys may have been corrupted. Re-create the host keys by using these two commands:
rm /etc/ssh/ssh_host_*
ssh-keygen -A

The keys will be regenerated in five formats: basic, RSA, DSA, ECDSA, and its variant ED25519.

Last updated on: