apt-get install -y hostapd udhcpd
udhcpd 配置
root@raspberrypi:~# cat /etc/udhcpd.conf
start 192.168.42.2 # This is the range of IPs that the hostspot will give to client devices.
end 192.168.42.20
interface wlan0 # The device uDHCP listens on.
remaining yes
#opt dns 8.8.8.8 4.2.2.2 # The DNS servers client devices will use.
opt dns 223.5.5.5 223.6.6.6 # The DNS servers client devices will use.
opt subnet 255.255.255.0
opt router 192.168.42.1 # The Pi's IP address on wlan0 which we will set up shortly.
opt lease 864000 # 10 day DHCP lease time in seconds
hostapd 配置
因为硬件的适配性问题,默默调试了3-4h,各种搜(树莓派3应该不存在这种问题)
root@raspberrypi:~# lsusb |grep WLAN
Bus 001 Device 004: ID 0bda:8176 Realtek Semiconductor Corp. RTL8188CUS 802.11n WLAN Adapter
root@raspberrypi:~# lshw -C network
*-network:0
description: Wireless interface
physical id: 1
bus info: usb@1:1.3
logical name: wlan0
serial: e8:4e:06:2a:5e:73
capabilities: ethernet physical wireless
configuration: broadcast=yes driver= rtl8192cu ip=192.168.42.1 multicast=yes wireless=IEEE 802.11bg
hostapd配置
root@raspberrypi:~# cat /etc/hostapd/hostapd.conf
interface=wlan0
driver=rtl871xdrv
ssid=行者孙
hw_mode=g
channel=6
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=haha1234
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
内核
root@raspberrypi:~# grep net.ipv4.ip_forward=1 /etc/sysctl.conf
net.ipv4.ip_forward=1
iptables
root@raspberrypi:~# cat /etc/iptables.ipv4.nat
# Generated by iptables-save v1.4.14 on Sat Apr 30 16:59:41 2016
*filter
:INPUT ACCEPT [23:1360]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [21:3136]
-A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -i wlan0 -o eth0 -j ACCEPT
COMMIT
# Completed on Sat Apr 30 16:59:41 2016
# Generated by iptables-save v1.4.14 on Sat Apr 30 16:59:41 2016
*nat
:PREROUTING ACCEPT [2:156]
:INPUT ACCEPT [2:156]
:OUTPUT ACCEPT [1:108]
:POSTROUTING ACCEPT [0:0]
-A POSTROUTING -o eth0 -j MASQUERADE
COMMIT
# Completed on Sat Apr 30 16:59:41 2016
网络配置
root@raspberrypi:~# cat /etc/network/interfaces
auto lo
iface lo inet loopback
iface eth0 inet dhcp
auto eth0
allow-hotplug eth0
auto wlan0
allow-hotplug wlan0
iface wlan0 inet static
address 192.168.42.1
netmask 255.255.255.0
pre-up iptables-restore < /etc/iptables.ipv4.nat
启动项
root@raspberrypi:~# history | grep enable
103 update-rc.d udhcpd enable
104 update-rc.d hostapd enable
测试速度很快。主观自我肯定,客观硬件配置的确秒杀绝大部分路由器
ssid:行者孙
password: haha1234
Hi, GNU/linux 陪伴是最长情的告白,等我财务自由了我赚钱给你!
apt-get install -y hostapd udhcpd
udhcpd 配置
root@raspberrypi:~# cat /etc/udhcpd.conf
start 192.168.42.2 # This is the range of IPs that the hostspot will give to client devices.
end 192.168.42.20
interface wlan0 # The device uDHCP listens on.
remaining yes
#opt dns 8.8.8.8 4.2.2.2 # The DNS servers client devices will use.
opt dns 223.5.5.5 223.6.6.6 # The DNS servers client devices will use.
opt subnet 255.255.255.0
opt router 192.168.42.1 # The Pi's IP address on wlan0 which we will set up shortly.
opt lease 864000 # 10 day DHCP lease time in seconds
hostapd 配置
因为硬件的适配性问题,默默调试了3-4h,各种搜(树莓派3应该不存在这种问题)
root@raspberrypi:~# lsusb |grep WLAN
Bus 001 Device 004: ID 0bda:8176 Realtek Semiconductor Corp. RTL8188CUS 802.11n WLAN Adapter
root@raspberrypi:~# lshw -C network
*-network:0
description: Wireless interface
physical id: 1
bus info: usb@1:1.3
logical name: wlan0
serial: e8:4e:06:2a:5e:73
capabilities: ethernet physical wireless
configuration: broadcast=yes driver= rtl8192cu ip=192.168.42.1 multicast=yes wireless=IEEE 802.11bg
hostapd配置
root@raspberrypi:~# cat /etc/hostapd/hostapd.conf
interface=wlan0
driver=rtl871xdrv
ssid=行者孙
hw_mode=g
channel=6
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=haha1234
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
内核
root@raspberrypi:~# grep net.ipv4.ip_forward=1 /etc/sysctl.conf
net.ipv4.ip_forward=1
iptables
root@raspberrypi:~# cat /etc/iptables.ipv4.nat
# Generated by iptables-save v1.4.14 on Sat Apr 30 16:59:41 2016
*filter
:INPUT ACCEPT [23:1360]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [21:3136]
-A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -i wlan0 -o eth0 -j ACCEPT
COMMIT
# Completed on Sat Apr 30 16:59:41 2016
# Generated by iptables-save v1.4.14 on Sat Apr 30 16:59:41 2016
*nat
:PREROUTING ACCEPT [2:156]
:INPUT ACCEPT [2:156]
:OUTPUT ACCEPT [1:108]
:POSTROUTING ACCEPT [0:0]
-A POSTROUTING -o eth0 -j MASQUERADE
COMMIT
# Completed on Sat Apr 30 16:59:41 2016
网络配置
root@raspberrypi:~# cat /etc/network/interfaces
auto lo
iface lo inet loopback
iface eth0 inet dhcp
auto eth0
allow-hotplug eth0
auto wlan0
allow-hotplug wlan0
iface wlan0 inet static
address 192.168.42.1
netmask 255.255.255.0
pre-up iptables-restore < /etc/iptables.ipv4.nat
启动项
root@raspberrypi:~# history | grep enable
103 update-rc.d udhcpd enable
104 update-rc.d hostapd enable
测试速度很快。主观自我肯定,客观硬件配置的确秒杀绝大部分路由器
ssid:行者孙
password: haha1234
Hi, GNU/linux 陪伴是最长情的告白,等我财务自由了我赚钱给你!