Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DHCP Options #1585

Closed
nopzolder opened this issue Apr 14, 2020 · 33 comments
Closed

Add DHCP Options #1585

nopzolder opened this issue Apr 14, 2020 · 33 comments
Assignees
Milestone

Comments

@nopzolder
Copy link

Is it possible to use DHCP options within Adguard Home (selfhosted)

Like:

dhcpd option 43 hex f1040a7f0a1b
dhcpd option 150 ip 10.127.15.10
dhcpd option 63 ip 10.127.15.10

For example option 43:
http://blog.schertz.name/2012/05/understanding-dhcp-option-43/

For example option 150: (for IP Phones)
https://specialties.bayt.com/en/specialties/q/279251/what-is-option-150-in-cisco-voip/

General:
https://docs.paloaltonetworks.com/pan-os/8-1/pan-os-admin/networking/dhcp/dhcp-options

@ameshkov
Copy link
Member

Currently, we don't yet support these options. Let's see how many upvotes this feature request gets.

@s3frank
Copy link

s3frank commented Apr 18, 2020

I am in the process of switching from pihole and this is a blocker for me. I need to his to tell all my clients where their NTP server is in the network and there is noway to do this now with AdGuard.

I would totally love it if you enable a name value pair approach in the dhcp section in yaml only. This doesn't need to be in GUI. In dnsmasq.conf for PiHole it works like this:

dhcp-option=option:ntp-server,192.168.10.2

This seems like an easy thing to do I think and I'd be interested in adding this myself though my coding skills are limited to java, php, javascript, c#, python. Not sure if that helps?

BTW, I see in the some of the help on github reference to /etc/dhcpd.conf. Does that mean we can add option tags in there and AdGuard will just server them out? Like so:

option option-name option-data

@nopzolder
Copy link
Author

In DHCPD.conf it's like this:

option cucm63 code 63 = ip-address;
option cucm150 code 150 = ip-address;
option wlc43 code 43 = string;
ignore declines;

subnet 192.168.x.0 netmask 255.255.255.0 {
option routers 192.168.x.1;
option subnet-mask 255.255.255.0;
range 192.168.x.10 192.168.x.99;
option broadcast-address 192.168.x.255;
option domain-name-servers 192.168.x.222;
option domain-name "x.nl";
option domain-search "x.nl";
option cucm63 10.127.15.10;
option cucm150 10.127.15.10;
option wlc43 "f1040a7f0a1b";

@s3frank
Copy link

s3frank commented Apr 19, 2020

So we can add options through this then? I haven't tried it yet but if that works then I don't see a need for this feature request given that it's a relative advanced use case with a working solution.

I will have a closer look later today / tomorrow.

@nopzolder
Copy link
Author

No, it's not implementend yes as far as i know, i use a isc-dhcpd docker image for DHCP at the moment.

@ameshkov ameshkov added this to the v0.104 milestone Apr 19, 2020
@waxhawsam
Copy link

Adding additional DHCP options to the GUI would be the best case, but even pointing us to where we can make changes at the CLI would be a good start. As stated above, I also am interested in coming over from Pihole. It uses DNSMASQ so I can leverage it's config to build the various DHCP scopes and options as I need.

@ameshkov ameshkov modified the milestones: v0.104, v0.103 Apr 20, 2020
@ameshkov
Copy link
Member

It seems to be a popular issue, assigned to v0.103.

Please explain what DHCP options you're using if they weren't mentioned here yet.

@waxhawsam
Copy link

I think most are mentioned, I was looking and noticed another issue where you're looking to add dnsmasq features. To me this resolves this issue as well. I leverage dnsmasq configs on my pi-hole server so it can be my dhcp and dns for our network. Having the flexibility to setup multiple subnets, with different subnet masks, gateways, lease times, etc as well as supporting static dhcp reservations and static hosts (like network gear that get assigned an ip without using DHCP). This allows the DNS to resolve local names.
My testing with Adblock home so far is going very well, seems to strike a better balance of blocking ads without breaking apps. Thanks!

@s3frank
Copy link

s3frank commented Apr 21, 2020 via email

@waxhawsam
Copy link

Agreed, local resolution would really depend on what is the backend for Adguard, if your using dnsmasq like pihole then it's built in once you enable the DHCP server.

@szolin szolin self-assigned this Apr 24, 2020
@szolin
Copy link
Contributor

szolin commented Apr 24, 2020

The simplest way to implement it is to set the options in yaml config file:

dhcp:
...
  options:
  - '43 hex f1040a7f0a1b'
  - '150 ip 10.127.15.10'

no UI, no API.

Or does anyone need an API to set/get these options?

@waxhawsam
Copy link

waxhawsam commented Apr 24, 2020

So is Adguard using Netplan for DHCP server? Looks like the same syntax, can you also use the yaml file to setup multiple DHCP scopes?

@ibksturm
Copy link

@szolin да, GUI оглична от DHCP оптион :)

