Raspberry Pi as Standalone Access Point: Difference between revisions

From Wurst-Wasser.net
Jump to navigation Jump to search
Line 16: Line 16:
Explanation: Disable [[IPv6]] (to [[KISS]]).
Explanation: Disable [[IPv6]] (to [[KISS]]).


== Disable DHCP-Client && Set Static IP-Address ==
== Disable DHCP-Client && Set Static IP-Address && Setup DHCPd ==
  vi /etc/dhcpcd.conf
  vi /etc/udhcpd.conf
…set something like this:
…and…
  interface wlan0
  start 10.178.42.100 # This is the range of IPs that the hostspot will give to client devices.
  static ip_address=10.178.42.1/24
  end 10.178.42.199
  static domain_name_servers=127.0.0.1
interface wlan0 # The device uDHCP listens on.
remaining yes
#opt dns 8.8.8.8 4.2.2.2 # The DNS servers client devices will use.
  opt subnet 255.255.255.0
#opt router 10.178.42.1 # The Pi's IP address on wlan0 which we will set up shortly.
opt lease 864000 # 10 day DHCP lease time in seconds


== Enable and Configure Access Point ==
== Enable and Configure Access Point ==

Revision as of 18:26, 28 November 2020

WIP - WIP - WIP



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 udhcp

Configuration

Disable IPv6

vi /etc/sysctl.conf

and set

net.ipv6.conf.all.disable_ipv6=1

Explanation: Disable IPv6 (to KISS).

Disable DHCP-Client && Set Static IP-Address && Setup DHCPd

vi /etc/udhcpd.conf

…and…

start 10.178.42.100 # This is the range of IPs that the hostspot will give to client devices.
end 10.178.42.199
interface wlan0 # The device uDHCP listens on.
remaining yes
#opt dns 8.8.8.8 4.2.2.2 # The DNS servers client devices will use.
opt subnet 255.255.255.0
#opt router 10.178.42.1 # The Pi's IP address on wlan0 which we will set up shortly.
opt lease 864000 # 10 day DHCP lease time in seconds

Enable and Configure Access Point

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
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[1].

Enable and Configure DHCPd

vi /etc/dhcp/dhcpd.conf

…un-comment this:

authoritative;

…set your ip range:

subnet 10.178.42.0 netmask 255.255.255.0 {
 range 10.178.42.100 10.178.42.240;
  1. option routers 10.178.somebyte.anotherbyte;
 option domain-name "pi00.wurst-wasser.net";
 option domain-name-servers 127.0.0.1;
}

Launch it:

systemctl start isc-dhcp-server.service

Setup DNS

Later. Not mattering right now.

Network Interfaces

vi /etc/network/interfaces

Don't touch this file. dhcpcd gets jealous...



  1. Check with: brctl show