home-assistant / addons

:heavy_plus_sign: Docker add-ons for Home Assistant
https://home-assistant.io/hassio/
Apache License 2.0
1.52k stars 1.47k forks source link

dhpc server on vlan #3104

Closed karidavidsson closed 1 year ago

karidavidsson commented 1 year ago

Describe the issue you are experiencing

Configuring DHCP server on a VLAN (IOT network):

broadcast: 192.168.10.255
gateway: 192.168.10.1
interface: eth0.10
netmask: 255.255.255.0
range_end: 192.168.10.254
range_start: 192.168.10.240
subnet: 192.168.10.0

It fails to start, and outputs the following into the log:

[15:52:12] INFO: Starting DHCP server...
Internet Systems Consortium DHCP Server 4.4.2-P1
Copyright 2004-2021 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
/etc/dhcpd.conf line 8: semicolon expected.
  interface eth0.
                 ^
/etc/dhcpd.conf line 9: range declaration not allowed here.
  range 
   ^
/etc/dhcpd.conf line 11: expecting a declaration
  option broadcast-address 192.168.10.255;
                                          ^

What type of installation are you running?

Home Assistant OS

Which operating system are you running on?

Home Assistant Operating System

Which add-on are you reporting an issue with?

DHCP Server

What is the version of the add-on?

1.3.0

Steps to reproduce the issue

  1. Create VLAN interface using the ha console : ha > network vlan eth0 10 --ipv4-method static --ipv4-address 192.168.10.1/24 --ipv6-method disabled
  2. Configure the dhcp server via the WebUI using default values but in the Networks section set the interface value to vlan interface, e.g. eth0.10. (And of course adjust IP ranges, see config above)

System Health information

System Information

version core-2023.6.2
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.11.4
os_name Linux
os_version 6.1.21-v8
arch aarch64
timezone Atlantic/Reykjavik
config_dir /config
Home Assistant Cloud logged_in | false -- | -- can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | ok
Home Assistant Supervisor host_os | Home Assistant OS 10.2 -- | -- update_channel | stable supervisor_version | supervisor-2023.06.2 agent_version | 1.5.1 docker_version | 23.0.6 disk_total | 13.9 GB disk_used | 3.7 GB healthy | true supported | true board | rpi3-64 supervisor_api | ok version_api | ok installed_addons | Z-Wave JS (0.1.84), chrony (2.6.0), DHCP server (1.3.0)
Dashboards dashboards | 1 -- | -- resources | 0 mode | auto-gen
Recorder oldest_recorder_run | June 17, 2023 at 3:12 PM -- | -- current_recorder_run | June 17, 2023 at 3:22 PM estimated_db_size | 0.88 MiB database_engine | sqlite database_version | 3.41.2

Anything in the Supervisor logs that might be useful for us?

No response

Anything in the add-on logs that might be useful for us?

No response

Additional information

Works fine if vlan interface is not used.

MattWestb commented 1 year ago

I dont knowing what is going wrong but its looks being wrong in the parameters you is using. semicolon expected. interface eth0. Its complaining of like 8 and 9 but i dont knowing wish parameter is it but one or two of this: nterface: eth0.10 netmask: 255.255.255.0 range_end: 192.168.10.254 range_start: 192.168.10.240 subnet: 192.168.10.0

karidavidsson commented 1 year ago

It looks to me that it is the . in eth0.10 that confuses the configuration parser. I tried to enclose the argument in "" and '' and it does not work, i.e. when Save is pressed in the WebUI the "" or '' are removed.

Looks like line 36 is not returning the correct interface and therefore is line 44 not generating the correct configuration line (with terminating semicolon)

P.S. I fixed the formatting of the code blocks with the config and log output for better reading

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stevaedrum commented 1 year ago

It looks to me that it is the . in eth0.10 that confuses the configuration parser. I tried to enclose the argument in "" and '' and it does not work, i.e. when Save is pressed in the WebUI the "" or '' are removed.

Looks like line 36 is not returning the correct interface and therefore is line 44 not generating the correct configuration line (with terminating semicolon)

P.S. I fixed the formatting of the code blocks with the config and log output for better reading

Hi all, I have the same issue with VLAN.

Please @karidavidsson how have you fixed it, could you explain.

Thanks in advance.

karidavidsson commented 1 year ago

I have not fixed it and do not have a fix. Disappointed that this is closed without explanation or a workaround.

stevaedrum commented 1 year ago

@karidavidsson Thanks for your answer.

I trying to find a workaround

stevaedrum commented 1 year ago

@karidavidsson

Hi, i have find a workaround, please see below it's working for me. Have a nice day.

image