Kablosuz Yığını
TEKNİK REHBER KABLOSUZ YIĞINI ACCESS POINT 2026

hostapd
access point modu.

Linux'u tam donanımlı bir WiFi access point'e dönüştür — bridge, DHCP, WPA3, MAC filtresi ve embedded router senaryosu.

00 hostapd nedir — mimarisi

hostapd (Host Access Point Daemon), Linux'ta WiFi NIC'yi AP moduna geçiren ve 802.11 kimlik doğrulama protokollerini yöneten kullanıcı alanı yazılımıdır.

  WiFi İstemciler (STA)
         ↓  (802.11 frames)
  WiFi sürücüsü + mac80211   →  AP modu interface (wlan0 / uap0)
         ↓  (nl80211 netlink)
  hostapd   →  kimlik doğrulama (WPA2/WPA3), beacon, association
         ↓
  bridge (br0) veya NAT/iptableseth0  →  uplink (internet)
    

hostapd iki temel işlev üstlenir: IEEE 802.11 yönetim çerçevelerini (beacon, probe, association, authentication) işlemek ve WPA/WPA2/WPA3 kimlik doğrulama protokollerini (4-way handshake, SAE) yürütmek. DHCP, DNS veya NAT hostapd'nin işi değildir — bunlar ayrı araçlarla (dnsmasq, iptables) sağlanır.

Kurulum

bash
# Debian / Ubuntu / Raspberry Pi OS
apt-get install hostapd

# Alpine Linux
apk add hostapd

# Buildroot: menuconfig → Networking → hostapd
# BR2_PACKAGE_HOSTAPD=y

# Versiyon kontrol
hostapd -v
# hostapd v2.10

# AP modu destekliyor mu? (nl80211 ile)
iw phy phy0 info | grep -A 10 "Supported interface modes"
# AP modu görünüyorsa hostapd çalışır

01 Temel AP kurulumu — hostapd.conf

hostapd.conf tek dosyada tüm AP ayarlarını barındırır. En minimal çalışan konfigürasyon şudur:

/etc/hostapd/hostapd.conf — minimal
# Wireless interface
interface=wlan0
driver=nl80211

# SSID
ssid=EmbeddedAP

# 802.11g modu, 2.4 GHz
hw_mode=g
channel=6

# WPA2 şifrelemesi
wpa=2
wpa_passphrase=gizli-sifre
wpa_key_mgmt=WPA-PSK
rsn_pairwise=CCMP

hostapd başlatma

bash
# Ön plan (debug için) — Ctrl+C ile durdur
hostapd /etc/hostapd/hostapd.conf

# Arka planda
hostapd -B /etc/hostapd/hostapd.conf

# Debug modu (-d: verbose, -dd: daha fazla)
hostapd -d /etc/hostapd/hostapd.conf

# systemd ile
systemctl unmask hostapd
systemctl enable --now hostapd

# hostapd_cli ile bağlı istemcileri gör
hostapd_cli all_sta

02 SSID, şifre, kanal ve frekans bandı

2.4 GHz ve 5 GHz band seçimi, kanal, güç ve 802.11 modları detaylı konfigürasyon gerektirir.

2.4 GHz — 802.11n (HT)

/etc/hostapd/hostapd.conf — 2.4 GHz 802.11n
interface=wlan0
driver=nl80211
ssid=EmbeddedAP_2G
country_code=TR

# 2.4 GHz, 802.11n
hw_mode=g
channel=6                   # 1, 6 veya 11 (örtüşmeyen kanallar)
ieee80211n=1                # HT (High Throughput) etkinleştir
ht_capab=[HT40+][SHORT-GI-20][SHORT-GI-40]

# WPA2
wpa=2
wpa_passphrase=embedded2024
wpa_key_mgmt=WPA-PSK
rsn_pairwise=CCMP

# Maksimum istemci sayısı
max_num_sta=20

# Beacon aralığı (ms)
beacon_int=100

5 GHz — 802.11ac (VHT)

/etc/hostapd/hostapd.conf — 5 GHz 802.11ac
interface=wlan0
driver=nl80211
ssid=EmbeddedAP_5G
country_code=TR

# 5 GHz, 802.11ac
hw_mode=a
channel=36                  # 36, 40, 44, 48 (UNII-1), 149-165 (UNII-3)
ieee80211n=1
ieee80211ac=1               # VHT (Very High Throughput)
ht_capab=[HT40+][SHORT-GI-20][SHORT-GI-40]
vht_capab=[SHORT-GI-80][SU-BEAMFORMER][SU-BEAMFORMEE]
vht_oper_chwidth=1          # 80 MHz kanal genişliği
vht_oper_centr_freq_seg0_idx=42

