WAP dhcp/dns name Topic is solved

Have some feedback, questions, suggestions, or just fancy a chat? Pop it in here.
Post Reply
hypotamtam
Posts: 2
Joined: Thu Sep 02, 2021 8:42 am

WAP dhcp/dns name

Post by hypotamtam »

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/advanc ... fi-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:

Code: Select all

[  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.
User avatar
Joulinar
Posts: 5619
Joined: Sat Nov 16, 2019 12:49 am

Re: WAP dhcp/dns name

Post by Joulinar »

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

Code: Select all

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

Code: Select all

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

Code: Select all

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.
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
hypotamtam
Posts: 2
Joined: Thu Sep 02, 2021 8:42 am

Re: WAP dhcp/dns name

Post by hypotamtam »

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

Thanks
User avatar
Joulinar
Posts: 5619
Joined: Sat Nov 16, 2019 12:49 am

Re: WAP dhcp/dns name

Post by Joulinar »

thx for positive feedback
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Post Reply