Skip to content

Instantly share code, notes, and snippets.

@ag88
Last active April 16, 2024 06:38
Show Gist options
  • Save ag88/de02933ba65500376d1ff48e504b1bf3 to your computer and use it in GitHub Desktop.
Save ag88/de02933ba65500376d1ff48e504b1bf3 to your computer and use it in GitHub Desktop.
hostapd.conf for 2.4g or 5g 802.11ac on Orangepi Zero 3
  • install hostapd
    apt install hostapd  
    
  • configure hostapd
    /etc/hostapd/hostapd.conf
# the interface used by the AP
interface=wlan0

# bridge
bridge=br0

# "g" simply means 2.4GHz band
#hw_mode=g
# the channel to use
#channel=5

# "a" simply means 5Ghz
hw_mode=a
# the channel to use
channel=0
ieee80211ac=1
# limit the frequencies used to those allowed in the country
#ieee80211d=1
# the country code
#country_code=US

# 802.11n support
ieee80211n=1
# QoS support, also required for full speed on 802.11n/ac/ax
wmm_enabled=1

# the name of the AP
ssid=yourap_ssid

# 1=wpa, 2=wep, 3=both
auth_algs=1
# WPA2 only
wpa=2
wpa_key_mgmt=WPA-PSK
rsn_pairwise=CCMP
wpa_passphrase=your_wifi_passphrase_min_8_char

  • enable hostapd
    systemctl enable hostapd.service
    

note:

  • there is a bridge br0 that connects the ethernet interface end0 and wlan0.
    The bridge is configured outside this file independently.
    one possible config is to setup a bridge br0 that place both the wlan0 and end0 interfaces on the bridge. note hostapd will patch wlan0 into the bridge br0, so what needs to be configured onto the bridge is only end0 the ethernet interface. that could be done e.g. using network manager.

    note and warning you need to connect to the using a usb-uart (serial) dongle to the 'debug pins' using a terminal app e.g. https://www.youtube.com/watch?v=UpVMO7gbnYM
    if you don't you may be locked out while messing with the network configuration.

    e.g.

    nmcli con add connection.id bridge type bridge ifname br0
    nmcli con add connection.id br-eth type bridge-slave ifname end0 master br0
    nmcli con down "Wired connection 1"
    nmcli con del "Wired connection 1"
    #this is for dynamic (dhcp IP address)
    #nmcli c modify bridge ipv4.method auto
    #this is for fixed ip address, and assume that your gateway router is at 192.168.1.1
    nmcli c modify bridge ipv4.method manual ipv4.addresses 192.168.1.2/24 ipv4.gateway 192.168.1.1
    
  • disable wpa_supplicant

    systemctl stop wpa_supplicant.service
    systemctl disable wpa_supplicant.service  
    

    and reboot (preferably)

  • If network manager is managing wlan0, to use hostapd you may need to unmanage it. e.g. create a file /etc/NetworkManager/conf.d/99-unmanaged-devices.conf

    [keyfile]
    unmanaged-devices=interface-name:wlan0
    

    and reboot, or restart network manager

  • dhcpd if needed needs to be installed and configured separately

  • the same goes with routing / NAT etc if those are needed, those need to be configured separately

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment