Filter results by

Wi-Fi Access Point (AP)

Instead of being a Wi-Fi® client, ARTIK can be set up as a Wi-Fi Access Point (SoftAP mode). Using its external Ethernet connection, the ARTIK module provides wireless Internet services to other Wi-Fi clients.

The main part of this article describes systems running Fedora 24 or 22. Refer to the Older Installations section for ARTIK systems running Fedora 20 (older ARTIK 520 and 1020 boards not yet updated to Fedora 22).

Prerequisites

  • Connect to the ARTIK board with your usual terminal emulator program. If using two boards, you should connect with separate terminal instances over separate ports to each board.

  • For ARTIK images using Fedora 22 but released prior to April 2016, run the following command at the Linux® prompt to install utility programs for running SoftAP mode.

    dnf install hostapd bridge-utils

SoftAP Mode

If you want to run as an independent access point, you will need to set up Network Address Translation (NAT) as described in the procedures below. Refer to a site like RedHat for detailed information on the topic.

This procedure assumes that you are starting from a known-working state, where you have previously been able to use both the Ethernet and Wi-Fi interfaces as a client. Refer to Ethernet and Wi-Fi Networks for details.

Preparation

You'll need to make some one-time configuration file changes to prepare for AP mode operation.

  1. Configure Host Access Point Daemon (hostapd), a user space program used to turn the ARTIK wireless network interface circuit into a Wi-Fi access point.

    1. Open the 'hostapd' configuration file for editing.
      vi /etc/hostapd/hostapd.conf

    2. Copy and paste each of these assignments, replacing any existing ones and modifying as needed.

      interface=wlan0
      driver=nl80211
      ssid=ARTIK_AP (choose the name here)
      hw_mode=g
      channel=6

      auth_algs=1
      wpa=2
      wpa_passphrase=artik@iot (choose the passphrase here)
      wpa_pairwise=TKIP CCMP
      rsn_pairwise=CCMP

    3. If you are providing an unsecured Wi-Fi connection, comment out entries for the last five assigments shown (the auth_algs to rsn... lines).

    4. Save and close.

  2. Configure dnsmasq, a lightweight DHCP and caching DNS server that resolves local hostnames internally by using the /etc/hosts file along with any binding address ranges you specify here.

    1. Open the 'dnamasq' configuration file for editing.
      vi /etc/dnsmasq.conf

    2. Search for the bind-interfaces section.

    3. Select and copy this category and assignment.
      bind-interfaces
      dhcp-range=192.168.1.2,192.168.1.100

    4. Paste in the selection, replacing the existing #bind-interfaces line, to specify the range of IP addresses for DHCP "leases".

    5. Save and close.

  3. Using the iptables command set, configure the access point to route through IP masquerade rules to provide the network address translation needed.

    1. Open a new file for editing as a shell script file. We'll call ours 'aproute.sh'.
      vi aproute.sh

    2. Select and copy these commands.
      sysctl net.ipv4.ip_forward=1
      iptables --flush
      iptables -t nat --flush
      iptables --delete-chain
      iptables -t nat --delete-chain
      iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
      iptables -A FORWARD -i wlan0 -j ACCEPT

    3. Paste them into the file, save, and exit.
    4. Remember to make the file executable.
      chmod 777 aproute.sh

Enabling Access Point

With the file changes in place, run the following commands to activate Access Point operation.

  1. Stop Connection Manager to prevent it from stealing connections.
    systemctl stop connman

  2. Bring up Ethernet operation.
    ifconfig eth0 up
    dhclient eth0
    You can type ifconfig eth0 to verify that you have a valid IP address.

  3. For all module types except ARTIK 530, reset the network driver for the mode change.
    modprobe -r dhd
    modprobe dhd op_mode=2

  4. Bring up Wi-Fi operation, specifying its gateway IP address.
    ifconfig wlan0 192.168.1.1 up

  5. Start dnsmasq to enable hostname service within the IP address range configured.
    dnsmasq -C /etc/dnsmasq.conf

  6. Execute the script file to start network address translation.
    ./aproute.sh

  7. Start the host access point daemon.
    hostapd /etc/hostapd/hostapd.conf -B

Access Point operation should now be fully functional.

Turning off Access Point

You can use the script below to disable the access point.
killall hostapd
killall dnsmasq
modprobe -r dhd
modprobe dhd op_mode=0
ifconfig wlan0 up
if [ -f "/usr/lib/systemd/system/wpa_supplicant.service" ]; then
  systemctl restart wpa_supplicant
fi

You could then return to client mode with the usual dhclient wlan0 command.

AP-STA Mode (ARTIK 530)

