採購識別網卡
經朋友推薦購買的是TOTO LINK的N200UP無線網卡,切記型號版本,芯片RT3070,較爲穩定,支持AP模式。
# 查看網卡支持模式與芯片版本
root@kali:~# lsusb
Bus 003 Device 010: ID 148f:3070 Ralink Technology, Corp. RT2870/RT3070 Wireless Adapter
# 查看支持的接口模式
root@kali:~# iw list
Supported interface modes:
* IBSS
* managed
* AP
* AP/VLAN
* WDS
* monitor
* mesh point
# 其餘查看命令等
root@kali:~# nmcli device show
root@kali:~# iwconfig
編輯網絡配置文件,添加橋接接口
vim /etc/network/interface
# wireless wlan0
allow-hotplug wlan0
iface wlan0 inet manual
# 重啓前須要註釋掉下面這行數據 防止br0成了主接口
auto br0
iface br0 inet dhcp
bridge_ports eth0
bridge_stp off
bridge_maxwait 0
重啓網卡
service networking restart
service network-manager restart
or
ifconfig wlan0 down
啓用AP網絡
hostapd /etc/hostapd/hostapd.conf
恢復無接口模式
其實此時不刪除br0也同樣可以正常上網
刪除方式:
# 註釋第一步中的代碼
vim /etc/network/interfaces
# down掉br0接口
ifconfig br0 down
# 查看解除橋接綁定關係
brctl show
brctl delbr br0
hostapd.conf
# wireless network name interface=wlan0
# Set your bridge name
bridge=br0
driver=nl80211
country_code=CN
ssid=Cnlouds
hw_mode=g
channel=6
wpa=2
wpa_passphrase=123456
# Key management algorithms
wpa_key_mgmt=WPA-PSK
# Set cipher suites (encryption algorithms)
# TKIP = Temporal Key Integrity Protocol
# CCMP = AES in Counter mode with CBC-MAC
wpa_pairwise=TKIP
rsn_pairwise=CCMP
# Shared Key Authentication
auth_algs=1
# Accept all MAC address
macaddr_acl=0
參考連接
!使用 hostapd 輕鬆實現強 WiFi 加密:
www.ibm.com/developerworks/cn/linux/l-wifiencrypthostapd/
Debian / Ubuntu Linux: Setup Wireless Access Point (WAP) with Hostapd:
https://www.cyberciti.biz/faq/debian-ubuntu-linux-setting-wireless-access-point/