OpenWrt Forum Archive

Topic: dnsmasq or odhcpd?

The content of this topic has been archived on 27 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I'm confused about the overlap between dnsmasq and odhcpd.
What does one offer that the other doesn't? (I'm particularly interested in anything IPv6-related)
Is there any reason why would I need both? (I have seen /etc/config/dhcp config files with both sections)

dnsmasq is the DNS server and also the ipv4 dhcp server. (It can be compiled to support also ipv6, but it does not do that by default.)
odhcpd is a decidated dhcpv6/ra daemon and the default for handling ipv6 stuff.

hnyman wrote:

dnsmasq is the DNS server and also the ipv4 dhcp server. (It can be compiled to support also ipv6, but it does not do that by default.)
odhcpd is a decidated dhcpv6/ra daemon and the default for handling ipv6 stuff.

Thanks, but is there a reason WHY dnsmasq is not used for IPv6 by default?
From the home page (thekelleys.org.uk/dnsmasq/doc.html):

Dnsmasq provides full IPv6 support.

bkinsell wrote:
hnyman wrote:

dnsmasq is the DNS server and also the ipv4 dhcp server. (It can be compiled to support also ipv6, but it does not do that by default.)
odhcpd is a decidated dhcpv6/ra daemon and the default for handling ipv6 stuff.

Thanks, but is there a reason WHY dnsmasq is not used for IPv6 by default?
From the home page (thekelleys.org.uk/dnsmasq/doc.html):

Dnsmasq provides full IPv6 support.

I think..
almost each features in openwrt are mini(slim) and full. MiniTCPDUMP, mini iperf, ip vs ip_full... In embended devices is not much space to install everything in full configuration.

bkinsell wrote:

Thanks, but is there a reason WHY dnsmasq is not used for IPv6 by default?

odhcpd does much more than just ipv6 dhcp. In addition to dhcpv6 it provides all RA functionality -
accepts RAs (instead of default kernel built-in mechanism which is not used in openwrt),
can act as RA server and can do RA/NDP relaying (which is itself very specific function).
Its well integrated with openwrt's network management engine - netifd - and communicates with it directly via ubus interface. So, odhcpd is openwrt specific daemon written in C to meet all its specific needs. Initially devs wrote shell scripts for all the stuff and used well known commands and daemons but later they started to write native daemons because of increased stability and reliability.
Better question - why still dnsmasq used as dhcpv4 server. Odhcpd contain dhcpv4 code. May be because dnsmasq is more configurable and for older versions compatibility. Odhcpd is good thing for most uses but there're scenarios where its not enough flexible and radvd have to be used.

bkinsell wrote:

Is there any reason why would I need both?

Without ipv6 odhcpd can be safely disabled.
If you disable dnsmasq you will lose dns and dhcpv4.
Of course its possible to throw away standard openwrt management and use some daemons - bind, isc-dhcp server, radvd. But this way openwrt becomes something else - may be more simular to standard linux distros. You lose ability to control it properly via uci/luci/ubus/netifd and may encounter some conflicts between built-in management leftovers and external daemons which know nothing about openwrt. Also standard daemons take more resources and 32 mb of RAM can be too small for them all. They also may not fit to builtin flash.

(Last edited by bolvan on 20 Oct 2016, 16:40)

For historic reasons as far as I can tell, dnsmasq-full provides all my IPv6 needs and odhcpd is disabled all together.

sera wrote:

For historic reasons as far as I can tell, dnsmasq-full provides all my IPv6 needs and odhcpd is disabled all together.

I am curious, does your DNSMasq configuration support DHCPv6-PD client and server? I have downstream routers which automagically get IPv6 prefixes from my gateway router (via odhcpd). TIA.

cvmiller wrote:
sera wrote:

For historic reasons as far as I can tell, dnsmasq-full provides all my IPv6 needs and odhcpd is disabled all together.

I am curious, does your DNSMasq configuration support DHCPv6-PD client and server? I have downstream routers which automagically get IPv6 prefixes from my gateway router (via odhcpd). TIA.

http://www.thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html wrote:

The dnsmasq DHCPv6 server provides the same set of features as the DHCPv4 server, and in addition, it includes router advertisements and a neat feature which allows nameing for clients which use DHCPv4 and stateless autoconfiguration only for IPv6 configuration. There is support for doing address allocation (both DHCPv6 and RA) from subnets which are dynamically delegated via DHCPv6 prefix delegation.

I don't have your particular use case but don't see what is missing yet.

Your comment about server/client confuses me, odhcp6c is still needed as there is no busybox replacement (udhcp6c) yet.

What I mean is that in my use case (and many share this) OpenWRT must act as a DHCPv6-PD client to the ISP (using odhcp6c by default), getting a prefix, and then act as a server to the LAN with the delegated prefix (using odhcpd by default).

The discussion might have continued from here.