ps: year, still learning

@s3frank
Copy link

s3frank commented Apr 24, 2020 via email

@nopzolder
Copy link
Author

nopzolder commented Apr 24, 2020 via email

@s3frank
Copy link

s3frank commented May 2, 2020

Just to let you know that I am not longer requesting this feature.
I have setup a RPi4 in the last few days that I am very pleased with as follows:

Local DNS & DHCP and Time:

  • chrony for time
  • dnsmasq server on port 5053
    --- dhcp hands out ntp and dns options

Main DNS For all Clients:

  • AdGuardHome on port 53
  • In the upstream I have added dnsmasq for my local domain

I believe splitting DHCP and Local DNS like this is actually my preference as I can independently manage my local network without disrupting potential external dns services. My family members prefer that :-)

@szolin
Copy link
Contributor

szolin commented Aug 25, 2020

https://github.com/AdguardTeam/AdGuardHome/wiki/Configuration#configuration-file
dhcp.dhcpv4.options setting
Syntax:
Option with arbitrary hexadecimal data:

	DEC_CODE hex HEX_DATA

where DEC_CODE is a decimal DHCPv4 option code in range [1..255]

Option with IP data (only 1 IP is supported):

	DEC_CODE ip IP_ADDR

@szolin
Copy link
Contributor

szolin commented Aug 25, 2020

9c999f9

@szolin szolin closed this as completed Aug 25, 2020
@jncanches
Copy link

Hi ! Thanks for closing this. But why can we only set 1 IP?
Option with IP data (only 1 IP is supported)

How can I set option 6 to specify two dns in clients DHCP config?
Can I write two lines liké

6 ip 8.8.8.8
6 ip 8.8.4.4

Thanks for your answer!

@ameshkov
Copy link
Member

ameshkov commented Nov 4, 2020

@jncanches have you tried it? It's not immediately clear to me what would happen in this case since AdGuard Home forces itself to be a DNS server and this may interfere.

Anyway, if it does not work, please open a bug report, we'll see what can be done about it.

@jncanches
Copy link

@ameshkov I was hoping to have an answer before trying AdGuard Home, but I will give it a try tonight. I will update this post after that.
FYI, I need this because a lot of android phones set the secondary DNS to 8.8.8.8 if the DHCP server doesn't set it, so device requests are not filtered :(

I come from PI-Hole and this is done via dnsmasq configuration

@ameshkov
Copy link
Member

ameshkov commented Nov 4, 2020

FYI, I need this because a lot of android phones set the secondary DNS to 8.8.8.8 if the DHCP server doesn't set it, so device requests are not filtered

Interesting. Do you usually set both DNS servers to the same IP address?

@TheSleepySlee
Copy link

I am interested in understanding how to apply such options in YAML file.
Something like this in dnsmasq config:

dhcp-option-force=tag:decodeur,125,00:00:0D:E9:24:04:06:44:34:36:30:45:33:05:0F:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:06:09:4C:69:76:65:62:6F:78:20:34

