This blog post is original, follow CC3.0 agreement, reprint please indicate source: http://blog.csdn.net/lux_veritas/article/details/41702505
--------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------
DNSMASQ Introduction
- The DNSMASQ is a small and easy-to-use tool for configuring DNS and DHCP for small networks and supports up to 1000 servers.
- It provides DNS functionality and selectable DHCP functionality. It serves only locally-applicable domain names that are not present in global DNS servers.
- DHCP servers and DNS servers are combined and allow DHCP-assigned addresses to be parsed correctly in DNS, and these DHCP-assigned addresses and related commands can be configured to each host, or to a core device (such as a router). The DNSMASQ supports both static and dynamic DHCP configuration methods.
Configuration file
/etc/dnsmasq.conf
DHCP server-related configuration, only this configuration file is required to
One of the simplest static DHCP configurations is as follows:
interface=eth1dhcp-host=00:50:56:2C:DA:FE,172.16.0.100
Description
- Interface I use eth1 as an internal NIC interface
- Dhcp-host Dhcp-host is configured in a number of ways, using: [Client side MAC address] + [assigned IP]
- More configurations can be found in the note description in/etc/dnsmasq.conf
Precautions
The network card IP that provides the DHCP service must be on the same network segment as the assigned IP segment. Such as:
The cidr:172.16.0.1/24 of the NIC eth1, the IP assigned to the target machine is 172.16.0.100. If the assigned address is 192.168.0.100, it will fail and the DHCP client will not be able to fetch the IP
Narrating--Talk about the debugging thing
Why is it like on the note, because the author likes the heterogeneous, always want to try unconventional, see if not according to the general configuration will have any problems, so set up a different network segment attempt to successfully allocate. The result is a natural failure.
Let's talk about the environment:
Host MacOSX 10.10, a bridge device on the host,
[DHCP server]vm1, Ubuntu 14.04
[DHCP client]vm2, CentOS 7
The network card of the two virtual machines is connected to the host bridge.
On VM1, after configuring the/etc/dnsmasq.conf, restart the DNSMASQ service, tcpdump -i eth1
and wait to view the package status
On VM2, dhclient
broadcast request, wait for IP to return, also can view/var/log/messages production look log information
Common network Condition Analysis methods:
- Log
/var/log/messages
/var/log/syslog
... ...
- Netstat check the network status information and confirm that the port is open.
- Tcpdump grab the bag, grab a bag and see if you have received the request, have reply
References
[1] How to set up a DHCP server using DNSMASQ
[2] Official doc
DNSMASQ for DHCP server configuration