router update
This commit is contained in:
parent
f0feebf529
commit
876721cd37
53
raspberry/router.md
Normal file
53
raspberry/router.md
Normal file
@ -0,0 +1,53 @@
|
||||
# 用树莓派做路由器
|
||||
|
||||
## 网络配置
|
||||
|
||||
wlan0 连接公网,并将网络共享给有线网和wlan1
|
||||
|
||||
``` bash
|
||||
auto eth0
|
||||
iface eth0 inet static
|
||||
address 192.168.1.1
|
||||
netmask 255.255.255.0
|
||||
|
||||
|
||||
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
|
||||
```
|
||||
|
||||
## 固定wlan名称
|
||||
|
||||
sudo nano /etc/udev/rules.d/10-network.rules
|
||||
|
||||
``` bash
|
||||
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="MAC_address",name="wlan0"
|
||||
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="MAC_address",name="wlan1"
|
||||
```
|
||||
|
||||
## 安装配饰DHCP服务
|
||||
|
||||
sudo apt install dnsmasq
|
||||
|
||||
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
|
||||
|
||||
```
|
||||
|
||||
## 开启内核转发包服务
|
||||
|
||||
sudo nano /etc/sysctl.conf
|
||||
|
||||
``` bash
|
||||
net ipv4.ip_forward = 1 #去掉注释
|
||||
```
|
||||
@ -1,12 +1,32 @@
|
||||
# 树莓派连接wifi
|
||||
|
||||
# 命令行
|
||||
## 配置
|
||||
|
||||
/etc/network/interfaces
|
||||
|
||||
``` bash
|
||||
auto lo
|
||||
|
||||
iface lo inet loopback
|
||||
iface eth0 inet dhcp
|
||||
|
||||
auto wlan0
|
||||
#allow-hotplug wlan0
|
||||
#iface wlan0 inet manual
|
||||
iface wlan0 inet dhcp
|
||||
wpa-conf /etc/wpa.conf
|
||||
#wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
|
||||
|
||||
iface default inet dhcp
|
||||
```
|
||||
|
||||
> sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
|
||||
|
||||
``` bash
|
||||
network={
|
||||
ssid="The_ESSID_from_earlier"
|
||||
psk="Your_wifi_password"
|
||||
ssid=""
|
||||
key_mgmt=WPA-PSK
|
||||
psk=""
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
1
ubuntu/网络相关命令.md
Normal file
1
ubuntu/网络相关命令.md
Normal file
@ -0,0 +1 @@
|
||||
iw list | grep -A 10 "Supported interface modes"
|
||||
Loading…
x
Reference in New Issue
Block a user