wpa=2
wpa_passphrase=embedded5G2024
wpa_key_mgmt=WPA-PSK
rsn_pairwise=CCMP
hw_mode=g
2.4 GHz 802.11g/n. hw_mode=a 5 GHz 802.11a/n/ac için.
channel=6
Kanal numarası. channel=0 ile ACS (otomatik kanal seçimi) etkinleştirilebilir.
ieee80211n=1
802.11n (HT) modu — MIMO ve channel bonding.
ieee80211ac=1
802.11ac (VHT) modu — 5 GHz, 80/160 MHz kanallar.
country_code=TR
Regulatory domain. Ülkeye göre izin verilen kanallar ve güç sınırları değişir.

03 Bridge modu — br0 + wlan0 + eth0

Bridge modda WiFi istemciler ve ethernet cihazlar aynı L2 ağda görünür. NAT gerekmez — upstream router'dan direkt IP alınır.

  WiFi İstemciler         Ethernet İstemciler
       wlan0                    eth0
         \                       /
          \                     /
           br0 (bridge)  ←→  upstream router / internet
    

Bridge oluşturma

bash — iproute2 ile bridge
# Bridge interface oluştur
ip link add name br0 type bridge
ip link set br0 up

# eth0'ı bridge'e ekle
ip link set eth0 master br0

# wlan0'ı yukarı al (hostapd ekleyecek)
ip link set wlan0 up

# br0'a IP ata (DHCP)
dhclient br0

# Bridge tablolarını kontrol et
bridge fdb show

hostapd.conf — bridge modu

/etc/hostapd/hostapd.conf — bridge
interface=wlan0
bridge=br0              # Bridge interface adı
driver=nl80211
ssid=EmbeddedRouter
country_code=TR

hw_mode=g
channel=6
ieee80211n=1

wpa=2
wpa_passphrase=router-sifre
wpa_key_mgmt=WPA-PSK
rsn_pairwise=CCMP

/etc/network/interfaces ile kalıcı bridge

/etc/network/interfaces
# eth0 bridge'e bağlı
auto eth0
iface eth0 inet manual
    pre-up ip link set eth0 up

# br0 DHCP ile IP al
auto br0
iface br0 inet dhcp
    bridge_ports eth0
    bridge_stp off
    bridge_fd 0
    bridge_waitport 0
DİKKAT

Bridge modda STP (Spanning Tree Protocol) genellikle kapatılır (bridge_stp off). Embedded sistemlerde STP gecikme ekler. Sadece loop olmayan topolojilerde STP'yi devre dışı bırak.

04 DHCP server entegrasyonu — dnsmasq

dnsmasq hem DHCP hem DNS hizmeti verir — embedded router için tek pakette her şey.

dnsmasq kurulum ve konfigürasyon

bash
apt-get install dnsmasq

# Mevcut dnsmasq servisini durdur
systemctl stop dnsmasq
/etc/dnsmasq.conf — AP + DHCP
# Sadece wlan0 üzerinde dinle (bridge yoksa)
interface=wlan0
# bind-interfaces ile diğer interface'lere müdahale etme
bind-interfaces

# DHCP havuzu: 192.168.50.10 - 192.168.50.100, 24h kiralama
dhcp-range=192.168.50.10,192.168.50.100,255.255.255.0,24h

# Gateway ve DNS sun
dhcp-option=3,192.168.50.1      # router (gateway)
dhcp-option=6,8.8.8.8,8.8.4.4  # DNS sunucuları

# Sabit IP ataması (MAC bazlı)
dhcp-host=aa:bb:cc:dd:ee:ff,sensor-node,192.168.50.200

# Log DHCP işlemlerini
log-dhcp

# DNS cache boyutu
cache-size=150

wlan0'a statik IP ve NAT

bash — NAT router kurulumu
# wlan0'a gateway IP ata
ip addr add 192.168.50.1/24 dev wlan0
ip link set wlan0 up

# IP forwarding etkinleştir
sysctl -w net.ipv4.ip_forward=1
# Kalıcı: /etc/sysctl.conf → net.ipv4.ip_forward=1

# NAT: wlan0'dan gelen trafiği eth0'dan çıkar
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT
iptables -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT

# dnsmasq başlat
systemctl start dnsmasq

# hostapd başlat
hostapd -B /etc/hostapd/hostapd.conf

05 WPA3/SAE konfigürasyonu

WPA3-Personal (SAE) ve WPA3-Enterprise, modern AP'lerin standart güvenlik modudur.

WPA3-SAE (Personal)

/etc/hostapd/hostapd.conf — WPA3-SAE
interface=wlan0
driver=nl80211
ssid=SecureAP_WPA3
country_code=TR

hw_mode=g
channel=6
ieee80211n=1

# WPA3-SAE
wpa=2
wpa_key_mgmt=SAE
rsn_pairwise=CCMP
sae_password=guclu-wpa3-sifre

