Raspberry Pi - set up as LAN access point

in raspberry •  2 days ago 

Alternative: https://raspap.com/

--

  1. Enable wifi by setting country code => https://steemit.com/raspberry/@corvex/raspberry-pi-stuff

  2. update
    => sudo apt update && sudo apt upgrade -y

  3. Install hostapd & dnsmasq
    => sudo apt install -y hostapd dnsmasq

  4. Configure Static IP for WiFi
    => sudo nano /etc/dhcpcd.conf
    add following at the EOF:
    --
    interface wlan0
    static ip_address=192.168.4.1/24
    nohook wpa_supplicant
    --
    => sudo service dhcpcd restart

  5. Configure hostapd
    => sudo nano /etc/hostapd/hostapd.conf
    add:
    --
    interface=wlan0
    driver=nl80211
    ssid=YourNetworkName
    hw_mode=g
    channel=7
    macaddr_acl=0
    auth_algs=1
    ignore_broadcast_ssid=0
    wpa=2
    wpa_passphrase=YourSecurePassword
    wpa_key_mgmt=WPA-PSK
    rsn_pairwise=CCMP
    --
    => sudo nano /etc/default/hostapd
    update following line
    --
    DAEMON_CONF="/etc/hostapd/hostapd.conf"
    --

  6. Config dnsmasq
    => sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.bak
    => sudo nano /etc/dnsmasq.conf
    add
    --
    interface=wlan0
    dhcp-range=192.168.4.2,192.168.4.20,255.255.255.0,24h
    --

  7. Enable IP Forwarding (if needed)
    => sudo nano /etc/sysctl.conf
    uncomment this line:
    --
    net.ipv4.ip_forward=1
    --
    => sudo sysctl -p

  8. Restart services
    => sudo systemctl unmask hostapd
    => sudo systemctl enable hostapd
    => sudo systemctl start hostapd
    => sudo systemctl restart dnsmasq

############################################

If the dnsmasq service starts before the wlan0 gets initialized, do this aswell:

=> sudo mkdir -p /etc/systemd/system/dnsmasq.service.d/
=> sudo nano /etc/systemd/system/dnsmasq.service.d/override.conf
add following
--
[Unit]
After=network.target network-online.target
Wants=network-online.target
--

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!