wpa_supplicant and wifi in RHEL 7

If you have a desktop environment set up in Red Hat Enterprise Linux 7, chances are that you might have GNOME installed as it is the "default".  NetworkManager is pulled in as a dependency package of GNOME and it's integrated into gnome-shell in the top panel as a widget.  While NetworkManager is a great tool as it consolidates many different networking tools and facilitates the network configuration for many different use-cases, there might be instances where its broad reach becomes an obstacle rather than a benefit to system administrators.  One such instance is when dealing with network bridging.

Recently I was trying to set up a network bridge on my laptop, as it's equipped with a wifi adapter and an ethernet adapter, in order to dedicate the ethernet interface to a virtual machine in Red Hat 7--or at least to "share" it.  Bridged networking (also known as physical device sharing) is used to dedicate a physical device to a virtual machine. 

So, since we'll be using the ethernet interface for the virtual machine, we'll need to set up the wifi adapter with wpa_supplicant for use as the main NIC on the physical machine.  This can be achieved in three steps, though, most of the focus is on configuring wpa_supplicant correctly:

Disable NetworkManager (doesn't support bridged networking)

systemctl stop NetworkManager.service
systemctl disable NetworkManager.service

Configure wpa_supplicant

There are 3 files of concern in this step
  1. /etc/wpa_supplicant/wpa_supplicant.conf
  2. /etc/sysconfig/wpa_supplicant
  3. /etc/sysconfig/network-scripts/ifcfg-home

Create a backup of the original wpa_supplicant.conf and edit the file appending the following lines of code taken from the wpa_supplicant.conf man-pages' example for a "home network" that allows all cyphers

network={
                   ssid="home"
                   scan_ssid=1
                   key_mgmt=WPA-PSK
                   psk="very secret passphrase"
             }
 
There's actually an additional step here to encrypt your "very secret password" with the wpa_passphrase tool

wpa_passphrase home mypasswordhere 
 
Copy and paste the output of the above command into the wpa_supplicant.conf file in the "psk=" line.

Next, edit the file /etc/sysconfig/wpa_supplicant and add your network interface prepended with -i
INTERFACES="-iwlp3s0"
 
Lastly, create or edit the file in /etc/sysconfig/network-scripts/ifcfg-home
ESSID="home"                                                                                                                                                                                                                           [0/207]
MODE=Managed
KEY_MGMT=WPA-PSK
TYPE=Wireless
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME=home
UUID=YOUr-uUiD-HeRe
ONBOOT=yes
HWADDR=UR:MA:CA:HE:RE
SECURITYMODE=open
PEERDNS=yes
PEERROUTES=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes


Enable/Restart network 


systemctl enable network.service
systemctl restart network.service

If that doesn't automatically connect your adapter to your "home" network SSID, bring it up manually with
ifup home

Popular posts from this blog

Password Policy in RHEL 7

Centos 7 pulseaudio