采购识别网卡
经朋友推荐购买的是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/