How to configure Dnsmasq as a DHCP relay server
The role of a DHCP relay is to forward received DHCP packets to another DHCP server on the network, even if the two servers are in different subnets. By using a DHCP relay, you can deploy a centralized DHCP server in the network center and use it to dynamically assign IP addresses to all network subnets/VLANs. Dnsmasq is a commonly used DNS and DHCP protocol server that can be configured as a DHCP relay server to help manage dynamic host configurations in the network.
In this article, we will show you how to configure dnsmasq as a DHCP relay server.
Content topic:
- Network topology
- Configure a static IP address on the DHCP relay
- DHCP configuration on centralized DHCP server
- Configure Dnsmasq as a DHCP relay
- Check if DHCP relay is working as expected
- in conclusion
Network topology
Here, we have a central DHCP server, which is "dhcp-server" and its IP address is 192.168.1.10 [1]. We have a Fedora 39 server linuxhint-router configured as a Linux router[1]. linuxhint-router is the gateway for the www.example.com network subnet. We have dnsmasq installed on linuxhint_router and we want to configure dnsmasq as a DHCP relay to relay DHCP packets from the www.example.com network to dhcp_server (centralized DHCP server) so that the IP address can Automatically assigned to computers 3 and 4 (say).
Configure a static IP address on the DHCP relay
When using a DHCP relay, an important requirement is to set the correct gateway IP address on the network interface connected to the network subnet that requires dynamic allocation of IP addresses through the DHCP relay.
In the network topology, we need to configure the gateway IP address www.example.com on the network interface connected to the www.example.com subnet. This is done to ensure that the central DHCP server can correctly assign IP addresses. If the gateway IP address is not configured correctly, the central DHCP server will not recognize the IP address to be provided.
If you need help setting up a fixed IP address on your computer/server, please visit our website. We have many detailed articles available on this topic.
DHCP configuration on centralized DHCP server
Centralized DHCP servers on network topologies also use dnsmasq. It is configured to assign IP addresses in the range 192.168.15.50 to 192.168.15.150 to computers on the 192.168.15.0/24 subnet.
Note: You do not have to use dnsmasq on the central DHCP server. You can use ISC DHCP server or any other DHCP server of your choice.
Configure Dnsmasq as a DHCP relay
To configure dnsmasq on linuxhint-router as a DHCP relay, please use the nano text editor to open the dnsmasq configuration file "/etc/dnsmasq.conf" as shown below:
$sudo nano/etc/dnsmasq.conf
Add the following lines in the "dnsmasq.conf" file:
dhcp—relay = 192.168.15.1, 192.168.1.10
Here, www.example.com is the IP address of the network interface directly connected to the www.example.com subnet, and www.example.com is the IP address of the centralized DHCP server.
In the dnsmasq documentation, the "dhcp-relay" option is described in the following format:
–dhcp-Relay=,
According to the documentation, 192.168.15.1 is, 192.168.1.10 is.
After configuring dnsmasq, press X, then "Y" and save the /etc/dnsmasq.conf file.
For the changes to take effect, restart the dnsmasq service using the following command:
$sudo systemctl restart dnsmasq.service
As you can see, DHCP relay is configured to relay DHCP information from www.example.com (linuxhint-router) to www.example.com (central DHCP server).
$sudo system ctl status dnsmasq.service
Check if DHCP relay is working as expected
To check if the DHCP relay is working properly, let's try to see if the computers in the www.example.com subnet can get an IP address automatically assigned via DHCP.
First, use the following command to release the current DHCP configured IP address on the client:
$sudo dhclient-r
To receive IP information via DHCP, run the following command:
$sudo dhclient—v
As you can see, we obtained the IP address of www.example.com from the DHCP server.
The central DHCP server receives the DHCP request and responds correctly, as shown in the following screenshot:
Another computer on the www.example.com subnet also received the correct IP information via DHCP, as shown in the following screenshot:
in conclusion
In this article, we show you how to configure dnsmasq as a DHCP relay so that you can forward DHCP packets to a centralized DHCP server for easier management.
The above is the detailed content of How to configure Dnsmasq as a DHCP relay server. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



