首页 / UBUNTU / Ubuntu 命令行连接wifi
Ubuntu 命令行连接wifi
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了Ubuntu 命令行连接wifi,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2089字,纯文字阅读大概需要3分钟。
内容图文
注:nmcli命令支持使用缩写(别名),譬如说 device——dev、connection——con、……
1、建立和删除一个wifi连接
创建wifi连接(SSID:Samsung-printer,密码:12345678,默认使用设备wlan0)的示例:
$ nmcli device wifi connect Samsung-printer?password 12345678
每次命令执行后,会在/etc/NetworkManager/system-connections/目录下创建一个新文件来保存配置,重复执行则创建多个这样的文件。
删除wifi连接的示例:
$ nmcli con del Samsung-printer
在/etc/NetworkManager/system-connections/目录下的Samsung-printer文件将被删除。
2、启动连接和关闭连接
启用wifi连接的示例:
-
$ nmcli connection up Samsung-printer
-
或者
-
$ nmcli device con wlan0
关闭wifi连接的示例:
-
$ nmcli connection down Samsung-printer
-
或者
-
$ nmcli device dis wlan0
4、设置以太网
eth0使用HDCP分配IP:
nmcli con add type ethernet autoconnect no ifname eth0
eth0手动设置IP:
$ nmcli con add type ethernet autoconnect yes ifname eth0 ipv4.addr "192.168.0.0/24" ipv4.method manual
autoconnect后跟yes/no表示自动/不自动连接,ifname后面是设备名称,该命令可以包含有其他设置参数,例如ipv4.addr、ipv4.method等。
4、创建热点
命令格式及参数解释如下:
wifi hotspot [ | Create a Wi-Fi hotspot. The command creates a hotspot connection profile according to Wi-Fi device capabilities and activates it on the device. The hotspot is secured with WPA if device/driver supports that, otherwise WEP is used. Use connection down or device disconnect to stop the hotspot. Parameters of the hotspot can be influenced by the optional parameters:
|
示例:
$ nmcli device wifi hotspot ifname wlan0 con-name MyHostspot ssid MyHostspotSSID password 12345678
命令执行后,将会创建一个名为MyHotspot的连接。使用上述的命令启动连接,将会开启热点。
5、设置自动连接
示例:
$ nmcli connnection modify MyHotspot connection.autoconnect yes
内容总结
以上是互联网集市为您收集整理的Ubuntu 命令行连接wifi全部内容,希望文章能够帮你解决Ubuntu 命令行连接wifi所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。