why can't this CentOS 7 server see wifi connections?
When I use the Network Manager Command Line Tool nmcli, I get the following, which indicates that nmcli has wifi enabled, but that it cannot see any wifi connections:
Not at all. They only say that you haven't configured any wifi connection. You need to use other commands to check wifi connections and connect to wifi.
Make sure NetworkManager supports wifi and manages the wireless device
wlp3s0 wifi unmanaged --
This is a problem. If NetworkManager doesn't manage your wireless ethernet controller then you cannot expect it to see wifi networks and connect to them. NetworkManager would normally manage all devices automatically after a fresh boot.
You might want to check presence of the wifi package. If you don't have that package installed, you don't have wifi support in NetworkManager.
rpm -q NetworkManager-wifi
In that case you have to temprarily use an ethernet connection or transfer the RPM via other means.
yum install NetworkManager-wifi
systemctl restart NetworkManager
Connect using nmcli
To view available wifi networks:
nmcli dev wifi list
To connect to a wifi network called TestWifi:
nmcli --ask dev wifi connect TestWifi
Connect using nmtui
I also just successfully tried to view wifi networks in nmtui
(not in CentOS but it should work). Choosing Activate new connection was enough to see the list of available wifi networks.
Even though your system recognizes the wireless interface, you still need a package in order to manage it. Generally for CentOS, I use WPA Supplicant. It includes the tools you'd use to enable/disable/etc the interface.
A writeup is here on the CentOS wiki.
You can download the WPA Supplicant packages from various locations. I used RPMfind.net.
For reference, here are the instructions on configuring WPA Supplicant after installation. (taken from the above wiki)
Enabling wpa_supplicant without NetworkManager, updated version
This update is a simpler method to have a wifi interface connect automatically during the boot process. The original version is available below for reference.
Why an updated version?
- Simpler to implement
- More complete instructions
- Does not change files overwritten by system updates
- Supports "service network restart" to re-establish a connection
Edit /etc/sysconfig/network-scripts/ifcfg- file
Run iwconfig to find the wifi device. In this sample output, wlan0 is the only one that supports wifi.
# iwconfig
lo no wireless extensions.
wlan0 IEEE 802.11bgn ESSID:"NETWORKSSID"
Mode:Managed Frequency:2.462 GHz Access Point: 68:7F:74:AD:F3:3C
Bit Rate=54 Mb/s Tx-Power=16 dBm
Retry long limit:7 RTS thr:off Fragment thr:off
Encryption key:off
Power Management:on
Link Quality=50/70 Signal level=-60 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:90 Missed beacon:0
eth0 no wireless extensions.
pan0 no wireless extensions.
virbr0 no wireless extensions.
virbr0-nic no wireless extensions.
#
Edit the ifcfg for this interface. For example, using wlan0.
/etc/sysconfig/network-scripts/ifcfg-wlan0
Verify that the ONBOOT selection is enabled.
ONBOOT="yes"
Edit /etc/sysconfig/wpa_supplicant
Ensure that your device is included in the INTERFACES line in this file. In this example wlan0 is the only device supported by wpasupplicant.
# Use the flag "-i" before each of your interfaces, like so:
# INTERFACES="-ieth1 -iwlan0"
INTERFACES="-iwlan0"
Edit /etc/wpa_supplicant/wpa_supplicant.conf
Most of your networks will require a single entry in wpa_supplicant.conf that looks like this. Replace NETWORKSSID and NETWORKPSK with the proper values for each network. Put them in the order that you want them used.
network={
ssid="NETWORKSSID"
scan_ssid=1
key_mgmt=WPA-PSK
psk="NETWORKPSK"
}
Here is an example of a network which doesn't require a Pre Shared Key. If this appears before the "any" network it will be preferred to other open networks.
network={
ssid="PUBLIC"
key_mgmt=NONE
}
A final option (which you may not choose to implement) will let you connect to any network that is open. This is useful in hotels, but may allow connections to undesirable networks.
network={
key_mgmt=NONE
}
Create /etc/rc5.d/S09prepnet
Paste the following text to create a new file which will prepare the running services for a wifi connection.
cat > /etc/init.d/prepnet <<EoT
#!/bin/sh
/etc/init.d/messagebus start
/etc/init.d/wpa_supplicant start
killall dhclient >/dev/null 2>&1
EoT
chmod a+rx /etc/init.d/prepnet
ln -s /etc/init.d/prepnet /etc/rc3.d/S09prepnet
ln -s /etc/init.d/prepnet /etc/rc5.d/S09prepnet
Configure services to run at boot
Paste the following commands to configure services.
chkconfig messagebus off
chkconfig wpa_supplicant off
chkconfig NetworkManager off
chkconfig network on
Reboot to enable
Upon the next reboot your wifi connection is enabled when network services start.
Adding or editing wifi networks
If you need to add or edit a wifi network, make whatever changes are needed in wpa_supplicant.conf.
/etc/wpa_supplicant/wpa_supplicant.conf
Next restart wpa_supplicant and network services.
service wpa_supplicant restart
service network restart