Dnsmasq for DHCP server configuration, dnsmasqdhcp
This blog is original, follow the CC3.0 protocol, reprint please indicate the source: http://blog.csdn.net/lux_veritas/article/details/41702505
Certificate ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Introduction to DNSmasq
- DNSmasq is a small and convenient tool for configuring DNS and DHCP. It is suitable for small networks and supports up to 1000 servers.
- It provides DNS and optional DHCP functions. It serves domain names that only apply locally. These domain names will not appear on global DNS servers.
- The DHCP server works with the DNS server and allows the IP addresses allocated by DHCP to be resolved in the DNS. These IP addresses and related commands can be configured on each host, you can also configure it to a core device (such as a router). DNSmasq supports static and dynamic DHCP configuration methods.
Configuration File
/Etc/dnsmasq. conf
Only this configuration file is required for configurations related to the DHCP server.
The simplest static DHCP configuration is as follows:
interface=eth1dhcp-host=00:50:56:2C:DA:FE,172.16.0.100
Note:
- Interface I use eth1 as the interface for the internal Nic
- Dhcp-host can be configured in many ways. Here, [client MAC address] + [assigned IP address] is used.
- For more configurations, see the description in/etc/dnsmasq. conf.
Notes
The IP address of the NIC that provides the DHCP service. It must be in the same network segment as the allocated IP address. For example:
Cidr of the network adapter eth1: 172.16.0.1/24, and the IP address assigned to the target machine is 172.16.0.100. If the assigned IP address is 192.168.0.100, the DHCP client cannot obtain the IP address.
Voice-over-voice-over debugging
Why do I have to pay attention to the above issues? Because I like heterogeneous objects, I always want to try unconventional methods to see if there is any problem with the regular configuration, so I set up different network segments to try to allocate them successfully. The result is naturally a failure.
Let's talk about the environment:
Host Machine MacOSX 10.10, host machine starts a bridge device,
[DHCP server] vm1, Ubuntu 14.04
[DHCP client] vm2, CentOS 7
The NICS of the two VMS are connected to the host bridge.
On vm1, After configuring/etc/dnsmasq. conf, restart the dnsmasq service,tcpdump -i eth1
, Waiting to view the package status
On vm2,dhclient
, Broadcast request, wait for the IP to return back, you can also view/var/log/messages production to view log information
Common network condition analysis methods:
- Logs
/Var/log/messages
/Var/log/syslog
......
- Check the network status information in netstat and check whether the port is enabled.
- Tcpdump: capture a packet to see if the request is received and whether there is a reply.
References
[1] How to set up a DHCP server using dnsmasq
[2] official doc