How to install a WLAN access point on Fedora
First steps
yum install hostapd dnsmasq
The WLAN adapter is then configured. First you need to check whether the adapter is online:
[root@seger~]# iwconfig
wlan0 IEEE 802.11bgn ESSID: off/any
Mode: Managed Access Point: Not-Associated Tx-Power=0 dBm
Retry short limit: 7 RTS thr:off Fragment thr:off
Encryption key: off
Power Management: off
lo no wireless extensions.
eth0 no wireless extensions.
Now you need to check whether the Network Manager (NM) has control over the device:
[root@seger~] # nmcli -p r
======================================
Radio switches
======================================
WIFI-HW WIFI WWAN-HW WWAN
--------------------------------------
enabled enabled enabled disabled
If it is activated, it must be deactivated with the nmcli:
[root@seger~] # nmcli r wifi off
The NM sets the killswitch to “on”, so we have to set it to off again to reactivate the WLAN outside the NM.
[root@seger~] # rfkill unblock wlan
After this step, we have an active WLAN card without interference from the NM.
Configure hostapd
# Einige verwendbare Standardeinstellungen ...
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
# Kommentieren Sie diese für Basis WPA & WPA2-Unterstützung mit einem Pre-Shared Key
wpa=3
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
# NICHT VERGESSEN EIN WPA-PASSPHRASE EINZURICHTEN!!
wpa_passphrase=
# Die meisten modernen WLAN-Treiber im Kernel benötigen driver=nl80211
driver=nl80211
# Passen Sie diese Einstellungen für Ihre lokale Konfiguration an...
interface=wlan0
hw_mode=g
channel=
ssid=
ieee80211n=1
After that the whole thing can be started:
[root@seger ~] # systemctl start hostapd.service
[root@seger~] # systemctl status hostapd.service
hostapd.service - Hostapd IEEE 802.11 AP, IEEE 802.1X / WPA / WPA2 / EAP / RADIUS Authenticator
Loaded: geladene (/usr/lib/systemd/system/hostapd.service; disabled)
Aktiv: aktiv (läuft), da Fr 2014.08.01 13.24.08 CEST; Vor 4s
Prozess: 12208 ExecStart=/usr/sbin/hostapd/etc/hostapd/hostapd.conf -P /run/hostapd.pid -B (code=exited, status=0/SUCCESS)
Haupt PID: 12209 (hostapd)
CGroup: /system.slice/hostapd.service
└─12209 /usr/sbin/hostapd/etc/hostapd/hostapd.conf -P /run/hostapd.pid -B
1. August 13.24.08 seger systemd[1]: Gestartet Hostapd IEEE 802.11 AP, IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator.
Configure DNSMASQ
The main configuration options:
server=10.159.14.14 # Upstream DNS
interface=wlan0
dhcp-range=192.168.23.50,192.168.23.150,12h
no-resolv
no-Umfrage
Configure firewall
# Setzen Sie die Schnittstelle in einer Zone
firewall-cmd --zone=public --add-interface=wlan0
# MASQ Aktivieren für diese Zone
firewall-cmd --zone=public --add-masquerade
# Lassen Sie DHCP
firewall-cmd --zone=public --add-service=dhcp
# Zulassen DNS
firewall-cmd --zone=public --add-service=dns
Connect everything
#!/bin/bash
# WLAN sollte nicht mehr von Network Manager verwaltet werden
nmcli r wifi off
# WLAN Entblocken
rfkill unblock wlan
# Rufen Sie die Schnittstelle aufifconfig wlan0 192.168.23.1 Netzmaske 255.255.255.0 up
# IP forward aktivieren
## -> bereits aktiviert!
# Setzen Sie die Schnittstelle in einer Zone
firewall-cmd --zone=public --add-interface=wlan0
# MASQ für diese Zone aktivieren
firewall-cmd --zone=public --add-masquerade
# DHCP erlauben
firewall-cmd --zone=public --add-service=dhcp
# DNS erlauben
firewall-cmd --zone=public --add-service=dns
# hostapd und dnsmasq startensystemctl start hostapd.service
systemctl start dnsmasq.service
That’s it, have fun with the WLAN access point!