Difference between revisions of "Template:Linux-Create-WiFiAP"
m (Tzs moved page Template:RK3399-Linux-Create-WiFiAP to Template:Linux-Create-WiFiAP) |
(updated by API) |
||
Line 1: | Line 1: | ||
− | === | + | ===Access Point Setup Guide=== |
− | ==== | + | ====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:<br /> | |
− | NanoPi M4<br /> | + | =====RK3399===== |
− | NanoPC T4<br /> | + | * NanoPi M4 (Wireless module:AP6356S)<br /> |
− | + | * NanoPi M4B (Wireless module:AP6256)<br /> | |
− | FriendlyCore<br /> | + | * NanoPC T4 (Wireless module:AP6356S)<br /> |
− | FriendlyDesktop<br /> | + | =====S5P4418/S5P6818===== |
− | ==== | + | * NanoPC T3 (Wireless module:AP6212)<br /> |
− | + | * NanoPC T2 (Wireless module:AP6212)<br /> | |
+ | =====Allwinner H3/H5===== | ||
+ | * NanoPi-M1-Plus (Wireless module:AP6212)<br /> | ||
+ | =====OS===== | ||
+ | The following distributions are supported :<br /> | ||
+ | * FriendlyCore Focal (20.04)<br /> | ||
+ | * FriendlyCore Bionic (18.04)<br /> | ||
+ | * FriendlyCore Xenial (16.04)<br /> | ||
+ | * FriendlyDesktop (18.04)<br /> | ||
+ | ====Installing the necessary tools==== | ||
+ | Execute the following command to install the necessary packages:<br /> | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | sudo apt-get update | ||
+ | sudo apt-get install hostapd git | ||
+ | </syntaxhighlight> | ||
+ | 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.:<br /> | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | sudo apt-get install network-manager | ||
+ | </syntaxhighlight> | ||
+ | Install the create_ap tool:<br /> | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
git clone https://github.com/friendlyarm/create_ap.git | git clone https://github.com/friendlyarm/create_ap.git | ||
Line 14: | Line 33: | ||
make install | make install | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | ==== | + | Make sure the wlan interface is in up state:<br /> |
− | ===== | + | <syntaxhighlight lang="bash"> |
− | + | iwconfig wlan0 up | |
+ | </syntaxhighlight> | ||
+ | ====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.<br /> | ||
+ | =====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): | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
− | sudo create_ap --country CN --ieee80211n --ht_capab "[DSSS_CK-40][HT20+]" --driver nl80211 -w 2 -m bridge wlan0 eth0 | + | . /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 | sudo create_ap --config /etc/create_ap.conf | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | ===== | + | =====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): | |
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
− | sudo create_ap --country CN --ieee80211n --ht_capab "[DSSS_CK-40][HT20+]" --driver nl80211 -w 2 wlan0 eth0 | + | . /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 | sudo create_ap --config /etc/create_ap.conf | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | ===== | + | =====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: | |
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
− | sudo create_ap --country CN --ieee80211n --ht_capab "[DSSS_CK-40][HT20+]" --driver nl80211 -w 2 --isolate-clients wlan0 eth0 | + | . /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 | sudo create_ap --config /etc/create_ap.conf | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | ===== | + | =====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: | |
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
sudo iw dev wlan0 interface add wlan1 type station | sudo iw dev wlan0 interface add wlan1 type station | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | Connect to the wireless router(STA mode): | |
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
sudo nmcli dev wifi connect "MyHomeWiFi" password "12345678" | sudo nmcli dev wifi connect "MyHomeWiFi" password "12345678" | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | Create Wireless access point (AP Mode): | |
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
− | sudo create_ap --country CN --ieee80211n --ht_capab "[DSSS_CK-40][HT20+]" --driver nl80211 -w 2 wlan0 wlan0 | + | . /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 | sudo create_ap --config /etc/create_ap.conf | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | ==== | + | ====Set the wireless access point to be enabled automatically on boot==== |
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
systemctl enable create_ap | systemctl enable create_ap | ||
sudo reboot | sudo reboot | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
− |
Revision as of 05:21, 3 September 2021
Contents
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