J0hnby dhcp server ntp (#2376)

* Add in configuration for NTP

* Add in configuration for NTP

* Update CHANGELOG.md

* Add in configuration for NTP

* Add in configuration for NTP

* Update dhcp_server/CHANGELOG.md

Follow suggestion to have 1.3.0 version convention

Co-authored-by: Pascal Vizeli <pascal.vizeli@syshack.ch>

* Update dhcp_server/config.yaml

Follow suggestion to have 1.3.0 version convention

Co-authored-by: Pascal Vizeli <pascal.vizeli@syshack.ch>

* Update config.yaml

* Addition to quotes for settings

Lint highlighted a possible issue with unquoted - added in quotes to ensure it doesn't split

Co-authored-by: Pascal Vizeli <pascal.vizeli@syshack.ch>
This commit is contained in:
John
2022-05-03 17:11:17 +01:00
committed by GitHub
parent 174f8e66d0
commit 4392e97cf2
4 changed files with 26 additions and 1 deletions

View File

@@ -1,5 +1,9 @@
# Changelog # Changelog
## 1.3.0
- Add NTP server configuration option.
## 1.2 ## 1.2
- Fixes crash when using FQDN as domain - Fixes crash when using FQDN as domain

View File

@@ -7,6 +7,7 @@ Follow these steps to get the add-on installed on your system:
1. Navigate in your Home Assistant frontend to **Supervisor** -> **Add-on Store**. 1. Navigate in your Home Assistant frontend to **Supervisor** -> **Add-on Store**.
2. Find the "DHCP server" add-on and click it. 2. Find the "DHCP server" add-on and click it.
3. Click on the "INSTALL" button. 3. Click on the "INSTALL" button.
4. Modify configuration as needed
## How to use ## How to use
@@ -26,6 +27,8 @@ domain: mynetwork.local
dns: dns:
- 8.8.8.8 - 8.8.8.8
- 8.8.4.4 - 8.8.4.4
ntp:
- 192.168.1.0
default_lease: 86400 default_lease: 86400
max_lease: 172800 max_lease: 172800
networks: networks:
@@ -52,6 +55,11 @@ The DNS servers your DHCP server gives to your clients. This option can
contain a list of servers. By default, it is configured to have Google's contain a list of servers. By default, it is configured to have Google's
public DNS servers: `"8.8.8.8", "8.8.4.4". public DNS servers: `"8.8.8.8", "8.8.4.4".
### Option `ntp` (required)
The NTP servers your DHCP server gives to your clients. This option can
contain a list of server. By default, none are configured ([])
### Option: `default_lease` (required) ### Option: `default_lease` (required)
The default time in seconds that the IP is leased to your client. The default time in seconds that the IP is leased to your client.

View File

@@ -1,9 +1,10 @@
--- ---
version: "1.2" version: 1.3.0
slug: dhcp_server slug: dhcp_server
name: DHCP server name: DHCP server
description: A simple DHCP server description: A simple DHCP server
url: https://home-assistant.io/addons/dhcp_server/ url: https://home-assistant.io/addons/dhcp_server/
codenotary: notary@home-assistant.io
advanced: true advanced: true
arch: arch:
- armhf - armhf
@@ -18,6 +19,7 @@ options:
dns: dns:
- 8.8.8.8 - 8.8.8.8
- 8.8.4.4 - 8.8.4.4
ntp: []
domain: null domain: null
hosts: [] hosts: []
max_lease: 172800 max_lease: 172800
@@ -33,6 +35,8 @@ schema:
default_lease: int default_lease: int
dns: dns:
- str - str
ntp:
- str
domain: str domain: str
hosts: hosts:
- ip: str - ip: str

View File

@@ -20,6 +20,15 @@ MAX_LEASE=$(bashio::config 'max_lease')
echo "authoritative;" echo "authoritative;"
} > "${CONFIG}" } > "${CONFIG}"
# Create NTP Server List
if [ "$(bashio::config 'ntp')" ]
then
NTP=$(bashio::config 'ntp|join(", ")')
{
echo "option ntp-servers ${NTP};";
} >> "${CONFIG}"
fi
# Create networks # Create networks
for network in $(bashio::config 'networks|keys'); do for network in $(bashio::config 'networks|keys'); do
BROADCAST=$(bashio::config "networks[${network}].broadcast") BROADCAST=$(bashio::config "networks[${network}].broadcast")