dnsmasq dhcp ipv6 ipv4
时间: 2023-10-03 21:05:47 浏览: 113
Dnsmasq is a lightweight DNS and DHCP server that can be used to provide both IPv4 and IPv6 addresses to clients on a network. It is commonly used in small networks, such as home networks, to provide local DNS resolution and DHCP services.
To configure Dnsmasq to provide both IPv4 and IPv6 addresses, you will need to edit the configuration file (/etc/dnsmasq.conf by default) and add the following lines:
```
dhcp-range=192.168.1.50,192.168.1.150,12h
dhcp-range=::100,::200,constructor:eth0,ra-names,slaac,12h
```
The first line specifies a range of IPv4 addresses to be assigned to clients, while the second line specifies a range of IPv6 addresses to be assigned to clients. The "constructor:eth0" option specifies that the IPv6 addresses should be assigned based on the interface (eth0) that the client is connected to, while the "ra-names" and "slaac" options specify that the addresses should be assigned using Router Advertisement (RA) messages and Stateless Address Autoconfiguration (SLAAC).
You may also need to enable IPv6 support in Dnsmasq by adding the following line to the configuration file:
```
listen-address=::1,127.0.0.1
```
This specifies that Dnsmasq should listen on the IPv6 loopback address (::1) as well as the IPv4 loopback address (127.0.0.1).
Once you have made these changes, you can start or restart the Dnsmasq service to apply the new configuration.
阅读全文