使香蕉派 bananapi M5 创建ap热点(软路由)

使用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=bananapi

driver=nl80211

auth_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=0

hw_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

手机连接热点(能连网就成功啦)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值