# How to configure dhcp AND dhcpv6 at boot time



## ardya (Feb 4, 2011)

Hi folks...currently my machine gets an IPv4 address with the system dhclient. 

I installed the isc-dhcp41 client port, configured it to request dhcpv6, manually run `/usr/local/sbin/dhclient -6 -cf /usr/local/etc/dhclient.conf` This works as well. I've looked through rc.conf options, and I don't see a means to differentiate between dhcpv4 and dhcpv6.

How can I configure system boot to run the appropriate dhclient and config for each of the two protocols?

Thanks


----------



## nakal (Feb 4, 2011)

I guess that many people like stateless autoconfiguration for IPv6 instead of stateful with DHCPV6.


----------



## SirDice (Feb 4, 2011)

From http://ftp.isc.org/isc/dhcp/dhcp-4.1.2-P1-RELNOTES:


> The client and server can only operate DHCPv4 or DHCPv6 at a time, not both.  To use both protocols simultaneously, two instances of the relevant daemon are required, one with the '-6' command line option.



Also note that the standard dhclient in the base does not support DHCPv6.


----------



## ardya (Feb 4, 2011)

I know this, hence my initial question.

How can I configure FreeBSD 8 to initialize BOTH dhcpv4 and dhcpv6 at boot?


----------



## SirDice (Feb 4, 2011)

Tricky. But you could try copying the original rc script and modify it slightly so one script starts the IPv4 and the other IPv6.


----------



## MichiGreat (Dec 16, 2011)

nakal said:
			
		

> I guess that many people like stateless autoconfiguration for IPv6 instead of stateful with DHCPV6.



Well, I don't like stateless but like stateful configuration and have the same problem. I can only use either DHCPv4 or DHCPv6 at boot time and have to manually start dhclient after boot - which is annoying.


----------



## SirDice (Dec 19, 2011)

Old thread but I recently changed my configuration. I'm using the standard dhclient(8) for IPv4 and dhcp6c(8) from net/dhcp6 for IPv6. This seems to work quite well.


----------



## MichiGreat (Dec 21, 2011)

SirDice said:
			
		

> Old thread but I recently changed my configuration. I'm using the standard dhclient(8) for IPv4 and dhcp6c(8) from net/dhcp6 for IPv6. This seems to work quite well.



Hm, doesn't work for me. At least in Debian/Ubuntu, there is a script in /etc/wide-dhcpv6/dhcp6c-script that some additional work. What is necessary in FreeBSD to get that work?


----------



## SirDice (Dec 22, 2011)

I did create a /usr/local/etc/dhcp6c.conf:

```
interface tun0 {
        send ia-pd 0;
};
id-assoc pd {
        prefix-interface rl0 {
                sla-id 1;
        };
};
```


----------



## MichiGreat (Dec 26, 2011)

SirDice said:
			
		

> I did create a /usr/local/etc/dhcp6c.conf:
> 
> ```
> interface tun0 {
> ...



I tried that and replaces tun0 and r10 with em0, but that didn't work. My original dhcp6c.conf looked like that:


```
interface eth0
{
	send ia-na 0;
	request domain-name-servers;
	request domain-name;
};

id-assoc na {		
};
```


----------

