# FreeBSD as a DHCPv6 server



## hrsahu (Oct 13, 2020)

Hi All,
I want to enable and run FreeBSD v9.1   as  a DHCPv6 server .
Could you please suggest and guide me the steps required to enable DHCPv6 server for FreeBSD?
I came across Dibbler 0.8.1 release candidate has added support for  FreeBSD.

Please help me on this.


----------



## a6h (Oct 13, 2020)

hrsahu said:


> I want to enable and run FreeBSD v9.1 as a DHCPv6 server .


FreeBSD 9.1 has been EOL since December 2014. Go to this http://www.freebsd.org/where.html and pick a supported one.


----------



## angelvg (Oct 21, 2020)

hrsahu

Hi,

A bit of guidance...

0. Configure FreeBSD (the DHCPD Server)

`# edit /etc/rc.conf`


```
# ISC-DHCP Server
dhcpd_enable="YES"                          # dhcpd enabled?
dhcpd_flags="-q" # command option(s)
dhcpd_conf="/usr/local/etc/dhcpd.conf" # configuration file
#dhcpd_ifaces="bge0" # ethernet interface(s)
dhcpd_ifaces="lagg0"
dhcpd_withumask="022" # file creation mask
dhcpd6_enable="YES" # dhcpd6 enabled?
dhcpd6_flags="-q" # command option(s)
dhcpd6_conf="/usr/local/etc/dhcpd6.conf" # configuration file
#dhcpd6_ifaces="bge0" # ethernet interface(s)
dhcpd6_ifaces="lagg0"
dhcpd6_withumask="022" # file creation mask
```

1.1 Configure your DHCPd v4 Server

`# edit /usr/local/etc/dhcpd.conf`


```
# dhcpd.conf
#
# Sample configuration file for ISC DHCPv4
#

option domain-name "freebsd.example.com";
option domain-search "freebsd.example.com";
option domain-name-servers 172.16.2.1, 172.16.2.2;
option subnet-mask 255.255.0.0;
option broadcast-address 172.16.255.255;
option routers 172.16.1.1;

# Lease time: default 1 hour, maximum 1 day
default-lease-time 3600;
max-lease-time 86400;

authoritative;
log-facility local7;
one-lease-per-client true;
ping-check true;

lease-file-name "/var/db/dhcpd/dhcpd.leases";

# WINS Server
option netbios-name-servers 172.16.2.1;
option netbios-node-type 8;

# Set the NTP server to be used by the DHCP clients
option time-offset     -18000;     # Bogota GMT -5.0 Hours => -5x60x60 = -18000 Seconds
option ntp-servers 172.16.3.1;
option time-servers 172.16.3.1;

# TFTP Server for logs
#option log-servers 172.16.3.1;

# Network Information System (NIS)
#option nis-servers 172.16.3.1;

# IPv4/IPv6 Subnet Calculator http://www.gestioip.net/cgi-bin/subnet_calculator.cgi
#
# IPv4
#
# IP address        172.16.0.1
# class            B
# type            PRIVATE (For Use in a private network. Not routabel in the Internet [rfc1918])
# network        172.16.0.0
# bitmask        16
# netmask        255.255.0.0
# Wildcardmask        0.0.255.255
# host range        172.16.0.1 - 172.16.255.254
# broadcast address    172.16.255.255
# total IP addresses    65534
#
# short            172.16.0.1/16
# integer ID        2886729729
# hexadecimal ID I    0xac100001
# hexadecimal ID II    3137322e31362e302e31
# binary ID        10101100000100000000000000000001
# in-addr.arpa format    1.0.16.172.in-addr.arpa

# Dynamic's
subnet 172.16.0.0 netmask 255.255.0.0 {
  range 172.16.50.1 172.16.54.254;
}

#--------------------------------------------------------------------
# Servers                               172.16.1.1 - 172.16.3.254

# HP Proliant ML370 G4
host gw {
  hardware ethernet 00:13:21:c8:fd:c3;
  fixed-address 172.16.1.1;
  ddns-hostname "gw";
  option host-name "gw";
}

#--------------------------------------------------------------------
# Networking Hardware                   172.16.4.1 - 172.16.7.254

# DELL N4032F
host core-1 {
  hardware ethernet F8:B1:56:73:38:D1;
  fixed-address 172.16.4.1;
  ddns-hostname "core-1";
  option host-name "core-1";
}

#--------------------------------------------------------------------
# Computer System                       172.16.8.1 - 172.16.9.254

#--------------------------------------------------------------------
# Printers                              172.16.10.1 - 172.16.11.254

# Impresora OKI MPS5501b
host okimps5501b1 {
  hardware ethernet 00:25:36:F6:9B:38;
  fixed-address 172.16.10.1;
#ddns-hostname "ak4a036622";
  option host-name "okimps5501b1";
}

#--------------------------------------------------------------------
# Telephony                             172.16.12.1 - 172.16.13.254

#--------------------------------------------------------------------
# Closed-Circuit Television             172.16.14.1 - 172.16.15.254

#--------------------------------------------------------------------
# Television (Engineering)              172.16.16.1 - 172.16.17.254

#--------------------------------------------------------------------
# Air Conditioner                       172.16.18.1 - 172.16.19.254

#--------------------------------------------------------------------
# Security Access Control System        172.16.20.1 - 172.16.21.254

#--------------------------------------------------------------------
# Uninterruptible Power Supply          172.16.22.1 - 172.16.23.254
```

1.2 Configure your DHCPd v6 Server

`# edit /usr/local/etc/dhcpd6.conf`


