修改/etc/dhcpcd.conf
文件
sudo vim /etc/dhcpcd.conf
添加如下配置
# 有线配置 interface eth0 # 静态IP地址 24是CIDR值 子网掩码对应255.255.255.0 static ip_address=192.168.0.10/24 # 网关地址 static routers=192.168.0.1 # DNS服务器 static domain_name_servers=192.168.0.1 # 无线配置 interface wlan0 static ip_address=192.168.0.200/24 static routers=192.168.0.1 static domain_name_servers=192.168.0.1