User Tools

Site Tools



Embedded DHCP/DHCPv6/RA Server & Relay.



odhcpd is a daemon for serving and relaying IP management protocols to configure clients and downstream routers. It tries to follow the RFC 6204 requirements for IPv6 home routers.

odhcpd provides server services for DHCP, RA, stateless and stateful DHCPv6, prefix delegation and can be used to relay RA, DHCPv6 and NDP between routed (non-bridged) interfaces in case no delegated prefixes are available.


1. Router Discovery support (solicitations and advertisements) with 2 modes

 server:	RD server for slave interfaces
 a) automatic detection of prefixes, delegated prefix and default routes, MTU
 b) automatic reannouncement when changes to prefixes or routes occur
 relay:	RD relay between master and slave interfaces
 a) support for rewriting announced DNS-server addresses in relay mode

2. DHCPv6-support with 2 modes of operation

 server: stateless, stateful and PD-server mode
 a) stateless and stateful address assignment
 b) prefix delegation support
 c) dynamic reconfiguration in case prefixes change
 d) hostname detection and hosts-file creation
 relay: 	mostly standards-compliant DHCPv6-relay
 a) support for rewriting announced DNS-server addresses

3. DHCPv4-support

 server: stateless and stateful mode

4. Proxy for Neighbor Discovery messages (solicitations and advertisments)

 a) support for auto-learning routes to the local routing table
 b) support for marking interfaces "external" not proxying NDP for them
    and only serving NDP for DAD and for traffic to the router itself
    [Warning: you should provide additional firewall rules for security]


odhcpd uses cmake:

  • To prepare a Makefile use: “cmake .”
  • To build / install use: “make” / “make install” afterwards.
  • To build DEB or RPM packages use: “make package” afterwards.


odhcpd uses a UCI configuration file in /etc/config/dhcp for configuration and may also receive information from ubus

Section of type odhcpd

Option		Type	Default			Description
legacy		bool	0			Enable DHCPv4 if start but
						no dhcpv4 option set
leasefile	string				DHCP/v6 lease/hostfile
leasetrigger	string				Lease trigger script

Sections of type dhcp (configure DHCP / DHCPv6 / RA / NDP service)

Option		Type	Default			Description
interface	string	<name of UCI section>	logical OpenWrt interface
ifname		string	<resolved from logical>	physical network interface
networkid	string	same as ifname		compat. alias for ifname
ignore		bool	0			do not serve this interface
						unless overridden by ra, ndp,
						dhcpv4 or dhcpv6 options
master		bool	0			is a master interface
						for relaying

ra		string	disabled		Router Advert service
dhcpv6		string	disabled		DHCPv6 service
dhcpv4		string	disabled		DHCPv4 service
ndp		string	disabled		Neighbor Discovery Proxy

dynamicdhcp	bool	1			dynamically create leases
						for DHCPv4 and DHCPv6
dns		list	<local address>		DNS servers to announce
						accepts IPv4 and IPv6
domain		list	<local search domain>	Search domains to announce

leasetime	string	12h			DHCPv4 address leasetime
start		integer	100			DHCPv4 pool start
limit		integer	150			DHCPv4 pool size

ra_default	integer	0			Override default route
		0: default, 1: ignore no public address, 2: ignore all
ra_management	integer	1			RA management mode
		0: no M-Flag but A-Flag, 1: both M and A, 2: M but not A
		A-Flag: SLAAC / stateless, M-Flag: DHCPv6 / stateful
ra_offlink	bool	0			Announce prefixes off-link
ra_preference	string	medium			Route(r) preference

ra_maxinterval   integer 600	                Maximum time allowed between
				                sending unsolicited RA
ra_mininterval   integer 200	                Minimum time allowed between
				                sending unsolicited RA
ra_lifetime 	 integer 1800	                Value to be placed in Router
				                Lifetime field of RA
ra_useleasetime  bool	 0  	                Use configured leasetime as
				                limit for the preferred and
				                valid lifetime of a prefix
ra_reachabletime integer 0  	                Reachable Time in milliseconds to be
				                advertised in RA messages
ra_retranstime   integer 0  	                Retransmit Time in milliseconds to be
				                advertised in RA messages
ra_hoplimit 	 integer 0  	                Current hoplimit to be advertised
				                in RA messages
ra_mtu           integer 0  	                MTU to be advertised in
                                                RA messages

ndproxy_routing	bool	1			Learn routes from NDP
ndproxy_slave	bool	0			NDProxy external slave
ndproxy_static	list				Static NDProxy prefixes

Sections of type host (static leases)
Option		Type	Default			Description
ip		string				IP-Address to lease
mac		string				MAC-address
duid		string				DUID in base16
hostid		string				IPv6 host identifier
name		string				Hostname

ubus API

ubus -v list dhcp
ubus call dhcp ipv4leases
ubus call dhcp ipv6leases
This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
docs/techref/odhcpd.txt · Last modified: 2020/08/06 16:39 by vgaetera