```
# dhcpd6.conf
#
# Sample configuration file for ISC DHCPv6
#

option dhcp6.domain-search "freebsd.example.com";
option dhcp6.name-servers 2001:4860:4860::8888, 2001:4860:4860::8844;

# Lease time: default 1 hour, maximum 1 day
default-lease-time 3600;
max-lease-time 86400;

authoritative;
log-facility local7;
one-lease-per-client true;
ping-check true;

dhcpv6-lease-file-name "/var/db/dhcpd6/dhcpd6.leases";

# WINS Server
# not implemented yet!

# Set the NTP server to be used by the DHCP clients
option dhcp6.sntp-servers 2001:470:1f2b:be::4;

# TFTP Server for logs
# not implemented yet!

# Network Information System (NIS)
#option dhcp6.nis-servers 2001:470:1f2b:be::4;

# IPv4/IPv6 Subnet Calculator http://www.gestioip.net/cgi-bin/subnet_calculator.cgi
#
# IPv6
#
# IP address            2001:470:1f2b:be::/64
# type                  GLOBAL-UNICAST
# network               2001:470:1f2b:be::
# prefix length         64
# host range            2001:0470:1f2b:00be:0000:0000:0000:0000 - 2001:0470:1f2b:00be:ffff:ffff:ffff:ffff
# total IP addresses    18446744073709551616
#
# IP address (full)     2001:0470:1f2b:00be:0000:0000:0000:0000
# integer ID            42540578174814481584424362881023213568
# hexadecimal ID        0x200104701f2b00be0000000000000000
# dotted decimal ID     32.1.4.112.31.43.0.190.0.0.0.0.0.0.0.0
# base 85 ID            9r}v}BUzNk_WEZQfBLQ<
# binary ID             00100000000000010000010001110000...
# ip6.arpa Format       0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.e.b.0.0.b.2.f.1.0.7.4.0.1.0.0.2.ip6.arpa

# Dynamic's
subnet6 2001:470:1f2b:be::/64 {
  range6 2001:470:1f2b:be::6000 2001:470:1f2b:be::7000;
}

#-------------------------------------------------------------------------------
# Servers                        2001:470:1f2b:be::0001 - 2001:470:1f2b:be::0500

# Dell PowerEdge R440 S/N: 163T513
host idrac-r440 {
  hardware ethernet 4C:D9:8F:AA:1C:2B;
  fixed-address6 2001:470:1f2b:be::30;
  ddns-hostname "idrac-r440";
  option host-name "idrac-r440";
}

#-------------------------------------------------------------------------------
# Networking Hardware            2001:470:1f2b:be::0501 - 2001:470:1f2b:be::1000

# Dell Networking W-IAP210
host ap01 {
  hardware ethernet 04:BD:88:CD:DF:E2;
  fixed-address6 2001:470:1f2b:be::601;
  ddns-hostname "ap01";
  option host-name "ap01";
}

#-------------------------------------------------------------------------------
# Computer System                2001:470:1f2b:be::1001 - 2001:470:1f2b:be::1500

# Dell OptiPlex 3060
host G8Y3KQ2 {
  hardware ethernet 54:BF:64:70:3F:7F;
  fixed-address6 2001:470:1f2b:be::1010;
  ddns-hostname "G8Y3KQ2";
  option host-name "G8Y3KQ2";
}

#-------------------------------------------------------------------------------
# Printers                       2001:470:1f2b:be::1501 - 2001:470:1f2b:be::2000

# Impresora Lexmark MS415dn
host lexmarkms415dn {
  hardware ethernet 00:21:B7:59:30:18;
  fixed-address6 2001:470:1f2b:be::1501;
#ddns-hostname "lexmarkms415dn";
  option host-name "lexmarkms415dn";
}

#-------------------------------------------------------------------------------
# Telephony                      2001:470:1f2b:be::2001 - 2001:470:1f2b:be::2500

#-------------------------------------------------------------------------------
# Closed-Circuit Television      2001:470:1f2b:be::2501 - 2001:470:1f2b:be::3000

#-------------------------------------------------------------------------------
# Television (Engineering)       2001:470:1f2b:be::3001 - 2001:470:1f2b:be::3500

#-------------------------------------------------------------------------------
# Air Conditioner                2001:470:1f2b:be::3501 - 2001:470:1f2b:be::4000

#-------------------------------------------------------------------------------
# Security Access Control System 2001:470:1f2b:be::4001 - 2001:470:1f2b:be::4500

#-------------------------------------------------------------------------------
# Uninterruptible Power Supply   2001:470:1f2b:be::4501 - 2001:470:1f2b:be::5000
```

2. Configure FreeBSD RA (the second FreeBSD as Internet gateway)

`# edit /etc/rc.conf`


```
# 30.9.4. Router Advertisement
rtadvd_enable="YES"
rtadvd_flags="-s"
rtadvd_interfaces="bge1"
```

`# edit /etc/rtadvd.conf`


```
# Stateful DHCPv6
bge1:\
:raflags="mo":pinfoflags="l":\
:addr="2001:470:1f2b:be::":prefixlen#64:
```

3. Start services

`# /etc/rc.d/rtadvd start`

`# /usr/local/etc/rc.d/isc-dhcpd start`

`# /usr/local/etc/rc.d/isc-dhcpd6 start`

Note:
In IPv6 the computers do not request the network parameters as in IPv4, it is the RA that is advertised and tells the computers that it is the exit to the Internet in version 6 and tells them if they self-configure

Stateless Address Auto Configuration (SLAAC)

Or they ask the DHCPD v6 Server for the network parameters

Stateful DHCPv6

In my case the RA is a FreeBSD different from the one used for DHCPD's Server

Good loock


----------