What happens when Windows 10 Ethernet prompts that dhcp is not enabled? Recently, some users have encountered such a problem when using computers. In order to help everyone use the network better, the editor will share the solution to the problem that Windows 10 Ethernet prompts that dhcp is not enabled. How to fix dhcp not enabled on win10 Ethernet: 1. First press the shortcut key "win+r", and then click run. 2. Then enter services.msc and press Enter. 3. Then you can find the "DHCPClient" service and double-click it to open it. 4. Finally, change the activation type to automatic and the service status to started, then press OK to save the settings and restart the local connection.

Solution: 1. Check the eMule settings to make sure you have entered the correct server address and port number; 2. Check the network connection, make sure the computer is connected to the Internet, and reset the router; 3. Check whether the server is online. If your settings are If there is no problem with the network connection, you need to check whether the server is online; 4. Update the eMule version, visit the eMule official website, and download the latest version of the eMule software; 5. Seek help.

What should I do if the RPC server is unavailable and cannot be accessed on the desktop? In recent years, computers and the Internet have penetrated into every corner of our lives. As a technology for centralized computing and resource sharing, Remote Procedure Call (RPC) plays a vital role in network communication. However, sometimes we may encounter a situation where the RPC server is unavailable, resulting in the inability to enter the desktop. This article will describe some of the possible causes of this problem and provide solutions. First, we need to understand why the RPC server is unavailable. RPC server is a

As a LINUX user, we often need to install various software and servers on CentOS. This article will introduce in detail how to install fuse and set up a server on CentOS to help you complete the related operations smoothly. CentOS installation fuseFuse is a user space file system framework that allows unprivileged users to access and operate the file system through a customized file system. Installing fuse on CentOS is very simple, just follow the following steps: 1. Open the terminal and Log in as root user. 2. Use the following command to install the fuse package: ```yuminstallfuse3. Confirm the prompts during the installation process and enter `y` to continue. 4. Installation completed

When many users use computers to connect to Ethernet, they will see the prompt "DHCP is not enabled" and don't know what to do. This is because the DHCP function is not enabled on the router. This article teaches you how to solve this problem. 1. Check the login information. To solve the problem of "DHCP is not enabled on the Ethernet", you need to log in to the router first. When logging in to a router, you usually need to obtain the router's gateway, username, and password information. This information is usually marked on the back of the router. The IP of the router is the so-called gateway address. The default gateway address of some routers is 192.168.1.1 or 192.168.0.1. The login account generally defaults to admin and the password is admin or 123456. 2. Log in to router management

The role of a DHCP relay is to forward received DHCP packets to another DHCP server on the network, even if the two servers are on different subnets. By using a DHCP relay, you can deploy a centralized DHCP server in the network center and use it to dynamically assign IP addresses to all network subnets/VLANs. Dnsmasq is a commonly used DNS and DHCP protocol server that can be configured as a DHCP relay server to help manage dynamic host configurations in the network. In this article, we will show you how to configure dnsmasq as a DHCP relay server. Content Topics: Network Topology Configuring Static IP Addresses on a DHCP Relay D on a Centralized DHCP Server

In network data transmission, IP proxy servers play an important role, helping users hide their real IP addresses, protect privacy, and improve access speeds. In this article, we will introduce the best practice guide on how to build an IP proxy server with PHP and provide specific code examples. What is an IP proxy server? An IP proxy server is an intermediate server located between the user and the target server. It acts as a transfer station between the user and the target server, forwarding the user's requests and responses. By using an IP proxy server

The impact of turning off dhcp on the router: 1. The client cannot automatically obtain an IP address; 2. The IP address needs to be configured manually; 3. It may cause network connection problems; 4. It affects the communication of network devices; 5. IP address conflicts; 6. Unable to proceed Dynamic address allocation; 7. Network isolation cannot be performed; 8. Traffic control cannot be performed; 9. Access control cannot be performed. It is recommended that before turning off the DHCP service, carefully consider whether it really needs to be turned off, or keep the DHCP service to ensure that the client can automatically obtain the correct IP address.
