Dhcp client and dns resolv

Hello everyone, in addition to the release of the ip by booking I wanted to know how to vary the dns with other dns on a client that is on the booking list. E.g. booking on a client 192.168.1.2 dns ( 192.168.1.254 (nethserver ) ) with dns ( 8.8.8.8 ) . thanks

You can set the clients DNS servers in advanced DHCP options when enabling DHCP on an interface:

See also DHCP and PXE server — NethServer 7 Final

1 Like

Hi Markuz !! I expressed myself badly. To me server only for some clients and not for all . In short, if you connect a certain host, an IP and a dns are booked for him, which I decide only for him.

That’s not supported in the UI.
Of course it could work with a custom template, see domain name system - Per-client DNS servers with DNSMasq - Server Fault for more info.

Thanks, but unfortunately I’m not able to create a custom template, to date I haven’t figured out how to create them!

I never tested it but it should work like this:

Create custom template dir:

mkdir -p /etc/e-smith/templates-custom/etc/dnsmasq.conf

Create /etc/e-smith/templates-custom/etc/dnsmasq.conf/91hosts with following (example) content.
Just create dhcp-host entries (check MAC addresses) as you like and set the wanted DNS servers with the last option.

# host A
dhcp-host=00:15:99:27:f8:98,set:specialhosts,192.168.1.20
# host B
dhcp-host=00:51:99:72:8f:89,set:specialhosts,192.168.1.21
# set dns servers for specialhosts to Neth and google.
dhcp-option=tag:specialhosts,option:dns-server,192.168.1.254,8.8.8.8

Apply config:

signal-event nethserver-dnsmasq-update

See also Allow users to add extra dnsmasq options

3 Likes

Thank you Markuz, kind as always. I know I should learn template management , in order to be able to customize nethserver even better . I will try what you indicated to me as soon as possible. At the moment thank you!

2 Likes