# PMF (Protected Management Frames) zorunlu — WPA3 gerektirir
ieee80211w=2

# SAE parametreleri
sae_require_mfp=1
sae_pwe=2               # Hash-to-element yöntemi (dragonfly)

WPA2/WPA3 geçiş modu (transition mode)

/etc/hostapd/hostapd.conf — geçiş modu
interface=wlan0
driver=nl80211
ssid=HybridAP
country_code=TR

hw_mode=g
channel=6
ieee80211n=1

# Hem WPA2-PSK hem WPA3-SAE kabul et
wpa=2
wpa_key_mgmt=WPA-PSK SAE
rsn_pairwise=CCMP
wpa_passphrase=ortak-sifre
sae_password=ortak-sifre

# PMF isteğe bağlı (transition mode için)
ieee80211w=1
KERNEL GEREKSİNİMİ

WPA3-SAE için kernel 4.17+ ve hostapd 2.7+ gerekir. Raspberry Pi 4 / CM4 üzerinde brcmfmac sürücüsü WPA3'ü destekler. Eski bcm43xx sürücüsü desteklemeyebilir — iw phy phy0 info | grep SAE ile kontrol et.

06 Gizli SSID ve MAC filtresi

SSID broadcast'i kapat veya yalnızca belirli cihazların bağlanmasına izin ver.

Gizli SSID (Hidden)

/etc/hostapd/hostapd.conf — gizli SSID
interface=wlan0
driver=nl80211
ssid=GizliAg
country_code=TR
hw_mode=g
channel=6

# SSID'yi beacon'da yayınlama
ignore_broadcast_ssid=1
# 0 = yayınla (varsayılan)
# 1 = SSID'yi gizle (boş SSID beacon)
# 2 = beacon'ı tamamen gönderme

wpa=2
wpa_passphrase=gizli-ag-sifre
wpa_key_mgmt=WPA-PSK
rsn_pairwise=CCMP
GÜVENLİK NOTU

Gizli SSID gerçek anlamda güvenlik sağlamaz — pasif tarama araçları (airodump-ng, iw scan) probe request'lerden SSID'yi kolayca bulur. Gerçek güvenlik için WPA3 veya MAC filtresi kullan.

MAC adres filtresi

/etc/hostapd/hostapd.conf — MAC filtresi
interface=wlan0
driver=nl80211
ssid=GuvenliAP
country_code=TR
hw_mode=g
channel=6

wpa=2
wpa_passphrase=guvenli-sifre
wpa_key_mgmt=WPA-PSK
rsn_pairwise=CCMP

# MAC filtresi
macaddr_acl=1               # 0=devre dışı, 1=whitelist, 2=blacklist
accept_mac_file=/etc/hostapd/mac_whitelist
# deny_mac_file=/etc/hostapd/mac_blacklist
/etc/hostapd/mac_whitelist
# İzin verilen cihazlar (bir satır = bir MAC)
aa:bb:cc:dd:ee:01
aa:bb:cc:dd:ee:02
aa:bb:cc:dd:ee:03
# Raspberry Pi'lar ve sensor node'lar
dc:a6:32:xx:xx:xx

Runtime MAC yönetimi (hostapd_cli)

bash
# Bağlı tüm istemcileri gör
hostapd_cli all_sta

# Belirli istemciyi kick et (bağlantısını kes)
hostapd_cli deauthenticate aa:bb:cc:dd:ee:ff

# MAC'i blacklist'e ekle
hostapd_cli deny_acl ADD_MAC aa:bb:cc:dd:ee:ff

# Whitelist'e ekle
hostapd_cli accept_acl ADD_MAC aa:bb:cc:dd:ee:ff

07 HTCapab ve bant genişliği kontrolü

HT Capabilities, 802.11n'in hangi özelliklerini kullanacağını belirtir. Doğru ayar throughput'u önemli ölçüde etkiler.

Yaygın HTCapab değerleri

[HT40+]
40 MHz kanal bonding (yukarı). Kanal 1-7 için. İki kat throughput potansiyeli.
[HT40-]
40 MHz kanal bonding (aşağı). Kanal 5-13 için.
[SHORT-GI-20]
Short Guard Interval — 20 MHz kanalda %11 throughput artışı.
[SHORT-GI-40]
Short Guard Interval — 40 MHz kanalda.
[TX-STBC]
Space-Time Block Coding — sinyal güvenilirliği artar (çift anten gerektirir).
[RX-STBC1]
1 stream RX STBC.
[DSSS_CCK-40]
40 MHz kanalda eski DSSS/CCK istemci desteği.
[LDPC]
Low Density Parity Check — hata düzeltme iyileştirmesi.
/etc/hostapd/hostapd.conf — 802.11n tam örnek
interface=wlan0
driver=nl80211
ssid=PerformansAP
country_code=TR

