nmcli配置wifi

连接wifi

扫描wifi

sudo nmcli dev wifi list

连接新的wifi

sudo nmcli dev wifi connect NETWORK-SSID password "NETWORK-PASSWORD"

查看保存的wifi信息

nmcli con show 

连接保存在wifi

nmcli con up NETWORK-SSID

断开wifi

nmcli con down NETWORK-SSID

创建wifi热点

创建热点

nmcli connection add type wifi ifname wlan0 con-name local-ap autoconnect yes ssid WIFI-SSID mode ap

设置密码

nmcli connection modify local-ap 802-11-wireless.mode ap 802-11-wireless-security.key-mgmt wpa-psk ipv4.method shared 802-11-wireless-security.psk "PASSWORD"

启动热点

nmcli connection up local-ap

配置dhcp

# vim /etc/dhcp/dhcpd.conf

option domain-name-servers 8.8.8.8;
subnet 192.168.44.0 netmask 255.255.255.0 {       # 目标网段
    range 192.168.44.128 192.168.44.200;          # 具体的IP  
    option routers 192.168.44.1;                  # 网关地址
    option domain-name-servers 114.114.114.114;   # dns解析
}

启动dhcp服务

systemctl restart dhcpd