Difference between revisions of "Template:Linux-Create-WiFiAP"

From FriendlyELEC WiKi
Jump to: navigation, search
(updated by API)
 
(updated by API)
Line 1: Line 1:
===How to install and use docker===
+
===设置WiFi热点===
====How to Install Docker====
+
====支持的开发板与系统===
Run the following commands:<br />
+
本部分内容仅适用于以下开发板:<br />
 +
  NanoPi M4<br />
 +
  NanoPC T4<br />
 +
支持以下Linux系统:<br />
 +
  FriendlyCore<br />
 +
  FriendlyDesktop<br />
 +
====安装工具====
 +
在开发板的Linux系统下执行以下命令:<br />
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
wget https://download.docker.com/linux/ubuntu/dists/bionic/pool/stable/arm64/containerd.io_1.2.4-1_arm64.deb
+
git clone https://github.com/friendlyarm/create_ap.git
wget https://download.docker.com/linux/ubuntu/dists/bionic/pool/stable/arm64/docker-ce-cli_18.09.3~3-0~ubuntu-bionic_arm64.deb
+
cd create_ap
wget https://download.docker.com/linux/ubuntu/dists/bionic/pool/stable/arm64/docker-ce_18.09.3~3-0~ubuntu-bionic_arm64.deb
+
make install
sudo dpkg -i containerd.io_1.2.4-1_arm64.deb
+
sudo dpkg -i docker-ce-cli_18.09.3~3-0~ubuntu-bionic_arm64.deb
+
sudo dpkg -i docker-ce_18.09.3~3-0~ubuntu-bionic_arm64.deb
+
 
</syntaxhighlight>
 
</syntaxhighlight>
====Test Docker installation====
+
====设置WiFi热点====
Test that your installation works by running the simple docker image:
+
=====桥接模式=====
 +
连接到此AP的设备,会与eth0处于同一网段 (设备由eth0所连接的路由器分配ip地址,如果路由器开启了dhcp的话):
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
git clone https://github.com/friendlyarm/debian-jessie-arm-docker
+
sudo create_ap --country CN --ieee80211n --ht_capab "[DSSS_CK-40][HT20+]" --driver nl80211 -w 2  -m bridge wlan0 eth0 nanopct4 12345678 --no-virt --no-haveged --mkconfig /etc/create_ap.conf
cd debian-jessie-arm-docker
+
sudo create_ap --config /etc/create_ap.conf
./rebuild-image.sh
+
</syntaxhighlight>
./run.sh
+
=====NAT有线网络=====
 +
连接到此AP的设备,与eth0处于不同的子网 (设备由开发板端运行的dhcp server分配ip地址):
 +
<syntaxhighlight lang="bash">
 +
sudo create_ap --country CN --ieee80211n --ht_capab "[DSSS_CK-40][HT20+]" --driver nl80211 -w 2  wlan0 eth0 nanopct4 12345678 --no-virt --no-haveged --mkconfig /etc/create_ap.conf
 +
sudo create_ap --config /etc/create_ap.conf
 +
</syntaxhighlight>
 +
=====AP隔离模式=====
 +
与NAT有线网络大致相同,但区别是连接到此AP的设备,相互之间无法访问:
 +
<syntaxhighlight lang="bash">
 +
sudo create_ap --country CN --ieee80211n --ht_capab "[DSSS_CK-40][HT20+]" --driver nl80211 -w 2  --isolate-clients wlan0 eth0  nanopct4 12345678 --no-virt --no-haveged --mkconfig /etc/create_ap.conf
 +
sudo create_ap --config /etc/create_ap.conf
 +
</syntaxhighlight>
 +
=====AP模式与STA模式共存=====
 +
在此模式下,开发板可以连接到路由器,仍然可以创建热点被其他设备连接。
 +
先创建一个虚拟接口 wlan1:
 +
<syntaxhighlight lang="bash">
 +
sudo iw dev wlan0 interface add wlan1 type station
 +
</syntaxhighlight>
 +
连接到无线路由(STA模式):
 +
<syntaxhighlight lang="bash">
 +
sudo nmcli dev wifi connect "MyHomeWiFi" password "12345678"
 +
</syntaxhighlight>
 +
创建WiFi热点(AP模式):
 +
<syntaxhighlight lang="bash">
 +
sudo create_ap --country CN --ieee80211n --ht_capab "[DSSS_CK-40][HT20+]" --driver nl80211 -w 2  wlan0 wlan0 nanopct4 12345678 --no-haveged --mkconfig /etc/create_ap.conf
 +
sudo create_ap --config /etc/create_ap.conf
 +
</syntaxhighlight>
 +
====开机自动====
 +
<syntaxhighlight lang="bash">
 +
systemctl enable create_ap
 +
sudo reboot
 
</syntaxhighlight>
 
</syntaxhighlight>

Revision as of 08:56, 15 August 2019

1 设置WiFi热点

2 =支持的开发板与系统

本部分内容仅适用于以下开发板:

 NanoPi M4
NanoPC T4

支持以下Linux系统:

 FriendlyCore
FriendlyDesktop

2.1 安装工具

在开发板的Linux系统下执行以下命令:

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

2.2 设置WiFi热点

2.2.1 桥接模式

连接到此AP的设备,会与eth0处于同一网段 (设备由eth0所连接的路由器分配ip地址,如果路由器开启了dhcp的话):

sudo create_ap --country CN --ieee80211n --ht_capab "[DSSS_CK-40][HT20+]" --driver nl80211 -w 2  -m bridge wlan0 eth0 nanopct4 12345678 --no-virt --no-haveged --mkconfig /etc/create_ap.conf
sudo create_ap --config /etc/create_ap.conf
2.2.2 NAT有线网络

连接到此AP的设备,与eth0处于不同的子网 (设备由开发板端运行的dhcp server分配ip地址):

sudo create_ap --country CN --ieee80211n --ht_capab "[DSSS_CK-40][HT20+]" --driver nl80211 -w 2  wlan0 eth0 nanopct4 12345678 --no-virt --no-haveged --mkconfig /etc/create_ap.conf
sudo create_ap --config /etc/create_ap.conf
2.2.3 AP隔离模式

与NAT有线网络大致相同,但区别是连接到此AP的设备,相互之间无法访问:

sudo create_ap --country CN --ieee80211n --ht_capab "[DSSS_CK-40][HT20+]" --driver nl80211 -w 2  --isolate-clients wlan0 eth0  nanopct4 12345678 --no-virt --no-haveged --mkconfig /etc/create_ap.conf
sudo create_ap --config /etc/create_ap.conf
2.2.4 AP模式与STA模式共存

在此模式下,开发板可以连接到路由器,仍然可以创建热点被其他设备连接。 先创建一个虚拟接口 wlan1:

sudo iw dev wlan0 interface add wlan1 type station

连接到无线路由(STA模式):

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

创建WiFi热点(AP模式):

sudo create_ap --country CN --ieee80211n --ht_capab "[DSSS_CK-40][HT20+]" --driver nl80211 -w 2  wlan0 wlan0 nanopct4 12345678 --no-haveged --mkconfig /etc/create_ap.conf
sudo create_ap --config /etc/create_ap.conf

2.3 开机自动

systemctl enable create_ap
sudo reboot