网络连接 - Charles-Charmless/Charles-Charmless.github.io GitHub Wiki

有线网络

无线网络

查看网络接口

iw dev
ifconfig
iwlist

启动网络接口

ifconfig interface up
ip link set interface up

连接网络

wpa_passphrase wifi_essid wifi_pass >/etc/wpa_supplicant/wpa_supplicant.conf
wpa_supplicant -B -i interface -c /etc/wpa_supplicant/wpa_supplicant.conf

获取IP地址

dhclient interface

错误解决

查看是否有多个wpa_supplicant进程存在

设置静态ip

首先需要安装dhcpcd
apt install dhcpcd(dhcpcd5)

然后在/etc/dhcpcd.conf中设置静态ip
##############################################
interface eth0

static ip_address=192.168.0.10/24
static routers=192.168.0.1
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
################################################
最后设置dhcpcd自启动
sudo systemctl start dhcpcd
sudo systemctl enbale dhcpcd
⚠️ **GitHub.com Fallback** ⚠️