# DHCP and SLAAC

I already setup _dnsmasq_ for IPv4 and so there is very little that needs to be done to add IPv6 support.

I just needed to add `dhcp-range` lines for each subnet. I am tagging them the same as before and using the `::,constructor:<interface>` syntax to tell _dnsmasq_ to determine the the prefix the DHCPv6 range should be valid over from the [GUAs (Global Unicast Addresse)](https://www.omnisecu.com/tcpip/ipv6/global-unicast-ipv6-addresses.php) (publically routable IPs) on each interface. These were assigned in the previous section ([Prefix Delegation](https://bookstack.swigg.net/books/project-router-work-in-progress/page/prefix-delegation)) by _wide-dhcpv6-client_. Declaring `ra-stateless` configures _dnsmasq_ to use [SLAAC](https://en.wikipedia.org/wiki/IPv6#Stateless_address_autoconfiguration_(SLAAC)) to automatically configure clients in this prefix.

```diff
# /etc/dnsmasq.d/dhcp.conf
+ dhcp-range=set:lan,::,constructor:eth1,ra-stateless,12h
+ dhcp-range=set:dmz,::,constructor:eth1.8,ra-stateless,12h
+ dhcp-range=set:warp,::,constructor:eth1.9,ra-stateless,5m
```

Then I enabled router advertisements so _dnsmasq_ will broadcast information to any potential clients on the subnet.

```diff
# /etc/dnsmasq.d/router-advertisements.conf
+ enable-ra
```