在Ubuntu中使用命令连接wifi
2017-09-26 15:17
573 查看
常用的查询命令
ifconfig 查询网卡信息(仅查询启动的接口)
ifconfig -a 查询所有的网卡信息
lsusb :查看系统中的USB设备 ——需要安装usbutils:apt install usbutils
iwconfig 查看无线网络 (查看哪一个接口支持无线连接) ——需要安装iw:apt install iw
sudo iwconfig wlanX up 启动无线网络:
ip link set wlanx up
ifup wlanx
sudo iwconfig wlanX down 关闭无线网络:
ip link set wlanx down
ifdown wlanx
sudo iw dev wlan0 scan | less 扫描附近的无线网络
lspci | grep -i ethernet 查看网卡型号
lsmod 查看当前系统加载的模块信息
rfkill list 查看无线网络
rfkill unblock all 启动无线网络
rfkill block all 取消无线网络
iwlist scaningn 查看所有可用的wifi接入点
安装network-mannager管理网络使用以下命令
首先使用命令:sudo killall wpa_supplicant 结束使用的wpa_supplicant进程
apt-get install network-manager 安装network-mannager
nmcli dev wifi 查看附近的无线网络(根据信号强度)
ifdown eth0 关闭网卡
ifup eth0 开启网卡
注意使用ifdown 和 ifup 时需要将网卡加入到目录 /etc/network/interface 中
方法一 :运行wpa_supplicant程序;
执行:wpa_supplicant -d -D wext -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
其中:
-d :增加调试信息
-D wext :wext,nl80211驱动名称
-i wlan0 :wlan0,网络接口名称
/system/sbin/wpa_supplicant :wpa_supplicant可执行程序path
/data/misc/wifi/wpa_supplicant.conf :wpa_supplicant的配置文件path
注意事项:
安全设置:None
安全设置:WPA-PSK
安全设置:WPA2-PSK
安全设置:WPA-PSK/WPA2-PSK
方法二:运行命令行工具wpa_cli ;
执行 :wpa_cli -i wlan0 -p /var/run/wpa_supplicant
注,--p /var/run/wpa_supplicant中的wpa_supplicant并不是可执行程序,而是个控制套接字。
此时会进入交互模式。其中交互模式的命令如下表:
Full command
方法三:
如果您想连接的网络是没有加密的,您可以用下面的命令直接连接:
$ sudo iw dev wlan0 connect [网络 SSID]
如果网络是用 WEP 加密的,也非常容易:
$ sudo iw dev wlan0 connect [网络 SSID] key 0:[WEP 密钥]
ifconfig 查询网卡信息(仅查询启动的接口)
ifconfig -a 查询所有的网卡信息
lsusb :查看系统中的USB设备 ——需要安装usbutils:apt install usbutils
iwconfig 查看无线网络 (查看哪一个接口支持无线连接) ——需要安装iw:apt install iw
sudo iwconfig wlanX up 启动无线网络:
ip link set wlanx up
ifup wlanx
sudo iwconfig wlanX down 关闭无线网络:
ip link set wlanx down
ifdown wlanx
sudo iw dev wlan0 scan | less 扫描附近的无线网络
lspci | grep -i ethernet 查看网卡型号
lsmod 查看当前系统加载的模块信息
rfkill list 查看无线网络
rfkill unblock all 启动无线网络
rfkill block all 取消无线网络
iwlist scaningn 查看所有可用的wifi接入点
安装network-mannager管理网络使用以下命令
首先使用命令:sudo killall wpa_supplicant 结束使用的wpa_supplicant进程
apt-get install network-manager 安装network-mannager
nmcli dev wifi 查看附近的无线网络(根据信号强度)
ifdown eth0 关闭网卡
ifup eth0 开启网卡
注意使用ifdown 和 ifup 时需要将网卡加入到目录 /etc/network/interface 中
方法一 :运行wpa_supplicant程序;
执行:wpa_supplicant -d -D wext -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
其中:
-d :增加调试信息
-D wext :wext,nl80211驱动名称
-i wlan0 :wlan0,网络接口名称
/system/sbin/wpa_supplicant :wpa_supplicant可执行程序path
/data/misc/wifi/wpa_supplicant.conf :wpa_supplicant的配置文件path
注意事项:
安全设置:None
安全设置:WPA-PSK
| WPA-PSK & TKIP | WPA-PSK & AES | WPA-PSK & TKIP+AES |
SSID | **** | **** | **** |
proto | WPA | WPA | WPA |
key_mgmt | WPA-PSK | WPA-PSK | WPA-PSK |
pairwise | TKIP | CCMP | TKIP CCMP |
psk | **** | **** | **** |
安全设置:WPA2-PSK
| [b]WPA2-PSK & TKIP | WPA2-PSK & AES | WPA2-PSK & TKIP+AES |
SSID | **** | **** | **** |
proto | RSN | RSN | RSN |
key_mgmt | WPA-PSK | WPA-PSK | WPA-PSK |
pairwise | TKIP | CCMP | TKIP CCMP |
psk | **** | **** | **** |
安全设置:WPA-PSK/WPA2-PSK
| WPA-PSK/WPA2-PSK & TKIP | WPA-PSK/WPA2-PSK & AES | WPA-PSK/WPA2-PSK & AES+TKIP |
SSID | **** | **** | **** |
proto | WPA RSN | WPA RSN | WPA RSN |
key_mgmt | WPA-PSK | WPA-PSK | WPA-PSK |
pairwise | TKIP | CCMP | TKIP CCMP |
psk | **** | **** | **** |
执行 :wpa_cli -i wlan0 -p /var/run/wpa_supplicant
注,--p /var/run/wpa_supplicant中的wpa_supplicant并不是可执行程序,而是个控制套接字。
此时会进入交互模式。其中交互模式的命令如下表:
Full command
Short command | Description | |
status | stat | displays the current connection status |
disconnect | disc | prevents wpa_supplicant from connecting to any access point |
quit | q | exits wpa_cli |
terminate | term | kills wpa_supplicant |
reconfigure | recon | reloads wpa_supplicant with the configuration file supplied (-c parameter) |
scan | scan | scans for available access points (only scans it, doesn't display anything) |
scan_result | scan_r | displays the results of the last scan |
list_networks | list_n | displays a list of configured networks and their status (active or not, enabled or disabled) |
select_network | select_n | select a network among those defined to initiate a connection (ie select_network 0) |
enable_network | enable_n | makes a configured network available for selection (ie enable_network 0) |
disable_network | disable_n | makes a configured network unavailable for selection (ie disable_network 0) |
remove_network | remove_n | removes a network and its configuration from the list (ie remove_network 0) |
add_network | add_n | adds a new network to the list. Its id will be created automatically |
set_network | set_n | shows a very short list of available options to configure a network when supplied with no parameters. See next section for a list of extremely useful parameters to be used with set_network and get_network. |
get_network | get_n | displays the required parameter for the specified network. See next section for a list of parameters |
save_config | save_c | saves the configuration |
如果您想连接的网络是没有加密的,您可以用下面的命令直接连接:
$ sudo iw dev wlan0 connect [网络 SSID]
如果网络是用 WEP 加密的,也非常容易:
$ sudo iw dev wlan0 connect [网络 SSID] key 0:[WEP 密钥]
相关文章推荐
- Ubuntu14.04配置使用无线连接WiFi热点
- ubuntu 使用命令行连接wifi
- Ubuntu 使用 wifi 连接上网
- ubuntu 10.04 使用wifi连接网络
- ubuntu 使用wicd network manager 管理 wifi 连接上网
- SecureCRT 使用SSH连接ubuntu时,很久才出来命令符。。
- Ubuntu 16.04 wifi创建安卓手机可连接——使用kde5-nm-connection-editor
- ubuntu基本命令使用及问题解答
- 使用C#调用外部Ping命令获取网络连接情况
- 使用C#调用外部Ping命令获取网络连接情况
- 使用vb.net连接到数据库并执行命令
- ubuntu关于驱动模块命令的一些使用
- 使用C#调用外部Ping命令获取网络连接情况
- Ubuntu命令使用技巧
- 使用C#调用外部Ping命令获取网络连接情况
- 使用C#调用外部Ping命令获取网络连接情况
- 使用C#调用外部Ping命令获取网络连接情况
- 如何通过使用 ADO.NET 2005 和 Visual C# 2005 或使用 ADO.NET 和 Visual C# .NET 连接到数据库并运行命令
- 使用C#调用外部Ping命令获取网络连接情况
- 使用C#调用外部Ping命令获取网络连接情况