1 # odhcpd - Embedded DHCP/DHCPv6/RA Server & Relay 2 3 ## Abstract 4 5 odhcpd is a daemon for serving and relaying IP management protocols to 6 configure clients and downstream routers. It tries to follow the RFC 6204 7 requirements for IPv6 home routers. 8 9 odhcpd provides server services for DHCP, RA, stateless and stateful DHCPv6, 10 prefix delegation and can be used to relay RA, DHCPv6 and NDP between routed 11 (non-bridged) interfaces in case no delegated prefixes are available. 12 13 14 ## Features 15 16 1. Router Discovery support (solicitations and advertisements) with 2 modes: 17 * server: RD server for slave interfaces 18 * automatic detection of prefixes, delegated prefix and default routes, MTU 19 * automatic reannouncement when changes to prefixes or routes occur 20 21 * relay: RD relay between master and slave interfaces 22 * support for rewriting announced DNS-server addresses in relay mode 23 24 2. DHCPv6-support with 2 modes of operation 25 * server: stateless, stateful and PD-server mode 26 * stateless and stateful address assignment 27 * prefix delegation support 28 * dynamic reconfiguration in case prefixes change 29 * hostname detection and hosts-files creation 30 31 * relay: mostly standards-compliant DHCPv6-relay 32 * support for rewriting announced DNS-server addresses 33 34 3. DHCPv4-support 35 * server: stateless and stateful mode 36 37 4. Proxy for Neighbor Discovery messages (solicitations and advertisements) 38 * support for auto-learning routes to the local routing table 39 * support for marking interfaces "external" not proxying NDP for them 40 and only serving NDP for DAD and for traffic to the router itself 41 [Warning: you should provide additional firewall rules for security] 42 43 5. IPv6 PxE Support 44 45 46 ## Compiling 47 48 odhcpd uses cmake: 49 * To prepare a Makefile use: `cmake .` 50 * To build / install use: `make` / `make install` afterwards. 51 * To build DEB or RPM packages use: `make package` afterwards. 52 53 54 ## Configuration 55 56 odhcpd uses a UCI configuration file in `/etc/config/dhcp` for configuration 57 and may also receive information from ubus 58 59 60 ### Section of type odhcpd 61 62 | Option | Type |Default| Description | 63 | :------------ | :---- | :---- | :---------- | 64 | maindhcp | bool | 0 | Use odhcpd as the main DHCPv4 service | 65 | leasefile | string| | DHCPv4/6 lease file | 66 | leasetrigger | string| | Lease trigger script | 67 | hostsdir | string| | DHCPv4/v6 hostfile directory (one file per interface will be created) | 68 | loglevel |integer| 6 | Syslog level priority (0-7) | 69 | piodir |string | | Directory to store IPv6 prefix information (to detect stale prefixes, see RFC9096, §3.5) | 70 | enable_tz |bool | 1 | Toggle whether RFC4833 timezone information is sent to clients, if set in system | 71 72 73 ### Sections of type dhcp (configure DHCP / DHCPv6 / RA / NDP service) 74 75 | Option | Type |Default| Description | 76 | :-------------------- | :---- | :---- | :---------- | 77 | interface |string |`<name of UCI section>`| logical OpenWrt interface | 78 | ifname |string |`<resolved from logical>`| physical network interface | 79 | networkid |string |same as ifname| compat. alias for ifname | 80 | master |bool | 0 | is a master interface for relaying | 81 | ra |string |disabled| Router Advert service [disabled\|server\|relay\|hybrid] | 82 | dhcpv6 |string |disabled| DHCPv6 service [disabled\|server\|relay\|hybrid] | 83 | dhcpv4 |string |disabled| DHCPv4 service [disabled\|server] | 84 | ndp |string |disabled| Neighbor Discovery Proxy [disabled\|relay\|hybrid] | 85 | dynamicdhcp |bool | 1 | Dynamically create leases for DHCPv4 and DHCPv6 | 86 | dhcpv4_forcereconf |bool | 0 | Force reconfiguration by sending force renew message even if the client did not include the force renew nonce capability option (RFC6704) | 87 | dhcpv6_assignall |bool | 1 | Assign all viable DHCPv6 addresses in statefull mode; if disabled only the DHCPv6 address having the longest preferred lifetime is assigned | 88 | dhcpv6_hostidlength |integer| 12 | Host ID length of dynamically created leases, allowed values: 12 - 64 (bits). | 89 | dhcpv6_na |bool | 1 | DHCPv6 stateful addressing hands out IA_NA - Internet Address - Network Address | 90 | dhcpv6_pd |bool | 1 | DHCPv6 stateful addressing hands out IA_PD - Internet Address - Prefix Delegation (PD) | 91 | dhcpv6_pd_preferred |bool | 0 | Set the DHCPv6-PD Preferred (P) flag in outgoing ICMPv6 RA message PIOs (RFC9762); requires `dhcpv6` and `dhcpv6_pd`. | 92 | dhcpv6_pd_min_len |integer| 62 | Minimum prefix length to delegate with IA_PD (adjusted, if necessary, to be longer than the interface prefix length). Range [1,64] | 93 | dhcpv6_relay_servers |list| - | IPv6 addresses of DHCPv6 servers to relay the DHCPv6 Messages to | 94 | router |list |`<local address>`| IPv4 addresses of routers on a given subnet (provided via DHCPv4, should be in order of preference) | 95 | dns |list |`<local address>`| DNS servers to announce, accepts IPv4 and IPv6 | 96 | dnr |list |disabled| Encrypted DNS servers to announce, `<priority> <domain name> [<comma separated IP addresses> <SvcParams (key=value)>...]` | 97 | dns_service |bool | 1 | Announce the address of interface as DNS service if the list of dns is empty | 98 | domain |list |`<local search domain>`| Search domains to announce | 99 | leasetime |string | 12h | DHCPv4 address leasetime | 100 | start |integer| 100 | DHCPv4 pool start | 101 | limit |integer| 150 | DHCPv4 pool size | 102 | max_preferred_lifetime|string | 45m | Upper limit for the preferred lifetime for a prefix | 103 | max_valid_lifetime |string | 90m | Upper limit for the valid lifetime for a prefix | 104 | ra_default |integer| 0 | Override default route - 0: default, 1: ignore no public address, 2: ignore all | 105 | ra_flags |list |other-config| List of RA flags to be advertised in RA messages [managed-config\|other-config\|home-agent\|none] | 106 | ra_slaac |bool | 1 | Advertise that prefixes (which are <= 64 bits long) on this interface can be used for SLAAC (the "A" flag in the PIO, RFC4861, §4.6.2) | 107 | ra_advrouter |bool | 0 | Advertise the IPv6 address of this router in RA messages (the "R" flag in the PIO, RFC6275, §7.2) | 108 | ra_offlink |bool | 0 | Announce prefixes off-link | 109 | ra_preference |string | medium| Route(r) preference [medium\|high\|low] | 110 | ra_maxinterval |integer| 600 | Maximum time allowed between sending unsolicited RA | 111 | ra_mininterval |integer| 200 | Minimum time allowed between sending unsolicited RA | 112 | ra_lifetime |integer| 2700 | Value to be placed in Router Lifetime field of RA. Not recommended to be more than 2700 (RFC9096). | 113 | ra_reachabletime |integer| 0 | Reachable Time in milliseconds to be advertised in RA messages | 114 | ra_retranstime |integer| 0 | Retransmit Time in milliseconds to be advertised in RA messages | 115 | ra_hoplimit |integer| 0 | Current hoplimit to be advertised in RA messages | 116 | ra_mtu |integer| - | MTU to be advertised in RA messages | 117 | ra_dns |bool | 1 | Announce DNS configuration in RA messages (RFC8106) | 118 | ra_pref64 |string | - | Announce PREF64 option for NAT64 prefix (RFC8781) [IPv6 prefix] | 119 | ndproxy_routing |bool | 1 | Learn routes from NDP | 120 | ndproxy_slave |bool | 0 | NDProxy external slave | 121 | ndp_from_link_local |bool | 1 | Use link-local source addresses for NDP operations (RFC 4861, §4.2 compliance) and macOS compatibility | 122 | prefix_filter |string |`::/0` | Only advertise on-link prefixes within the provided IPv6 prefix; others are filtered out. [IPv6 prefix] | 123 | ntp |list |`<local address>`| NTP servers to announce accepts IPv4 and IPv6 | 124 | upstream |list | - | A list of interfaces which can be used as a source of configuration information (e.g. for NTP servers, if not set explicitly). | 125 | captive_portal_uri |string | no | The API URI to be sent in RFC8910 captive portal options, via DHCPv4, DHCPv6, and ICMPv6 RA. | 126 | ipv6_only_preferred |integer| 0 | Indicate that IPv6-only mode is preferred (RFC8925) [V6ONLY_WAIT time in seconds] | 127 128 [//]: # "dhcpv6_raw - string - not documented, may change when generic DHCPv4/DHCPv6 options are added" 129 130 131 ### Sections of type host (static leases) 132 | Option | Type |Default| Description | 133 | :-------------------- | :---- | :---- | :---------- | 134 | ip |string |(none) | IPv4 host address or `ignore` to ignore any DHCPv4 request from this host | 135 | mac |list\|string|(none) | HexadecimalMACaddress(es) | 136 | duid |list\|string|(none) | Hexadecimal DUID(s), or DUID%IAID(s) | 137 | hostid |string |(none) | IPv6 tokenised IID or `ignore` to ignore any DHCPv6 request from this host | 138 | name |string |(none) | Hostname | 139 | leasetime |string |(none) | DHCPv4/v6leasetime | 140 141 142 ### Sections of type boot6 143 | Option | Type |Required|Description | 144 | :------------ | :---- | :---- | :---------- | 145 | url |string | yes | e.g. `tftp://[fd11::1]/pxe.efi` | 146 | arch |integer| no | the arch code. `07` is EFI. If not present, this boot6 will be the default. | 147 148 odhcpd also uses the UCI configuration file `/etc/config/network` for configuration 149 of the following options: 150 151 ### Section of type globals 152 | Option | Type |Required|Description | 153 | :---------------- | :---- | :---- | :---------- | 154 | dhcp_default_duid |string | no | The DUID to use to identify the DHCPv6 server to clients. | 155 156 157 ### System variables for Timezone options (uci system.system) 158 | Option | Type |Required|Description | 159 | :------------ | :---- | :---- | :---------- | 160 | timezone |string | no | e.g. `EST5EDT4,M3.2.0/02:00,M11.1.0/02:00` | 161 | zonename |string| no | e.g. `Europe/Zurich` | 162 163 164 ## ubus Interface 165 166 odhcpd currently exposes the following methods under the `dhcp` object path: 167 168 | Method | Arguments | Description | 169 | :------------ | :------------ | :---------- | 170 | `ipv4leases` | `none` | Lists all currently active DHCPv4 leases per interface | 171 | `ipv6leases` | `none` | Lists all currently active DHCPv6 leases per interface | 172 | `ipv6ra` | `none` | Lists announced IPv6 prefixes per interface | 173 | `add_lease` | options as in the cfg `host` section | Creates a new static lease, the arguments need to be formatted as a valid JSON string | 174 175 These can be called by running e.g. `ubus call dhcp ipv6leases` on your OpenWrt 176 device. 177 178 odhcpd currently broadcasts the following events via ubus: 179 180 | Name | Parameters | Description | 181 | :------------ | :---------------------------- | :------------ | 182 | `dhcp.lease4` | `mac,ip,name,interface` | A new DHCPv4 lease has been created | 183 | `dhcp.release4`| `mac,ip,name,interface` | A DHCPv4 lease has been released by a client | 184 | `dhcp.expire4`| `mac,ip,name,interface` | A DHCPv4 lease has expired | 185 186 These can be observed by running e.g. `ubus listen dhcp` on your OpenWrt device.
This page was automatically generated by LXR 0.3.1. • OpenWrt