# 1.side effect of dual-dhclient 2.dhcpv6 server could not get hostname



## youxiaojie (Oct 10, 2021)

1.after dual-dhcp, the v4 dns by original dhcp is replced by dhcpv6.
is there a way to keep v4 dns?
2.seeing from dhcpv4/v6 server, v4 dhcp could recognize hostname(eg, freebsd),but v6 could not show it.


```
`-
fd84:8800:3e6e::8ba3
00:01:00:01:28:ef:24:78:00:c0:9f:74:21:c9

freebsd
192.168.1.197
00:C0:9F:74:21:C9
`
```


----------



## SirDice (Oct 11, 2021)

Nothing is replaced. 

This is what /usr/local/sbin/dual-dhclient is:

```
#!/bin/sh

# $FreeBSD: head/net/dual-dhclient/files/dual-dhclient 431537 2017-01-15 09:00:18Z cperciva $

# Public domain

/sbin/dhclient "$@"
/usr/local/sbin/dhclient -6 -nw -cf /dev/null "$@"
```
As you can see it simply starts the /sbin/dhclient from the base for IPv4.


----------



## zirias@ (Oct 11, 2021)

SirDice said:


> Nothing is replaced.


The `nameserver` entry in /etc/resolv.conf _is_ replaced indeed. I never cared as in my case, it's the same nameserver anyways, working the same no matter whether it's accessed via IPv4 or IPv6.

I assume it should be possible to have both entries and resolvconf(8) would be a good starting point to look at…

*edit:* Had a quick look, it seems (base) /sbin/dhclient-script optionally supports resolvconf(8), but only supplies the interface name, not a protocol (like "dhcp" as opposed to "dhcp6"), so resolvconf(8) would have a chance to merge multiple configs for the same interface.

Even worse, /usr/local/sbin/dhclient-script installed by net/isc-dhcp44-client (which is used for dhcp6 by dual-dhclient) doesn't seem to support resolvconf(8) at all.

All this can be solved, would be quite some work


----------



## youxiaojie (Oct 11, 2021)

Zirias said:


> The `nameserver` entry in /etc/resolv.conf _is_ replaced indeed. I never cared as in my case, it's the same nameserver anyways, working the same no matter whether it's accessed via IPv4 or IPv6.
> 
> I assume it should be possible to have both entries and resolvconf(8) would be a good starting point to look at…
> 
> ...


in linux they add both dhcp v4 and v6 from dhcp server, I do hope so, so I want to discussed with you, where or which script in charge of adding dns to resolv.conf


----------



## zirias@ (Oct 11, 2021)

youxiaojie said:


> in linux they add both dhcp v4 and v6 from dhcp server, I do hope so, so I want to discussed with you, where or which script in charge of adding dns to resolv.conf


The thing here is: this is all done with scripting. DHCP clients just call a script to do whatever network configuration is necessary. I'd say there is no "in Linux", as these scripts are probably maintained by Linux "distributions". So if your experience is that this works as you expect in Linux dist A, there's no guarantee whatsoever in Linux dist B.

But back to FreeBSD, the situation isn't great (as outlined above). You can fix it yourself of course. The script executed is configurable, see dhclient.conf(5). "Just" fix it yourself (copy and edit the script and point dhclient.conf to your own script).

I think it should be fixed upstream, both for base (add the "protocol" to the resolvconf(8) invocation) and the net/isc-dhcp44-client port (add support for resolvconf(8)). Someone would have to do the work and submit a patch. DHCPv6 is optional for IPv6, SLAAC is preferred, so the support for DHCPv6 is sometimes quite lacking


----------



## youxiaojie (Oct 15, 2021)

you are expert in bsd and linux, yes, different distribution of linux may have different script.
*"
edit:* Had a quick look, it seems (base) /sbin/dhclient-script optionally supports resolvconf(8), but only supplies the interface name, not a protocol (like "dhcp" as opposed to "dhcp6"), so resolvconf(8) would have a chance to merge multiple configs for the same interface.

Even worse, /usr/local/sbin/dhclient-script installed by net/isc-dhcp44-client (which is used for dhcp6 by dual-dhclient) doesn't seem to support resolvconf(8) at all.
"

this is the key points.

for interesting in dhcp v6 is because of our campus wifi with 802.1x
do you farimiliar with 802.1x 's config in bsd? I find little documents.
they use dhcp v6 to get a /128 address

great thanks for your patience!


----------



## grahamperrin@ (Oct 16, 2021)

I can't answer the TCP/IPv6 aspect, sorry.



youxiaojie said:


> … campus wifi with 802.1x
> 
> do you farimiliar with 802.1x 's config in bsd? …



If it's eduroam, *WiFimgr* (WiFi Networks Manager) can configure wpa_supplicant.conf(5) for you. net-mgmt/wifimgr

*Caution*: /etc/wpa_supplicant.conf will probably include your passphrase, human-readable, so it's good to have this area of the file system encrypted. If you chose GELI encryption – with an excellent passphrase – when you installed FreeBSD, you should be OK.


----------

