Koozali.org: home of the SME Server

[SOLVED] possible to set severals DNS in DHCP ?

Offline globalsi

  • ****
  • 167
  • +0/-0
[SOLVED] possible to set severals DNS in DHCP ?
« on: October 18, 2017, 05:53:06 PM »
Hi,
I have a SME9.2 in serveronly mode. He's doing the DHCP.
Is it possible to configure the SME DHCP with 2 DNS servers : the SME himself in priority and another external DNS (for example 8.8.8.8 ) when the SME is down (for maintenance for example) ?
Thanks.
« Last Edit: October 18, 2017, 06:46:55 PM by globalsi »

Offline ReetP

  • *
  • 3,738
  • +5/-0
Re: possible to set severals DNS in DHCP ?
« Reply #1 on: October 18, 2017, 06:14:37 PM »
If your SME is down it can't do anything :-)

This may help:

https://wiki.contribs.org/Dhcpmanager

You can set custom DNS, but that will only help clients that have got an IP address
...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Offline globalsi

  • ****
  • 167
  • +0/-0
Re: possible to set severals DNS in DHCP ?
« Reply #2 on: October 18, 2017, 06:24:55 PM »
If your SME is down it can't do anything :-)
sure  :-o
You can set custom DNS, but that will only help clients that have got an IP address
Yes, it will be case for the majority of the machines.

Thank you.

Offline janet

  • ****
  • 4,812
  • +0/-0
Re: [SOLVED] possible to set severals DNS in DHCP ?
« Reply #3 on: October 18, 2017, 11:24:59 PM »
globalsi

In the client (eg Windows) under Network in Control Panel, you can configure an alternate DNS server.
Typically this would be set to "Obtain DNS server address automatically", but you can manually set a primary DNS server IP & an alternate server IP address.
This should apply to other client OS's.

As stated if the SME server is down, then any alternate DNS settings entered there will be inaccessible.
Please search before asking, an answer may already exist.
The Search & other links to useful information are at top of Forum.

Offline globalsi

  • ****
  • 167
  • +0/-0
Re: [SOLVED] possible to set severals DNS in DHCP ?
« Reply #4 on: October 18, 2017, 11:56:29 PM »
janet,
Yes, i can do it manually but i prefer do it automatically with the DHCP (easier and faster  8-) )

As stated if the SME server is down, then any alternate DNS settings entered there will be inaccessible.
I'm disagree.
All computers will receive from the DHCP a primary DNS server (SME) and an alternate DNS server (with lease-time equal 1 day)
If i shutdown the SME server, the computers will use the alternate DNS server for the web or emails...

Offline janet

  • ****
  • 4,812
  • +0/-0
Re: [SOLVED] possible to set severals DNS in DHCP ?
« Reply #5 on: October 19, 2017, 06:07:15 AM »
globalsi

AFAIK any alternate DNS settings possible in SME server, are for SME server to access an external DNS server or alternate external DNS server if the first one is down.
Normally external DNS servers are not setup in SME, as SME server can do DNS lookups on its own
Please search before asking, an answer may already exist.
The Search & other links to useful information are at top of Forum.

Offline mmccarn

  • *
  • 2,627
  • +10/-0
Re: [SOLVED] possible to set severals DNS in DHCP ?
« Reply #6 on: October 19, 2017, 12:55:10 PM »
You can create a custom copy of 25DomainNameServers to do this.

Code: [Select]
mkdir -p /etc/e-smith/templates-custom/etc/dhcpd.conf
cd /etc/e-smith/templates-custom/etc/dhcpd.conf
# note the dot at the end of the next line...
cp /etc/e-smith/templates/etc/dhcpd.conf/25DomainNameServers .

Edit the custom version of 25DomainNameServers to show the DNS servers you want to use.  The default value  is { $LocalIP } (the curly braces cause perl evaluation in the output, while plain text is output as-is).  Multiple values should be comma delimited, and the line should end in a semicolon eg:
Code: [Select]
     option domain-name-servers my.ns1.com,192.168.1.99,my.third.nsserver.com;
The way I read the docs for dhcpd.conf, the dhcp server is doing the name lookups if you use names in the config file, then providing all resulting IP addresses to the clients.


