Raspberry Pi as Standalone Access Point: Difference between revisions
No edit summary |
|||
Line 4: | Line 4: | ||
apt-get install hostapd dnsutils traceroute TBDDHCPSERVER | apt-get install hostapd dnsutils traceroute TBDDHCPSERVER | ||
=== | WIP - WIP - WIP | ||
= Configuration = | |||
== Disable IPv6 === | |||
vi /etc/sysctl.conf | vi /etc/sysctl.conf | ||
and set | and set | ||
net.ipv6.conf.all.disable_ipv6 = 1 | net.ipv6.conf.all.disable_ipv6 = 1 | ||
Explanation: Disable [[IPv6]] (to [[KISS]]) and enable forwarding for [[IPv4]]<ref>Which is quite unnecessary ;), since we bridge at layer 2...</ref>. | Explanation: Disable [[IPv6]] (to [[KISS]]) and enable forwarding for [[IPv4]]<ref>Which is quite unnecessary ;), since we bridge at layer 2...</ref>. | ||
== Enable AP == | |||
vi /etc/default/hostapd | vi /etc/default/hostapd | ||
and set: | and set: | ||
DAEMON_CONF="/etc/hostapd/hostapd.conf" | DAEMON_CONF="/etc/hostapd/hostapd.conf" | ||
Explanation: The <tt>hostapd</tt> reads the configfile, to find this configfile. I don't get what this is good for. I think I'm just net getting the whole concept. If anyone cares to enlighten me, please do. :) | Explanation: The <tt>hostapd</tt> reads the configfile, to find this configfile. I don't get what this is good for. I think I'm just net getting the whole concept. If anyone cares to enlighten me, please do. :) | ||
vi /etc/hostapd/hostapd.conf | vi /etc/hostapd/hostapd.conf | ||
and set something like this: | and set something like this: | ||
interface=wlan0 | interface=wlan0 | ||
driver=nl80211 | driver=nl80211 | ||
bridge=br0 | bridge=br0 ???????????? | ||
hw_mode=g | hw_mode=g | ||
channel=7 | channel=7 | ||
Line 31: | Line 33: | ||
wpa_pairwise=TKIP | wpa_pairwise=TKIP | ||
rsn_pairwise=CCMP | rsn_pairwise=CCMP | ||
ssid= | ssid=HMS_Camden_Lock | ||
wpa_passphrase=42_42_42_42 | wpa_passphrase=42_42_42_42 | ||
Explanation: <tt>hostapd</tt> creates the [[WiFi]]-Access Point and creates a bridge-device <tt>br0</tt>, which he ties (only) <tt>wlan0</tt> to<ref>Check with: <tt>brctl show</tt></ref>. | Explanation: <tt>hostapd</tt> creates the [[WiFi]]-Access Point and creates a bridge-device <tt>br0</tt>, which he ties (only) <tt>wlan0</tt> to<ref>Check with: <tt>brctl show</tt></ref>. | ||
Line 37: | Line 39: | ||
vi /etc/dhcpcd.conf | vi /etc/dhcpcd.conf | ||
and set something like this: | and set something like this: | ||
nohook wpa_supplicant | nohook wpa_supplicant ???? | ||
denyinterfaces wlan0 | denyinterfaces wlan0 ???? | ||
Explanation: I omit <tt>/etc/wpa_supplicant/wpa_supplicant.conf</tt> for <tt>wlan0</tt>. It is essential that there remains only one layer3-active (meaning using IP) interface, and that is <tt>br0</tt>. Otherwise you get a routing mess. | Explanation: I omit <tt>/etc/wpa_supplicant/wpa_supplicant.conf</tt> for <tt>wlan0</tt>. It is essential that there remains only one layer3-active (meaning using IP) interface, and that is <tt>br0</tt>. Otherwise you get a routing mess. | ||
Since <tt>br0</tt> and <tt>eth0</tt> are not omitted (denied), they get [[IPA]]s from the [[DHCP]]-Server. That's necessary for <tt>br0</tt>, and not for <tt>eth0</tt> (but when I omitted <tt>eth0</tt>, the bridge didn't come up. So I removed the [[IPA]] later (see below). | Since <tt>br0</tt> and <tt>eth0</tt> are not omitted (denied), they get [[IPA]]s from the [[DHCP]]-Server. That's necessary for <tt>br0</tt>, and not for <tt>eth0</tt> (but when I omitted <tt>eth0</tt>, the bridge didn't come up. So I removed the [[IPA]] later (see below). | ||
== Network Interfaces == | |||
vi /etc/network/interfaces | vi /etc/network/interfaces | ||
Don't touch this file. <tt>dhcpcd</tt> gets jealous... | Don't touch this file. <tt>dhcpcd</tt> gets jealous... | ||
---- | ---- |
Revision as of 13:48, 28 November 2020
I had a case (that has yet to be documented here), where I needed an Raspberry Pi Zero WH to act as access point, including DHCP-Server. Standalone, not connected to any network.
Installation
apt-get install hostapd dnsutils traceroute TBDDHCPSERVER
WIP - WIP - WIP
Configuration
Disable IPv6 =
vi /etc/sysctl.conf
and set
net.ipv6.conf.all.disable_ipv6 = 1
Explanation: Disable IPv6 (to KISS) and enable forwarding for IPv4[1].
Enable AP
vi /etc/default/hostapd
and set:
DAEMON_CONF="/etc/hostapd/hostapd.conf"
Explanation: The hostapd reads the configfile, to find this configfile. I don't get what this is good for. I think I'm just net getting the whole concept. If anyone cares to enlighten me, please do. :)
vi /etc/hostapd/hostapd.conf
and set something like this:
interface=wlan0 driver=nl80211 bridge=br0 ???????????? hw_mode=g channel=7 ieee80211n=1 wmm_enabled=1 macaddr_acl=0 auth_algs=1 ignore_broadcast_ssid=0 wpa=2 wpa_key_mgmt=WPA-PSK wpa_pairwise=TKIP rsn_pairwise=CCMP ssid=HMS_Camden_Lock wpa_passphrase=42_42_42_42
Explanation: hostapd creates the WiFi-Access Point and creates a bridge-device br0, which he ties (only) wlan0 to[2].
vi /etc/dhcpcd.conf
and set something like this:
nohook wpa_supplicant ???? denyinterfaces wlan0 ????
Explanation: I omit /etc/wpa_supplicant/wpa_supplicant.conf for wlan0. It is essential that there remains only one layer3-active (meaning using IP) interface, and that is br0. Otherwise you get a routing mess. Since br0 and eth0 are not omitted (denied), they get IPAs from the DHCP-Server. That's necessary for br0, and not for eth0 (but when I omitted eth0, the bridge didn't come up. So I removed the IPA later (see below).
Network Interfaces
vi /etc/network/interfaces
Don't touch this file. dhcpcd gets jealous...