Enabling IPv6 on FreeBSD with DHCPv6 in Stateful Mode

Hello fellow !

Today, I’m excited to share a step-by-step guide on how to enable IPv6 on your FreeBSD instance using DHCPv6 in stateful mode.

This configuration will allow your system to automatically obtain both IPv4 and IPv6 addresses from a DHCP s…


This content originally appeared on DEV Community and was authored by Vinetos

Hello fellow !

Today, I'm excited to share a step-by-step guide on how to enable IPv6 on your FreeBSD instance using DHCPv6 in stateful mode.

This configuration will allow your system to automatically obtain both IPv4 and IPv6 addresses from a DHCP server.

Let's dive right in!

Install dhcpcd

First, we need to install the dhcpcd package, which is a DHCP client daemon. To do this, open your terminal and run the following command:

pkg install net/dhcpcd

Configure dhcpcd

Next, we'll configure dhcpcd by adding some lines to its configuration file located at /usr/local/etc/dhcpcd.conf.

We'll add the hostname to the DHCP request and enable the IA_NA option, which requests a non-temporary address assignment. Additionally, we'll disable the generation of stable private IPv6 addresses based on the DUID (DHCP Unique Identifier). :

cat >>/usr/local/etc/dhcpcd.conf << DHCP_CONF
hostname
ia_na 1
DHCP_CONF
sed -i '' -e 's/^slaac private/#slaac private/' /usr/local/etc/dhcpcd.conf

Edit rc.conf

Now, let's edit the rc.conf file to tell FreeBSD to use dhcpcd as the DHCP client and configure our network interfaces to use DHCP for both IPv4 and IPv6. Open /etc/rc.conf in your favorite text editor and add the following lines:

dhclient_program="/usr/local/sbin/dhcpcd"
ifconfig_${ifdev}="DHCP"
ifconfig_${ifdev}_ipv6="DHCP"

Replace ${ifdev} with the name of your network interface, such as em0, igb0, vetnet0, etc.

Reboot

Finally, reboot your system to apply the changes:

shutdown -r now

Once your system comes back online, it should have obtained both IPv4 and IPv6 addresses via DHCP. You can verify this by running the following commands:

ifconfig ${ifdev}

Replace ${ifdev} with your network interface name.

And that's it! You've successfully enabled IPv6 on your FreeBSD instance using DHCPv6 in stateful mode. Happy networking!


This content originally appeared on DEV Community and was authored by Vinetos


Print Share Comment Cite Upload Translate Updates
APA

Vinetos | Sciencx (2024-08-08T08:55:02+00:00) Enabling IPv6 on FreeBSD with DHCPv6 in Stateful Mode. Retrieved from https://www.scien.cx/2024/08/08/enabling-ipv6-on-freebsd-with-dhcpv6-in-stateful-mode/

MLA
" » Enabling IPv6 on FreeBSD with DHCPv6 in Stateful Mode." Vinetos | Sciencx - Thursday August 8, 2024, https://www.scien.cx/2024/08/08/enabling-ipv6-on-freebsd-with-dhcpv6-in-stateful-mode/
HARVARD
Vinetos | Sciencx Thursday August 8, 2024 » Enabling IPv6 on FreeBSD with DHCPv6 in Stateful Mode., viewed ,<https://www.scien.cx/2024/08/08/enabling-ipv6-on-freebsd-with-dhcpv6-in-stateful-mode/>
VANCOUVER
Vinetos | Sciencx - » Enabling IPv6 on FreeBSD with DHCPv6 in Stateful Mode. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/08/08/enabling-ipv6-on-freebsd-with-dhcpv6-in-stateful-mode/
CHICAGO
" » Enabling IPv6 on FreeBSD with DHCPv6 in Stateful Mode." Vinetos | Sciencx - Accessed . https://www.scien.cx/2024/08/08/enabling-ipv6-on-freebsd-with-dhcpv6-in-stateful-mode/
IEEE
" » Enabling IPv6 on FreeBSD with DHCPv6 in Stateful Mode." Vinetos | Sciencx [Online]. Available: https://www.scien.cx/2024/08/08/enabling-ipv6-on-freebsd-with-dhcpv6-in-stateful-mode/. [Accessed: ]
rf:citation
» Enabling IPv6 on FreeBSD with DHCPv6 in Stateful Mode | Vinetos | Sciencx | https://www.scien.cx/2024/08/08/enabling-ipv6-on-freebsd-with-dhcpv6-in-stateful-mode/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.