FreeBSD: IPv6 Configuration Set Prefixlen Value

To configure IPv6 address with a specific prefix length value on FreeBSD, you can use the ifconfig command with the prefixlen option. The prefixlen option sets the number of bits in the IPv6 address prefix. Here’s an example command to configure an IPv6 address with a prefix length of 64 on FreeBSD:

sudo ifconfig INTERFACE inet6 ADDRESS prefixlen 64

Replace INTERFACE with the network interface name, such as em0 or re0. Replace ADDRESS with the IPv6 address you want to assign to the interface. For example, to configure the IPv6 address 2001:db8:1234:5678::1 with a prefix length of 64 on the em0 interface, run the following command:

sudo ifconfig em0 inet6 2001:db8:1234:5678::1 prefixlen 64

This will assign the IPv6 address 2001:db8:1234:5678::1/64 to the em0 interface.

To make the configuration persistent across reboots, you need to add the configuration to the /etc/rc.conf file. Here’s an example entry to add to the /etc/rc.conf file to configure an IPv6 address with a prefix length of 64 on the em0 interface:

ifconfig_em0_ipv6="inet6 2001:db8:1234:5678::1 prefixlen 64"

Replace 2001:db8:1234:5678::1 and 64 with the IPv6 address and prefix length you want to assign to the interface. This will configure the IPv6 address with the specified prefix length on the em0 interface at boot time.

That’s it! With the above steps, you can configure an IPv6 address with a specific prefix length value on FreeBSD.

Leave a Comment