The Wi-Fi chipset used on the ARTIK 530 module is capable of running in a half-duplex repeater mode to emulate concurrent AP (access point) and STA (client) mode Wi-Fi operation; the Ethernet connection is not used. Because this mode provides just a single Tx and Rx, it it not intended for heavy Wi-Fi traffic.

Other module types are not configurable to operate in this mode.

Preparation

You'll first need to follow the SoftAP mode Preparation section to set up the configuration files. Then, you'll need to change access point (AP) references from wlan0 to uap0, since the wlan0 interface will be used instead as the "client" (STA) side.

  1. Edit /etc/hostapd/hostapd.conf to add or update the interface name.
    interface=uap0

  2. Do the same in /etc/dnsmasq.conf, also changing the bind address range.
    interface=uap0
    bind-interfaces
    dhcp-range=192.168.173.2,192.168.173.100

Enabling AP+STA Operation

The steps here are similar to those for simple SoftAP mode, except for the addition of Step 2 and changed references to uap0 and wlan0 where needed. If your Ethernet interface is powered on, you'll want to disable it as noted here.

  1. Stop Connection Manager to prevent it from stealing connections.
    systemctl stop connman

  2. Power-down, reconfigure, and power-up the Wi-Fi chipset.

    1. Power down the Wi-Fi chipset and unload the driver.
      echo 0 > /sys/devices/platform/sd8x-rfkill/pwr_ctrl
      rmmod sd8xxx mlan

    2. Power up the Wi-Fi chipset and reload the driver configured for operation in the new mode.
      modprobe mlan
      modprobe sd8xxx drv_mode=5
      echo 3 > /sys/module/sd8xxx/parameters/drv_mode
      echo 1 > /sys/devices/platform/sd8x-rfkill/pwr_ctrl

  3. Restart STA (client) operation.
    dhclient -r # (kill it if already running)
    systemctl restart wpa_supplicant
    dhclient wlan0

  4. Bring up Wi-Fi operation on the access point, specifying its gateway IP address.
    ifconfig uap0 192.168.173.1 up

  5. Start dnsmasq to enable hostname service within the IP address range configured. dnsmasq -C /etc/dnsmasq.conf

  6. Start network address translation. Note that the output no longer goes to eth0.
    sysctl net.ipv4.ip_forward=1
    iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE

  7. Start the host access point daemon.
    hostapd /etc/hostapd/hostapd.conf -B

Older Installations

These instructions apply only to ARTIK Rev 2.0 – Rev 3.3 boards whose firmware image has not been updated to Fedora 22.

This article shows how to set up an ARTIK 520 or 1020 board using Fedora 20 as an Access Point.

Initial setup

  1. Manually install the following packages:

    1
    2
    3
     yum install hostapd
     yum install bridge-utils
     yum install libnl
  2. Add the following settings to the hostapd.conf file, located in /etc/hostapd.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
     interface=wlan0
     driver=nl80211
     channel=1 
     hw_mode=g
     preamble=1
     dtim_period=2
     beacon_int=100
     logger_syslog=-1
     logger_syslog_level=2
     logger_stdout=-1
     logger_stdout_level=2
     ctrl_interface=/var/run/hostapd
     ctrl_interface_group=0
     ssid=SEC_WPA2_CCMP_AP
     max_num_sta=1 (only one STA available)
     macaddr_acl=0
     auth_algs=1
     wme_enabled=0
     eapol_key_index_workaround=0
     eap_server=0
     wpa=2
     wpa_passphrase=12345678
     wpa_key_mgmt=WPA-PSK
     wpa_pairwise=CCMP 
  3. Configure dnsmasq by adding the following lines to /etc/dnsmasq.conf. (This allows the use of DHCP, DNS, etc.)

    1
    2
     bind-interfaces
     dhcp-range=192.168.1.2, 192.168.1.100 
  4. Stop NetworkManager to prevent NetworkManager from getting connections and configuring Wi-Fi module operation mode.

    1
    2
    3
    4
     service NetworkManager stop
     modprobe -r dhd
     modprobe dhd op_mode=2
     dnsmasq -C /etc/dnsmasq.conf 

Start the Access Point

  1. Configure driver and firmware files.

    1
    2
    3
    4
    5
    6
     ifconfig wlan0 down
     echo "/etc/wifi/4354a1_apsta.bin" > /sys/module/dhd/parameters/firmware_path
     ifconfig wlan0 up
     ifconfig wlan0 down
     echo 2 > /sys/module/dhd/parameters/op_mode
     ifconfig wlan0 up
  2. Start hostapd.

    1
     hostapd /etc/hostapd.conf -B 
Last updated on: