Template:Linux-Create-WiFiAP

From FriendlyELEC WiKi
Revision as of 05:21, 3 September 2021 by Tzs (Talk | contribs) (updated by API)

Jump to: navigation, search

1 Access Point Setup Guide

1.1 Compatible development boards and systems

At the time of writing this guide, the following development boards and systems were tested. Although this is not a complete list, theoretically they should work as long as the wireless modules are of the same type:

1.1.1 RK3399
  • NanoPi M4 (Wireless module:AP6356S)
  • NanoPi M4B (Wireless module:AP6256)
  • NanoPC T4 (Wireless module:AP6356S)
1.1.2 S5P4418/S5P6818
  • NanoPC T3 (Wireless module:AP6212)
  • NanoPC T2 (Wireless module:AP6212)
1.1.3 Allwinner H3/H5
  • NanoPi-M1-Plus (Wireless module:AP6212)
1.1.4 OS

The following distributions are supported :

  • FriendlyCore Focal (20.04)
  • FriendlyCore Bionic (18.04)
  • FriendlyCore Xenial (16.04)
  • FriendlyDesktop (18.04)

1.2 Installing the necessary tools

Execute the following command to install the necessary packages:

sudo apt-get update
sudo apt-get install hostapd git

If you are using the lite version of the firmware (e.g. FriendlyCore-Lite), it is also recommended to install network-manager, otherwise you will need to manually turn on the wireless interface, as by default it will be in down state.:

sudo apt-get install network-manager

Install the create_ap tool:

git clone https://github.com/friendlyarm/create_ap.git
cd create_ap
make install

Make sure the wlan interface is in up state:

iwconfig wlan0 up

1.3 Set up access point

Note: In the following description, the access point name is the model name of the development board obtained from the /etc/friendlyelec-release file, and 12345678 is the password of the access point.

1.3.1 Bridging Mode

The device connected to this AP will be in the same network segment as eth0 (the device is assigned an IP address by the router to which eth0 is connected, if the router has dhcp enabled):

. /etc/friendlyelec-release
sudo create_ap --country CN --ieee80211n --ht_capab "[DSSS_CK-40][HT20+]" \
   --driver nl80211 -w 2  -m bridge wlan0 eth0 ${BOARD_NAME} 12345678 --no-virt \
   --no-haveged --mkconfig /etc/create_ap.conf
sudo create_ap --config /etc/create_ap.conf
1.3.2 Routing Mode

The device connected to this AP is on a different subnet than eth0 (the device is assigned an ip address by the dhcp server running on the development board):

. /etc/friendlyelec-release
sudo create_ap --country CN --ieee80211n --ht_capab "[DSSS_CK-40][HT20+]" \
   --driver nl80211 -w 2  wlan0 eth0 ${BOARD_NAME} 12345678 --no-virt --no-haveged \
   --mkconfig /etc/create_ap.conf
sudo create_ap --config /etc/create_ap.conf
1.3.3 Routing Mode (Network Isolation)

Much the same as Routing Mode, but the difference is that the devices connected to this AP are not accessible to each other:

. /etc/friendlyelec-release
sudo create_ap --country CN --ieee80211n --ht_capab "[DSSS_CK-40][HT20+]" \
   --driver nl80211 -w 2  --isolate-clients wlan0 eth0  ${BOARD_NAME} 12345678 \
   --no-virt --no-haveged --mkconfig /etc/create_ap.conf
sudo create_ap --config /etc/create_ap.conf
1.3.4 Wireless Bridging (This function only supports wireless mode AP6356S)

In this mode, the board can connect to the router and still create access point to be connected by other devices. Create a virtual interface wlan1:

sudo iw dev wlan0 interface add wlan1 type station

Connect to the wireless router(STA mode):

sudo nmcli dev wifi connect "MyHomeWiFi" password "12345678"

Create Wireless access point (AP Mode):

. /etc/friendlyelec-release
sudo create_ap --country CN --ieee80211n --ht_capab "[DSSS_CK-40][HT20+]" \
   --driver nl80211 -w 2  wlan0 wlan0 ${BOARD_NAME} 12345678 --no-haveged \
   --mkconfig /etc/create_ap.conf
sudo create_ap --config /etc/create_ap.conf

1.4 Set the wireless access point to be enabled automatically on boot

systemctl enable create_ap
sudo reboot