0

I am running Kali on Pi 4B (their 32bit Pi distribution, v2023.3), attempting to set up the device to function as an Access Point. However I am running into a problem.

I have attempted to follow the following guides:
https://raspberrypi-guide.github.io/networking/create-wireless-access-point
https://yuta-san.medium.com/wifi-access-point-on-kali-linux-with-raspberry-pi-9cfe7408ea1e
https://www.kali.org/blog/remotely-accessing-secure-kali-raspberry-pi/#access-point-mode
https://wiki.alpinelinux.org/wiki/Wireless_AP_with_udhcpd_and_NAT

I continue to run into the same issue. I am able to see the new network and authenticate to it, however the Pi never leases an IP to my client device. I can't figure out why. I have ensured the services NetworkManager and wpa_supplicant are both stopped and disabled to try and avoid conflicts. I have tried using both hostapd + dnsmasq and hostapd + udhcp (never with both dhcp services running at once) and my IP leasing issue occurs in both scenarios. I have attempted connecting to the Pi AP with both a linux laptop and an android phone.

My question is, what might be stopping the DHCP IP from being leased to my client devices? How can I get my Pi to function as an AP? I want to be able to connect to this network, and SSH into my Pi. I am not worried about packet forwarding or internet connectivity right now.

My current configuration files:

hostapd

$ cat /etc/hostapd/hostapd.conf
interface=wlan0
ssid=mySSID
hw_mode=g
channel=9
macaddr_acl=0
auth_algs=1
wpa=2
wpa_passphrase=***
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

dnsmasq

$ cat /etc/dnsmasq.d/dnsmasq.conf
interface=wlan0
dhcp-option=option:netmask,255.255.255.0
dhcp-option=option:router,192.168.99.1
dhcp-option=option:dns-server,192.168.99.1
log-queries
log-dhcp
log-facility=/var/log/dnsmasq.log

udhcp

$ cat /etc/udhcpd.conf
start           192.168.99.2
end             192.168.99.254
interface       wlan0
opt     dns     8.8.8.8
option  subnet  255.255.255.0
opt     router  192.168.99.1
option  lease   864000

interfaces file

$ cat /etc/network/interfaces
source-directory /etc/network/interfaces.d

auto lo
  iface lo inet loopback

allow-hotplug wlan0
iface wlan0 inet static
  address 192.168.99.1
  netmask 255.255.255.0
  network 192.168.99.0
  broadcast 192.168.99.255
  hostapd /etc/hostapd/hostapd.conf

dhcpdc

This file did not exist originally, and apt shows the package as not installed. Pretty sure this does nothing but was running out of ideas so decided to try anyway.

$ cat /etc/dhcpcd.conf
denyinterfaces wlan0

1 Answer 1

1

sigh. This took me way too long to troubleshoot, but I finally figured it out.

Turns out by default, dnsmasq does not look in the folder /etc/dnsmasq.d/ for configurations. There is a line at the bottom of /etc/dnsmasq.conf that you have to uncomment in order to configure dnsmasq to read from that folder.

In /etc/dnsmasq.conf I now have this

# Include all files in a directory which end in .conf
conf-dir=/etc/dnsmasq.d/,*.conf

I then changed my /etc/dnsmasq.d/dnsmasq.conf file to read as follows

interface=wlan0
dhcp-range=192.168.99.2,192.168.99.50,255.255.255.0,12h
dhcp-option=option:router,192.168.99.1
dhcp-option=option:dns-server,192.168.99.1

log-queries
log-dhcp
log-facility=/var/log/dnsmasq.log

Everything is working like a charm now. No idea why udhcp was not working but I no longer need it. Maybe it was something similar or completely different.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.