To activate your changes:
Code: [Select]
expand-template /etc/dhcpd.conf
sv t dhcpd

To completely remove your changes:
Code: [Select]
rm -f  /etc/e-smith/templates-custom/etc/dhcpd.conf/25DomainNameServers
expand-template /etc/dhcpd.conf
sv t dhcpd

[edit]
For your original request (add "8.8.8.8" as a secondary DNS for clients), add that IP after { $LocalIP } and before the semicolon:
Quote from: /etc/e-smith/templates-custom/etc/dhcpd.conf/25DomainNameServers[/quote
    option domain-name-servers   { $LocalIP },8.8.8.8;
« Last Edit: October 19, 2017, 01:01:40 PM by mmccarn »

Offline ReetP

  • *
  • 3,738
  • +5/-0
Re: [SOLVED] possible to set severals DNS in DHCP ?
« Reply #7 on: October 19, 2017, 01:34:13 PM »
A question... what hapoens on a client when they refresh their address and the server is down?

Does it use the existing data?

Clearly if a client boots/reboots with the server down it will not get any details.
...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Offline globalsi

  • ****
  • 167
  • +0/-0
Re: [SOLVED] possible to set severals DNS in DHCP ?
« Reply #8 on: October 19, 2017, 02:30:48 PM »
ReetP,
If they ask a new ip and the DHCP server is off, they will receive no answer and get no ip (and no dns) -> no network (local or not).
Luckily, if a machine reboot, it will ask a new ip only if the lease expires.

Offline globalsi

  • ****
  • 167
  • +0/-0
Re: [SOLVED] possible to set severals DNS in DHCP ?
« Reply #9 on: October 19, 2017, 02:34:17 PM »
AFAIK any alternate DNS settings possible in SME server, are for SME server to access an external DNS server or alternate external DNS server if the first one is down.
Normally external DNS servers are not setup in SME, as SME server can do DNS lookups on its own
I don't need the SME server use an alternate DNS, i need to have an alternate dns in the computers configuration if my server SME is down for 1 hour or 2.

Offline globalsi

  • ****
  • 167
  • +0/-0
Re: [SOLVED] possible to set severals DNS in DHCP ?
« Reply #10 on: October 19, 2017, 02:38:31 PM »
Thank you mmccarn for your tip !
It's lighter that install Dhcpmanager.

Offline ReetP

  • *
  • 3,738
  • +5/-0
Re: [SOLVED] possible to set severals DNS in DHCP ?
« Reply #11 on: October 19, 2017, 04:15:24 PM »
ReetP,
If they ask a new ip and the DHCP server is off, they will receive no answer and get no ip (and no dns) -> no network (local or not).
Luckily, if a machine reboot, it will ask a new ip only if the lease expires.

OK.

Never had the experience but.... !
...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: [SOLVED] possible to set severals DNS in DHCP ?
« Reply #12 on: October 19, 2017, 11:37:15 PM »
All computers will receive from the DHCP a primary DNS server (SME) and an alternate DNS server (with lease-time equal 1 day)

This can only work if either 1) you don't ever care about any of the forward and reverse DNS zones which SME server manages locally or 2) you configure some system to mirror SME server's local zones on your alternate DNS server.

How much downtime does your SME server suffer?

Offline ReetP

  • *
  • 3,738
  • +5/-0
Re: [SOLVED] possible to set severals DNS in DHCP ?
« Reply #13 on: October 19, 2017, 11:51:28 PM »
Quote
How much downtime does your SME server suffer?

Mine? Prior preparation and planning prevents piss poor performance.

Something verging on zero in my case :-) If it was more than a few minutes for an upgrade reboot I'd have my boss on my back. And if you'd ever met my wife you'd know how ugly that can get.....

ROFLMAO.....
...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Offline globalsi

  • ****
  • 167
  • +0/-0
Re: [SOLVED] possible to set severals DNS in DHCP ?
« Reply #14 on: October 20, 2017, 09:09:12 AM »
How much downtime does your SME server suffer?
For me, it's also for some minors down time  (mainly updated and reboot (my wife is fed up that I work at night ...  :? ); optionally change inverter)