In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to achieve Wifi connection in the command line under the Linux system". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to achieve Wifi connection in the command line of the Linux system".
Whenever you install a new Linux distribution system, it is generally recommended that you connect to the Internet through a wired connection.
There are two main reasons for this: first, your wireless network card may not have the correct driver installed and cannot be used; second, if you install the system from the command line, managing WiFi is very scary. I always try to avoid dealing with WiFi on the command line. But the world of Linux should have a fearless spirit. If you don't know how to do it, you need to move on, which is the only reason for writing this article. So I forced myself to learn how to manage WiFi connections on the command line.
There are of course many ways to set up a connection to WiFi from the command line, but in this article, it is also suggested that I use the most basic method: use the programs and tools included in the "default package" that are included in any release. Or I prefer to use this method. The obvious advantage of using this method is that the operation can be reused on any machine with a Linux system. The bad thing is that it is relatively complicated.
First of all, I assume that you have correctly installed the drivers for the wireless network card. Without this premise, everything in the follow-up is like a mirror. If you do not install your machine correctly, you should look at the wikis and documentation about your release.
You can then check which interface supports the wireless connection with the following command:
$iwconfig
Generally speaking, wireless interfaces are called wlan0. Of course, there are exceptions, but we will always use the general term in this tutorial.
Just in case, you need to make sure that the interface service is enabled:
$sudo ip link set wlan0 up
Once you have confirmed that the wireless interface is working, you can scan the nearby wireless network with the following command:
$sudo iw dev wlan0 scan | less
According to the results of the scan, you can get the name of the network (its SSID), the strength of its information, and which security encryption it uses (e.g. WEP, WPA/WPA2). From now on, it will be divided into two routes: the situation is good, the situation is easy, and the situation is slightly more complicated.
If the network you want to connect to is not encrypted, you can connect directly with the following command:
$sudo iw dev wlan0 connect [Network SSID]
If the network is encrypted with WEP, it is also very easy:
$sudo iw dev wlan0 connect [Network SSID] key 0: [WEP key]
But if the network uses the WPA or WPA2 protocol, things will not be easy. In this case, you have to use a tool called wpasupplicant, which is not available by default. Then you need to modify the / etc/wpasupplicant/wpa_supplicant.conf file by adding the following line:
Network= {ssid= "[Network ssid]" psk= "[password]" priority=1}
I suggest you add it at the end of the file and make sure that all other configurations are commented out. Note that SSID and password strings are case-sensitive. Technically, you can also think of the name of the access point as SSID, and if you use the wpa_supplicant tool, there will be an appropriate SSID to replace it.
Once the configuration file has been modified, start this command in the background:
$sudo wpa_supplicant-I wlan0-c / etc/wpa_supplicant/wpa_supplicant.conf
Finally, whether you connect to an open network or an encrypted secure network, you have to get an IP address. Simply use the following command:
$sudo dhcpcd wlan0
If all goes well, you should have obtained a new local IP through DHCP, which is done automatically in the background. If you want to confirm whether it is really connected, you can check it again by entering the following command:
$iwconfig
Finally, I think it is necessary to repeat the check operation of the first step many times. You never know when your graphical user interface is down, or when you can't access your wireless connection, so get ready to test it with commands now. Also, as mentioned earlier, there are many ways to manage wireless connections (such as NetworkManager, wicd, netcfg, wifi, and so on). I insist on using the most basic approach, but in some cases, the tools I use may not be available to you, so you have to download them before. On the other hand, there are many advanced applications that are really not included in the "default package", and using them will greatly simplify the operation. But the general advice is to start with the basics.
Thank you for your reading, the above is the content of "how to achieve Wifi connection in the command line under the Linux system". After the study of this article, I believe you have a deeper understanding of how to achieve Wifi connection on the command line under the Linux system. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.