Orange PI as a Hotspot

Setting up an Orange Pi Zero 3 as a Wifi Hotspot

OPZ3 By default, the OrangePi Zero 3 (OPZ3) has a Gigabit lan adapter and a Wifi chip, making it the perfect little gizmo to configure as a Hotspot. The following is what was done to set it up.

The basic stuff

  • Orange Pi Zero 3 - 1GB version
  • 64GB SD Card as boot and storage
  • Armbian Ubuntu 24.04 for OPZ3 LINK Server image (Build Date: May 28, 2025)

Screenshot

Getting ready

  • Boot up Armbian and SSH into the OPZ3 (I found the IP by looking into my router and seeing what devices are connected)
  • Default login/password is root/1 2 3 4 (without the spaces)
    • used bash shell
    • created a user named “user”
    • All subsequent steps here are done with “user” account
  • Get all the updates done (apt-get update/apt-get upgrade) and reboot
    • The updates/upgrades will take a while
    • I think the updates fixed a problem where the OPZ3 occasionally reports having 2GB instead of 1GB (remember, my model is 1GB)
      • If not you probably should install a horrible kludge available on the net to force a reboot during the startup if 2GB mistakenly is detected
    • Do reboot after the upgrade - sudo shutdown -r now
      • Kernel should be upgraded after the reboot (mine was to 6.12.35)
  • The LAN is connected to the internet (basically my home router) and by default, gets it’s IP via DHCP
  • Install vim, if vi is your go to editor

    DHCPD - the DHCP server

    Next install the DHCP server to give out IPs for our Hotspot

sudo apt install isc-dhcp-server
  • Backup the original dhcpd.conf file
  • Create a new dhcpd.conf file
option domain-name "Hottspot.local";
option domain-name-servers dns.Hottspot.local;
default-lease-time 600;
max-lease-time 7200;
ddns-update-style none;
authoritative;
log-facility local7;

subnet 192.168.100.0 netmask 255.255.255.0 {
    interface wlan0;
	range 192.168.100.100 192.168.100.200;
	option routers 192.168.100.1;
	option subnet-mask 255.255.255.0;
	option domain-name-servers 8.8.8.8, 1.1.1.1, 9.9.9.9;
}
  • Restart the dhcpd server sudo /etc/init.d/isc-dhcp-server restart and check it’s status after restart sudo /etc/init.d/isc-dhcp-server status

  • You’ll see that dhcpd is grumbling about wlan0 missing an interface address
  • Force in an interface address (does not survive a reboot, so we’ll have to make something more permanent later) sudo ip address add 192.168.100.1/24 dev wlan0
  • Restart the dhcpd server again, and the compliant should be gone
  • You could do an ip a to check that the IP is set

    Set up WPA_SUPPLICANT

    The apparently sets the WIFI to a listen as a hotspot. We don’t need to install hostapd to act as the hotspot listener.

  • Create configuration into /etc/wpa_supplicant
sudo -i
cat > /etc/wpa_supplicant/wpa_supplicant-wlan0.conf <<EOF
country=DE
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
    ssid="CraigNet"
    mode=2
    frequency=2437
    #key_mgmt=NONE   # uncomment this for an open hotspot
    # delete next 3 lines if key_mgmt=NONE
    key_mgmt=WPA-PSK
    proto=RSN WPA
    psk="PassworD"
}
EOF
  • SSID and password to connect to hotspot specified in the above config file
  • Enable and remove wifi block
    sudo chmod 600 /etc/wpa_supplicant/wpa_supplicant-wlan0.conf
    sudo systemctl disable wpa_supplicant.service
    sudo systemctl enable wpa_supplicant@wlan0.service
    sudo rfkill unblock wlan
    
  • Setup the interfaces file
    sudo -i
    cat >> /etc/network/interfaces <<DELIM
    allow-hotplug wlan0
    iface wlan0 inet static
    address 192.168.100.1
    netmask 255.255.255.0
    DELIM
    
  • reboot
  • The SSID should now show up when you do a wifi scan
  • Since you rebooted the OPZ3, the IP address of the Wifi is lost. Do it again:
     sudo ip address add 192.168.100.1/24 dev wlan0
    
  • At this point, you should be able to connect to the Wifi, get an IP address (probably 192.168.100.100) and be able to ping the gateway (192.168.100.1)
  • Conversely, the gateway should be able to ping your connected device
  • The connected device is still unable to access the internet as you’ve yet to configure…

    Routing traffic across nets and to the internet

  • Edit /etc/sysctl.d/99-sysctl.conf
     #net.ipv4.ip_forward=1    <----uncomment this
     #net.ipv6.conf.all.forwarding=1     <---- uncomment this too
    
  • Reboot
  • Yes. The IP of the Wifi is lost again, Set it up again
  • Add the additional configurations to the iptables
     sudo iptables -t nat -A POSTROUTING -o end0 -j MASQUERADE
    sudo iptables -A FORWARD -i end0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT
    sudo iptables -A FORWARD -i wlan0 -o end0 -j ACCEPT
    
  • At this point, you should be able to connect to the AP and surf the internet
  • The iptables do not survive a reboot, so we’ll need to install iptables-persistent
     sudo apt install iptables-persistent
    
    • During installation, you’ll be asked if you want to save the current IPv4 rules, select Yes
    • You can select No for the IPv6 rules
    • looking into the created /etc/iptables/rules.v4 file, you’ll see the iptables rules that were previously created
  • Finally create a crontab entry for root that will setup the IP of the WLAN on startup
    sudo -i
    crontab -e
    

add this to the end of the crontab and save

@reboot /root/ipUP 2>&1

Create the script to set up the ip for the WLAN

sudo vi /root/ipUP

Insert

#!/bin/bash
ip address add 192.168.100.1/24 dev wlan0

Save and close the file, then set it to executable

sudo chmod 0700 /root/ipUP
  • REBOOT!!! Should all be fine now

    Notes

  • Change the channel of the AP by changing the frequency parameter in the wpa_supplicant config file
    • See the available channels and frequencies using iw phy The 2.4GHz frequencies start with 24xx Mhz The 5GHz frequencies start wiht 5xxx Mhz You can’t use the disabled or radar frequencies
  • There really must be a better way to setup the IP address of the Wifi, but the crontab solution works
  • You may really have to install the kludge for the 1GB being reported as 2GB issue. I’ve seen it happen from time to time
  • armbian-config has an option to configure an AP, but I’ve not been able to get it to work
  • RaspAP looks a lot better, and has plenty of features, but needs an earlier version of Ubuntu

References

General configuration for dhcpd

General configuration for wpa_supplicant

Adding the interface entry to the dhcpd.conf file

Saving rules in iptables

1GB reported as 2GB on the OPZ3

Written on July 8, 2025