how to set default gateway in dhcpd6.conf

15,771

tl;dr

DHCPv6 does not support options to set routers/gateways.

Details

IPv6 works in many ways differently from IPv4. It is not simply an enlarged address space.

IPv6 is designed to heavily utilize stateless address autoconfiguration (SLAAC). In turn, this relies on router- and dhcp advertisement.

With IPv6 each interface is potentially assigned two addresses.

  1. A link-local address with prefix fe80::/64 is generated from the interfaces identifier (MAC address). Those addresses are never routed and thus valid only on the local LAN segment. In the absence of a router and/or DHCP server, they enable communication of machines on a LAN, very similiar to IPv4 autoconf addresses 169.254.0.0/16. But their primary use is autoconfiguration.

  2. A global unicast address, which can be obtained in two ways (router or dhcp). Having configured a link-local address, the client sends out a Router Solicitation to the multicast address ff02::2 (all routers on the segment). In a SLAAC setting, any router on the network answers with a Router Advertisement (RA) containing available prefixes. In a home setting, there is usually one router advertising the prefix assigned by the ISP. A client receiving a RA, configures its global address using an available prefix and sets its gateway accordingly. All other options like DNS server, domain suffix, etc. should be configured via DHCPv6. This makes DHCP very simple, since it need not maintain a lease database, but simply hand out further options. Note however, that the default gateway is not one of them.

Because for some settings, address assignment by SLAAC is too loose, one may also hand out global addresses via DHCPv6. This is called stateful address configuration. In that case, the router does not advertise a prefix, but sends a "managed" flag, signaling the client to ask a DHCP server for an address. This approach is closer to how DHCPv4 works. Still, the DHCPv6 server does not hand out routers! Gateways are still obtained from RAs.

There was a IETF draft "DHCPv6 Route Options" specifying exactly the options you are looking for, but is expired and never made to an RFC.

Concerning dedicated DHCP for DNS config: A conventional IPv6 setting requires either DHCPv6 to hand out DNS information, or configuring DNS manually. The proposed RFC6106 presents an alternative, by specifying further RA options. Specifically:

  • DNS Search List (DNSSL) - the domain search list and
  • Recursive DNS server (RDNSS) - a list of DNS servers to query

The popular IPv6 Router Advertising daemon radvd already supports these options. If the clients are able to handle RDNSS (which is the case on e.g most Linux distros, OS X, Windows>=Vista), radvd can substitute for a DHCPv6 server. At least if the dhcp is used only to distribute DNS options. This could commonly be the case in a small scale home network, though may not be sufficient for business environments.

Share:
15,771

Related videos on Youtube

Kumar
Author by

Kumar

Updated on September 18, 2022

Comments

  • Kumar
    Kumar over 1 year

    IPv6 dhcp server would like to set default gateway for all clients. For ipv4 it can done by adding option routers <gateway-addr> inside subnet. But what needs to be added for ipv6 configuration?

  • favadi
    favadi over 8 years
    That mean DHCP server alone can't be used to auto config IPv6 address, but we will have to use both radvd and isc-dhcp-server?
  • Nephente
    Nephente over 8 years
    @favadi Probably yes, but depending on the setting, you could do without dhcpd. See my edit.