Skip to content

Instantly share code, notes, and snippets.

@jaj42
Created March 30, 2022 20:05
Show Gist options
  • Select an option

  • Save jaj42/2734198740c7396c256fff7f1ce677b1 to your computer and use it in GitHub Desktop.

Select an option

Save jaj42/2734198740c7396c256fff7f1ce677b1 to your computer and use it in GitHub Desktop.
Configure Raspberry Pi access point

Configure Raspberry Pi access point

raspi-config

  • set wifi country code

rfkill

  • rfkill unblock wlan

Installs

  • apt install dnsmasq
  • apt install dhcpcd5
  • apt install hostapd
  • systemctl unmask hostapd
  • systemctl enable hostapd

Config files

  • /etc/dhcpcd.conf
interface wlan0
    static ip_address=10.1.1.1/24
    nohook wpa_supplicant
  • /etc/dnsmasq.conf
interface=wlan0
  dhcp-range=10.1.1.101,10.1.1.199,255.255.255.0,24h
  • /etc/default/hostapd
DAEMON_CONF="/etc/hostapd/hostapd.conf"  
  • /etc/hostapd/hostapd.conf
country_code=FR
interface=wlan0
driver=nl80211
hw_mode=g
channel=7
wmm_enabled=0
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
ssid=$ssid
wpa_passphrase=$wpapsk

Routing

  • /etc/sysctl.d/routed-ap.conf
# Enable IPv4 routing
net.ipv4.ip_forward=1
  • iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
  • netfilter-persistent save

Reboot

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