今天刚上手物理机中安装archlinux,每次开机都要手动连接wifi网络,很不方便。能否开机自动连接wifi呢?
手动连接WIFI
不使用图形界面,不使用wifi-menu的情况下。
在命令行中手动连接方式如下:
#获取可用wifi列表wlist wlan0 scan | grep ESSID#生成密码配置文件wpa_passphrase wifiname password > internet.conf#连接wifiwpa_supplicant -c internet.conf -i wlan0 &
虽然很方便,但是很次开机还要切成root权限连一下wifi,还是非常的不方便的。
开机自动连接wifi
但是如果没有安装gui情况下。一般使用的是netctl。
安装无线网络必须的管理工具
pacman -S dialog wpa_supplicant netctl wireless_tools
这时管理工具netctl就安装上了
配置
查看/etc/netctl/
是否有已经生成的热点文件, 如果未有。 则用wifi-menu从新连接一次。
root@archlinux: /etc/netctl # /bin/ls examples hooks interfaces wlan0-ApexEdu_6G
比如我这里的wlan0-ApexEdu_6G
就是热点的配置文件。
root@archlinux: /etc/netctl # cat wlan0-ApexEdu_6G[19:47:45]Description='Automatically generated profile by wifi-menu'Interface=wlan0Connection=wirelessSecurity=wpaESSID=ApexEdu_6GIP=dhcpKey=password
启动netctl服务
下面的命令是启动wifi,(代替wifi-menu,不在需要选择热点和输入密码)
netctl-auto@设备名称.service
这里的设备名称就是Interface=wlan0
中的值。
#开户服务systemctl start netctl-auto@wlan0.service#设置开机启动systemctl enable netctl-auto@wlan0.service
参考
/weixin_33838871/article/details/116690246