Template:HOSTAPD ACCESS POINT: Difference between revisions

From Variscite Wiki
No edit summary
 
(5 intermediate revisions by the same user not shown)
Line 8: Line 8:
dnsmasq is a suitable option for providing DHCP and DNS services alongside hostapd. It's a lightweight DNS forwarder and DHCP server that can be easily integrated with hostapd.
dnsmasq is a suitable option for providing DHCP and DNS services alongside hostapd. It's a lightweight DNS forwarder and DHCP server that can be easily integrated with hostapd.


=== Make sure interface is not managed by NetworkManager ===
=== Make sure interface (uap0) is not managed by NetworkManager ===


Before starting with hostapd, it's important that NetworkManager is not managing the access point interface (uap0). If NetworkManager is running, make sure uap0 is unmanaged:
Before starting with hostapd, it's important that NetworkManager is not managing the access point interface (uap0). If NetworkManager is running, make sure uap0 is unmanaged:
Line 30: Line 30:
| {{HOSTAPD_AX}}
| {{HOSTAPD_AX}}
|}
|}
Note: When copying the text above, your file may contain zero width spaces at the end of each line (appearing as `^^k` in nano or hex `e2 80 8b` in hexdump). This will cause hostapd to fail. You can fix it by running:
# sed 's/\xe2\x80\x8b//g' /etc/hostapd.conf > /etc/hostapd_cleaned.conf && mv /etc/hostapd_cleaned.conf /etc/hostapd.conf


=== Configure /etc/dnsmasq.conf ===
=== Configure /etc/dnsmasq.conf ===
Then, configure dnsmasq:


<pre>
<pre>
Line 41: Line 43:
no-dhcp-interface=wlan0    # Disable DHCP on wlan0
no-dhcp-interface=wlan0    # Disable DHCP on wlan0
no-dhcp-interface=wfd0      # Disable DHCP on wfd0
no-dhcp-interface=wfd0      # Disable DHCP on wfd0
# Configure ipv4 address range
dhcp-range=192.168.10.10,192.168.10.100,12h  # Set the DHCP range and lease time
dhcp-range=192.168.10.10,192.168.10.100,12h  # Set the DHCP range and lease time
# Configure ipv6 address range
dhcp-range=fd00:1234::10,fd00:1234::100,12h  # Set the DHCPv6 range and lease time
# Enable Router Advertisement (RA) to inform clients of the IPv6 prefix
enable-ra
</pre>
</pre>


Then, start hostapd and dnsmasq:
Then, assign uap0 an ip and start hostapd and dnsmasq:


# ip addr add 192.168.10.1/24 dev uap0
# ip -6 addr add fd00:1234::1/64 dev uap0
  # systemctl restart hostapd
  # systemctl restart hostapd
  # systemctl restart dnsmasq
  # systemctl restart dnsmasq
Line 52: Line 64:


=== Optionally configure NAT between uap0 and eth0: ===
=== Optionally configure NAT between uap0 and eth0: ===
Optionally, it is possible to configure a NAT between uap0 and eth0:


<pre>
<pre>

Latest revision as of 21:32, 15 August 2024