This commit is contained in:
light
2018-07-05 13:35:20 +08:00
parent aa85a9e03e
commit 795ad3e9c8
7 changed files with 139 additions and 21 deletions
+20
View File
@@ -13,3 +13,23 @@ dd bs=4M if=2017-11-29-raspbian-stretch.img of=/dev/sdX # 写入镜像
sudo watch -n 5 pkill -USR1 ^dd$ # 查看dd进程
```
## 换源
```bash
$ sudo nano /etc/apt/sources.list
#注释掉原文件内容,用以下内容取代:
deb http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi
deb-src http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi
#使用管理员权限(经由sudo),编辑/etc/apt/sources.list.d/raspi.list文件。参考命令行为:
$ sudo nano /etc/apt/sources.list.d/raspi.list
#注释掉原文件内容,用以下内容取代:
deb http://mirror.tuna.tsinghua.edu.cn/raspberrypi/ stretch main ui
deb-src http://mirror.tuna.tsinghua.edu.cn/raspberrypi/ stretch main ui
```
+50 -16
View File
@@ -2,24 +2,18 @@
## 网络配置
设置静态ip 需编辑/etc/dhcpcd.conf 文件, 修改/etc/network/interfaces 无效
wlan0 连接公网,并将网络共享给有线网和wlan1
``` bash
auto eth0
iface eth0 inet static
address 192.168.1.1
netmask 255.255.255.0
interface wlan0 #指定接口
static ip_address=192.168.215.1/24 #IP根据需要更改,/24的意思是子网掩码为 255.255.255.0
# static router=192.168.215.1 #网关
# static domain_name_serverrs=223.5.5.5 # DNS
auto wlan0
iface wlan0 inet dhcp
wpa_conf /etc/wpa_supplicant/wpa_supplicant.conf
auto wlan1
iface wlan1 inet static
address 192.168.2.1
netmask 255.255.255.0
interface wlan0
static ip_address=192.168.216.1/24
```
## 固定wlan名称
@@ -40,7 +34,7 @@ nano /etc/dnsmasq.conf
``` bash
listen-address = 127.0.0.1, 192.168.1.1, 192.168.2.1
dhcp-range = 192.168.1.20, 192.168.1.200, 12h
dhcp-range = 192.168.1.20, 192.168.1.200, 12h
dhcp-range = 192.168.2.20, 192.168.2.200, 12h
```
@@ -77,4 +71,44 @@ wpa_cli -iwlan0 set_network 0 pairwise TKIP(CCMP)
wpa_cli -iwlan0 set_network 0 group TKIP(CCMP)
wpa_cli -iwlan0 set_network 0 eap PEAP
wpa_cli -iwlan0 set_network 0 identity '"username"'
wpa_cli -iwlan0 set_network 0 password '"password"'
wpa_cli -iwlan0 set_network 0 password '"password"'
## hostapd
``` bash
interface=wlan0
# 网卡对应的驱动名
driver=nl80211
# 无线网络的名称是Pi-wifi
ssid=Pi-wifi
# 无线路由器工作模式为802.11g(2.4G)
hw_mode=g
# 无线网卡使用的信道
channel=10
# 支持 802.11n
ieee80211n=1
# 采用WPA2配置
wpa=2
# 无线网络密码是123456789
wpa_passphrase=123456789
# 认证方式为WPA-PSK
wpa_key_mgmt=WPA-PSK
# 开启 WMM
wmm_enabled=1
# 开启 40MHz channels 和 20ns guard interval
ht_capab=[HT40][SHORT-GI-20][DSSS_CCK-40]
# 接受所有 MAC 地址
macaddr_acl=0
# 使用 WPA 认证
auth_algs=1
# 需连接者知道ssid
ignore_broadcast_ssid=0
# 使用 WPA2
wpa=2
# 使用预先共享的 key
wpa_key_mgmt=WPA-PSK
# 使用 AES, 而非 TKIP
rsn_pairwise=CCMP
```