WAP dhcp/dns name

Hi,

I’ve recently discovered DietPi and it makes my life easier.

I set up my Pi to be a WAP with https://dietpi.com/docs/software/advanced_networking/#wifi-hotspot. I also activated Lighttpd. When I connect a device to the WAP and go to http://192.168.42.1, I see the default web page of Lighttpd.

I want to configure DNS/DHCP to use a name (ex: myserver.com) instead of the IP address but I never did that and I have no idea how to do it.

Here are the service running:

[  OK  ] DietPi-Services | isc-dhcp-server	active (running) since Thu 2021-09-02 18:23:27 NZST; 25min ago
[  OK  ] DietPi-Services | proftpd		active (running) since Thu 2021-09-02 18:23:28 NZST; 25min ago
[  OK  ] DietPi-Services | php7.3-fpm		active (running) since Thu 2021-09-02 18:23:29 NZST; 25min ago
[  OK  ] DietPi-Services | lighttpd		active (running) since Thu 2021-09-02 18:23:30 NZST; 25min ago
[  OK  ] DietPi-Services | hostapd		active (running) since Thu 2021-09-02 18:23:30 NZST; 25min ago
[  OK  ] DietPi-Services | cron			active (running) since Thu 2021-09-02 18:23:30 NZST; 25min ago
[  OK  ] DietPi-Services | dropbear		active (running) since Thu 2021-09-02 18:23:24 NZST; 26min ago
[ INFO ] DietPi-Services | dietpi-vpn		inactive (dead)
[  OK  ] DietPi-Services | dietpi-ramlog	active (exited) since Thu 2021-09-02 18:23:03 NZST; 26min ago
[  OK  ] DietPi-Services | dietpi-preboot	active (exited) since Thu 2021-09-02 18:23:03 NZST; 26min ago
[  OK  ] DietPi-Services | dietpi-boot		active (exited) since Thu 2021-09-02 18:23:24 NZST; 26min ago
[  OK  ] DietPi-Services | dietpi-postboot	active (exited) since Thu 2021-09-02 18:23:24 NZST; 26min ago
[ INFO ] DietPi-Services | dietpi-wifi-monitor	inactive (dead)

Thanks for your help.

The below is valid for the AP Wifi network only.


Hi,

basically a DHCP server is already running due to the hotspot installation. It’s isc-dhcp-server
By default the DHCP server will distribute Google global DNS server to your clients on the AP. This would need to be changed to be able to resolve your onw DNS request locally.

1st step adjust /etc/dhcp/dhcpd.conf and change option domain-name-servers into 192.168.42.1 as local DNS server.

On a 2ns step, a DNS server to be installed. You can use dnsmasq

apt install dnsmasq dnsutils ldnsutils -y

On a default setup it should be working already and your clients will use dnsmasq to resolve DNS request now.

3rd step is to add your myserver.com name/ip into /etc/hosts

nano /etc/hosts

of course this is a basic installation of dnsmasq running default values. There are multiple options to further tune dnsmasq.

Final step would be to restart DHCP as well as DNS service

systemctl restart dnsmasq.service
systemctl restart isc-dhcp-server.service

Ensure your clients will get up-to-date configuration and reconnect them to your WiFi AP.

Perfect. I followed the steps and it works. First time that happens :smiley: .

Thanks

thx for positive feedback