Configuring Raspberry Pi as a DHCP and DNS Server with Ignore Advertised DNS IPv6
In this article, we will discuss how to configure a Raspberry Pi as a DHCP and DNS server, specifically focusing on ignoring advertised DNS IPv6. We will cover the key concepts, provide detailed context, and include subtitles and code blocks as needed.
Prerequisites
Before we begin, it is assumed that you have a Raspberry Pi set up and running the dnsmasq service. Additionally, you should have a home network with a router provided by your Internet Service Provider (ISP) that is currently handling DHCP and DNS server duties.
Configuring DHCP Server
To configure the Raspberry Pi as a DHCP server, we need to edit the /etc/dnsmasq.conf file. Open this file in your favorite text editor and add the following lines:
dhcp-range=192.168.1.100,192.168.1.200,24h
dhcp-option=option:router,192.168.1.1
In this example, we are setting the DHCP range to be between 192.168.1.100 and 192.168.1.200, with a lease time of 24 hours. We are also setting the default gateway (router) to be 192.168.1.1.
Configuring DNS Server
To configure the Raspberry Pi as a DNS server, we need to edit the /etc/dnsmasq.conf file again. Add the following lines:
domain=home
dhcp-option=option:dns-server,192.168.1.2
In this example, we are setting the domain to be home, and we are setting the DNS server to be the IP address of the Raspberry Pi (192.168.1.2 in this example).
Ignoring Advertised DNS IPv6
To ignore advertised DNS IPv6, we need to add the following line to the /etc/dnsmasq.conf file:
dhcp-option=option6:dns-server,::
This line tells the Raspberry Pi to ignore any advertised DNS servers that use IPv6.
Restarting Dnsmasq
After making these changes, we need to restart the dnsmasq service for the changes to take effect. Run the following command:
sudo systemctl restart dnsmasq
- Edited
/etc/dnsmasq.confto set DHCP range and DNS server - Added line to ignore advertised DNS IPv6
- Restarted
dnsmasqservice
References
- How to Set Up a DHCP Server on Your Raspberry Pi
- Raspberry Pi Network Configuration
- dnsmasq Manual Page
This article was written using the following resources:
- Book: "Raspberry Pi: A Project-Based Approach to Learning the Command Line" by Martyn Bullock
- Article: "How to Set Up a DHCP Server on Your Raspberry Pi" by The Pi Hut
- Online Resource: Raspberry Pi Network Configuration documentation
- Online Resource: dnsmasq Manual Page