使用banana pi M5 创建ap热点实验可用
1.安装工具
使用 hostapd 和 isc-dhcp-server
sudo apt-get update // 更新资源库
sudo apt install hostapd //安装 hostapd
sudo apt install isc-dhcp-server // 安装isc-dhcp-server
### 1.2 配置hostapd
创建文件 /etc/hostapd/hostapd.conf
输入内容
interface=wlan0
ssid=bananapidriver=nl80211auth_algs=1
wpa=2
wpa_passphrase=123456789
wpa_key_mgmt=WPA-PSK
rsn_pairwise=CCMP#bridge=br0
beacon_int=500
#SSID not hidden
ignore_broadcast_ssid=0hw_mode=a
channel=36
max_num_sta=8### IEEE 802.11n
ieee80211n=1
#require_vht=0
ht_capab=[HT20][HT40+][SHORT-GI-20][SHORT-GI-40][SHORT-GI-80][DSSS_CCK-40]### IEEE 802.11ac
ieee80211ac=1
#require_vht=0
#vht_capab=[MAX-MPDU-3895][SHORT-GI-80][SU-BEAMFORMEE]
#vht_oper_chwidth=1
#vht_oper_centr_freq_seg0_idx=42### WMM
wmm_enabled=1
1.3 配置 isc-dhcp-server
进入 /etc/default/isc-dhcp-server
修改
# On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
# Separate multiple interfaces with spaces, e.g. "eth0 eth1".
INTERFACESv4="wlan0"
进入 /etc/dhcp/dhcpd.conf
添加
...
option domain-name "example.org";
option domain-name-servers 8.8.8.8, 114.114.114.114;
...
# No service will be given on this subnet, but declaring it helps the
# DHCP server to understand the network topology.
subnet 192.168.11.0 netmask 255.255.255.0 {range dynamic-bootp 192.168.11.1 192.168.11.100;option broadcast-address 192.168.11.255;option routers 192.168.11.1;
}
1.3.1启动isc-dhcp-server
sudo systemctl restart isc-dhcp-server
1.3.2 设置路由
sudo ifconfig wlan0 192.168.11.1/24
sudo service isc-dhcp-server restart
sysctl net.ipv4.ip_forward=1
iptables -t nat -A POSTROUTING -s 192.168.11.0/24 -o eth0 -j MASQUERADE
打开 hostapd
sudo hostapd /etc/hostapd/hostapd.conf -B