How would this be set in YAML? I tried with no luck.

@ainar-g
Copy link
Contributor

ainar-g commented Jan 18, 2021

@TheSleepySlee, is option code 125 some kind of vendor-specific option?

Either way, please see https://github.com/AdguardTeam/AdGuardHome/wiki/DHCP#config-4. For your case it'll probably be something close to:

#
'dhcp':
  #
  'dhcpv4':
    #
    'options':
    - '125 hex 00000DE92404…

@TheSleepySlee
Copy link

TheSleepySlee commented Jan 18, 2021

Yes, tried this with no luck. I have to specify some hex data to enable IPTV using DHCP server. Only for the IPTV devices, not for the rest of devices. Hence the tag in the example I provided.

Details here (in french): https://forums.framboise314.fr/viewtopic.php?f=57&t=5960
Need to enable option 125.

@ainar-g
Copy link
Contributor

ainar-g commented Jan 18, 2021

@TheSleepySlee, I see, thanks. I've opened #2573 for your request.

@TheSleepySlee
Copy link

@ainar-g thanks.
Another way I got it working in pihole is using this kind of option:

dhcp-option-force=tag:decodeur,vi-encap:1234,5,"AB1234567890"

Would this already work using current version of adguard?
I need a tag, since this needs to be applied to 2 IPTV.

@samsam-rolon
Copy link

Hello @TheSleepySlee
I Have follow this topic https://forums.framboise314.fr/viewtopic.php?f=57&t=5960 to generate my full hexa string in order to do something like this :
image
Forgot VI-ENCAP and create youself the hexa string : painfull but only way to do it as far as I see

On my side, I've notice a non persistant config, even in YAML (cf #3101 ). Moreover, as far as I see, my STB doesn't still work, I'm doing a wireshark analysing right now

@samsam-rolon
Copy link

As far as I see, the option specified is ignored

@TheSleepySlee
Copy link

I use pihole since then.
Switched internet provider this week, so this set top box issue is irrelevant now. Will try adguard again soon

@rob-1981
Copy link

Hello i also use DHCP option event if i see this request is uncomment till 05/2021.
For my part i m using several device and also IP phones
The option i need are the following

2 Time Offset Time offset in seconds from UTC
3 Router N/4 router addresses
4 Time Servers N/4 time server addresses
6 DNS Servers N/4 DNS server addresses
7 Log Servers N/4 logging server addresses
66 TFTP Server Name TFTP server name
67 Boot File Name Boot file name
150 TFTP Server Address, Etherboot, GRUB Config

But you have a lit of the options here http://help.sonicwall.com/help/sw/eng/6800/26/2/3/content/Network_DHCP_Server.042.12.htm

I also use Proximus TV decoder (Belgium), I m kind of shure they use some DHCP option for there configuration but i still do not put the hand on that configuration.

For info the option shoud be set by user or groupe of user regarding the fact that for exemple the boof serveur for a Polycom phone (option 66) is the the same for a Yealink Phone

And yes i have those kind of device at home, home working :)

@mquade
Copy link

mquade commented Mar 3, 2023

Works for me. One thing to ensure: No space between value and measuring unit. My working configuration:

  enabled: true 
  interface_name: eth0
  local_domain_name: home.mystreetname14.de
  dhcpv4:           
    gateway_ip: 192.168.14.1
    subnet_mask: 255.255.255.0
    range_start: 192.168.14.100
    range_end: 192.168.14.200
    lease_duration: 3600  
    icmp_timeout_msec: 1000   
    options:           
      - 2 dur 60m     
      - 42 ip 192.168.14.1  
      - 119 text home.mystreetname14.de
  dhcpv6:                
    range_start: ""
    lease_duration: 86400
    ra_slaac_only: false  
    ra_allow_slaac: false

@Krafting
Copy link

Would be cool to add DHCP options to AAdguard Home in a GUI way, instead of having to go through the config file..

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests