树莓派raspberry pi配置无线路由器AP

raspi-config进入系统配置面板

进行 Expand Filesystem  扩展文件系统
否则备份系统的时候备份文件会急速膨胀。

(1)配置网络环境
nano /etc/network/interfaces
配置如下:

# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback
iface eth0 inet manual
allow-hotplug wlan0

#iface wlan0 inet manual
# wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

iface wlan0 inet static
address 192.168.10.1
netmask 255.255.255.0
network 192.168.10.0

allow-hotplug wlan1
iface wlan1 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

(2)安装配置hostapd服务

apt-get install hostapd

nano /etc/default/hostapd
找到#DAEMON_CONF= "",修改为:
DAEMON_CONF="/etc/hostapd/hostapd.conf"
然后编辑
nano /etc/hostapd/hostapd.conf
添加:
interface=wlan0
driver=nl80211
ssid=omik-110
hw_mode=g
channel=7
wmm_enabled=0
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=123456
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
保存退出,然后重启服务:
service hostapd restart

(3)dns服务安装配置

apt-get install dnsmasq

nano /etc/dnsmasq.conf

配置如下:
port=0

interface=wlan0

dhcp-range=192.168.10.10,192.168.10.100,24h

保存退出,然后重启服务:

service dnsmasq restart

好了,无线路由器配置好了。

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

注:以上ap无线网卡驱动基于官方1.0支持的,

官方的是支持1.0版的,不支持2.0的。那么,还是要使用第三方的hostapd。 
首先,要删除原来的hostapd 

sudo apt-get autoremove hostapd
再下载第三方驱动并安装 

wget https://github.com/jenssegers/RTL8188-hostapd/archive/v1.1.tar.gz 
tar -zxvf v1.1.tar.gz 
cd RTL8188-hostapd-1.1/hostapd 
sudo make 
sudo make install

sudo nano/etc/hostapd/hostapd.conf
interface=wlan0
driver=rtl871xdrv#这个是树莓派无线网卡驱动,不要改
ssid=pi#无线信号名字,随意设
hw_mode=g
channel=6
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=raspberry#密码,随意设
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
原文地址:https://www.cnblogs.com/fx2008/p/7560014.html