如果ubuntu工作在图形模式, 那么
在 /etc/NetworkManager/system-connections 添加 iibull 文件, 文件内容
[connection]
id=iibull
type=wifi
permissions=user:;
secondaries=
[wifi]
mac-address-blacklist=
mac-address-randomization=0
mode=infrastructure
seen-bssids=
ssid=iibull
[wifi-security]
auth-alg=open
group=
key-mgmt=wpa-psk
pairwise=
proto=
psk=iibull12345
[ipv4]
dns-search=
method=auto
[ipv6]
addr-gen-mode=stable-privacy
dns-search=
method=auto
重启生效.
如果ubuntu工作在命令模式下
#wpa_passphrase ESSID PWD >> /etc/wpa_supplicant/wpa.conf
#wpa_supplicant -B -i wlan0 -Dwext -c /etc/wpa_supplicant/wpa.conf
#iwconfig wlan0
#dhclient wlan0 或者 dhcpcd
/etc/wpa_supplicant/wpa.conf 内容类似
ctrl_interface=/var/run/wpa_supplicant
ap_scan=1
network={
ssid="[your SSID name]"
psk="[your WiFi password]"
priority=1
}
起始两种模式下都是改写文件的.
这类的文件是可以通过命令行进行生成或者改写的.
例如在图形界面下生成一个wifi连接
sudo nmcli connection add save yes type wifi ifname wlp1s0 con-name 'iibull' mode infrastructure ssid 'iibull' -- 802-11-wireless-security.key-mgmt wpa-psk 802-11-wireless-security.psk 'sec12345'
扩张模式:
连接和切换wifi热点
nmcli connection #查看本机已经配置过的连接
NAME UUID TYPE DEVICE
SEC-5G-2 74fd8800-76e2-45ee-bbf5-9b7a3fc0f190 802-11-wireless wlp1s0
iibull cccd6ae2-7ad0-315c-9dab-bb81a28d6f57 802-11-wireless --
nmcli d wifi list
#查看本机扫描到的热点 方式一
* SSID MODE CHAN RATE SIGNAL BARS SECURITY
SEC Infra 11 54 Mbit/s 100 ▂▄▆█ WPA2
ND-Guest Infra 149 54 Mbit/s 97 ▂▄▆█
NetDragon-FZ Infra 149 54 Mbit/s 97 ▂▄▆█
NDQA-IPv6 Infra 149 54 Mbit/s 95 ▂▄▆█ WPA2
ND-MAC Infra 149 54 Mbit/s 95 ▂▄▆█ WPA2
iibull Infra 1 54 Mbit/s 89 ▂▄▆█ WPA2
* SEC-5G-2 Infra 149 54 Mbit/s 83 ▂▄▆█ WPA2
sudo iwlist wlan0 scanning #查看本机扫描到的热点 方式二
##disconnect
nmcli d disconnect wlan0
##connect
nmcli d connect wlan0
*****************************************
##disconnect 切换热点
nmcli c down iibull
##connect
nmcli c up "SEC-5G-2"
//wifi 的开启关闭
nmcli nm wifi on
nmcli nm wifi off
nmcli radio wifi on
nmcli radio wifi off
文档在
阅读(12613) | 评论(0) | 转发(0) |