hw_mode=g
channel=6
ieee80211n=1
ieee80211d=1            # 802.11d regulatory domain advertisement
ieee80211h=0            # DFS devre dışı (2.4 GHz gerekmiyor)

# Raspberry Pi 4 brcmfmac için tipik HTCapab
ht_capab=[HT40+][SHORT-GI-20][SHORT-GI-40][TX-STBC][RX-STBC1][DSSS_CCK-40]

wpa=2
wpa_passphrase=performans123
wpa_key_mgmt=WPA-PSK
rsn_pairwise=CCMP

Per-station rate limiting (tc ile)

bash — Traffic Control ile bant kısıtlama
# Her istemciyi sınırlamak için hostapd_cli + tc kullan
# wlan0 interface'ine HTB qdisc ekle
tc qdisc add dev wlan0 root handle 1: htb default 10

# Genel sınır: 10 Mbit/s
tc class add dev wlan0 parent 1: classid 1:1 htb rate 10mbit

# hostapd.conf içinde per-STA rate limit (kernel 5.x+)
# vlan_file ve per-STA psk ile daha granüler kontrol mümkün

08 Embedded router senaryosu ve debug

Raspberry Pi veya custom SBC'yi tam WiFi router'a dönüştürme — baştan sona tam senaryo.

Tam embedded router konfigürasyonu

/etc/hostapd/hostapd.conf — embedded router
interface=wlan0
driver=nl80211
ssid=EmbeddedRouter_IoT
country_code=TR

hw_mode=g
channel=1
ieee80211n=1
ht_capab=[HT40+][SHORT-GI-20][SHORT-GI-40]

wpa=2
wpa_passphrase=iot-router-pass
wpa_key_mgmt=WPA-PSK
rsn_pairwise=CCMP

# IoT için ek ayarlar
max_num_sta=50          # Çok sayıda sensör için
ap_max_inactivity=300   # 5 dakika inaktif kalırsa kick et
dtim_period=2           # Power save için DTIM
beacon_int=100
bash — tam başlatma scripti
#!/bin/sh
# /usr/local/bin/start-ap.sh — embedded router başlatma

set -e

# Interface hazırlığı
ip link set wlan0 up
ip addr flush dev wlan0
ip addr add 192.168.100.1/24 dev wlan0

# IP forwarding
sysctl -w net.ipv4.ip_forward=1

# NAT
iptables -t nat -F
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT
iptables -A FORWARD -i eth0 -o wlan0 -m state \
    --state RELATED,ESTABLISHED -j ACCEPT

# dnsmasq
dnsmasq --conf-file=/etc/dnsmasq-ap.conf

# hostapd
hostapd -B /etc/hostapd/hostapd.conf -P /run/hostapd.pid

echo "AP hazır: 192.168.100.1"

hostapd -d çıktısını okuma

bash — debug çıktısı
hostapd -d /etc/hostapd/hostapd.conf 2>&1 | head -50

# Önemli mesajlar:
# "AP-ENABLED" → AP başarıyla başladı
# "AP-STA-CONNECTED aa:bb:cc:dd:ee:ff" → istemci bağlandı
# "AP-STA-DISCONNECTED aa:bb:cc:dd:ee:ff" → istemci ayrıldı
# "nl80211: operstate 0→6 (IF_OPER_UP)" → interface hazır
# "Could not set channel" → kanal desteklenmiyor veya regulatory sorun
# "Failed to set beacon parameters" → sürücü AP modunu desteklemiyor

# Sadece connection event'leri izle
hostapd -d /etc/hostapd/hostapd.conf 2>&1 | \
    grep -E "CONNECTED|DISCONNECTED|ENABLED|DISABLED"

Sık karşılaşılan sorunlar

bash — sorun giderme
# Sorun: "AP mode not supported"
iw phy phy0 info | grep "Supported interface modes" -A 10
# AP satırı yoksa sürücü AP modunu desteklemiyor

# Sorun: "nl80211: Could not configure driver mode"
# Çözüm: wpa_supplicant'ı önce durdur
systemctl stop wpa_supplicant
systemctl stop NetworkManager

# Sorun: regulatory/channel hatası
iw reg get
# country_code'un doğru ayarlandığından emin ol
iw reg set TR

# Sorun: interface rfkill ile bloklu
rfkill list
rfkill unblock wifi
RASPBERRY PI 4 NOTU

RPi 4'te brcmfmac sürücüsü hem 2.4 GHz hem 5 GHz AP modunu destekler. Aynı anda iki band için iki ayrı hostapd örneği çalıştırabilirsin: wlan0 için 2.4 GHz, wlan0_1 (sanal) için 5 GHz. Bunun için firmware'in virtual interface desteği olması gerekir.