Version 2 Added config file and IPV6 support and benchmarks with massive performance uplifts.

This commit is contained in:
pj1234678
2026-09-24 15:25:57 -07:00
committed by GitHub
parent 4ec95e9f84
commit 589351f6da
38 changed files with 19067 additions and 26 deletions
+71
View File
@@ -0,0 +1,71 @@
# RustyDHCP configuration file (dhcp.conf).
#
# All server settings live here. Lines are `key = value`; blank lines and
# lines starting with '#' or ';' are ignored. Keys are case-insensitive.
# A trailing " # comment" (whitespace + '#') is stripped from values.
# Duplicate keys: the last occurrence wins. Unknown keys are ignored.
#
# Start the server with an optional config path (default: ./dhcp.conf):
# sudo ./target/release/examples/server [path/to/dhcp.conf]
#
# If the file is missing or unreadable, the server logs a warning and uses
# the built-in defaults below.
# --- IPv4 (DHCPv4, RFC 2131) ---------------------------------------------
# Address of this server (put in Server Identifier, option 54).
server_ip = 192.168.2.1
# First address of the managed pool (pool is [ip_start, ip_start+lease_num)).
ip_start = 192.168.2.2
# Pool size. 192.168.2.2 + 252 covers .2 .. .253.
lease_num = 252
# Subnet mask advertised to clients (option 1).
subnet_mask = 255.255.255.0
# Default gateway advertised to clients (option 3).
router_ip = 192.168.2.1
# DNS servers advertised to clients, comma-separated (option 6).
dns_ips = 8.8.8.8
# Master switch for advertising NTP servers (option 42). Off means option 42
# is never sent, exactly like the old hardcoded server.
enable_ntp = true
# NTP servers advertised to clients, comma-separated (option 42). Only sent
# when enable_ntp is true and the list is non-empty.
ntp_ips = 192.168.2.1
# Master switch for DHCP Rapid Commit: IPv4 option 80 (RFC 4039) and IPv6
# option 14 (RFC 8415). When true, a Discover/Solicit carrying the
# rapid-commit option is answered immediately (Ack/Reply, 2-message exchange)
# instead of Offer/Advertise. Off by default (legacy 4-message behavior).
enable_rapid_commit = true
# Where to send replies when the client asked for broadcast. A
# comma-separated list fans each reply out to every address: some
# clients/APs only accept the limited broadcast 255.255.255.255, others
# only the subnet directed broadcast — e.g.
# broadcast_ip = 192.168.2.255
# (Unicast replies always go once to the peer.)
broadcast_ip = 192.168.2.255
# Lease lifetime, seconds, advertised to clients (option 51).
lease_duration_secs = 86400
# "leases" file with permanent reservations, one `mac,ip` per line, e.g.:
# f4:5c:19:af:96:8d,192.168.2.90
leases_file = leases
# Local address to bind for DHCPv4 (server port 67).
listen_addr = 0.0.0.0:67
# --- IPv6 managed range (DHCPv6, RFC 8415) ---------------------------------
# Master switch for the DHCPv6 service (server port 547). Off by default so
# a missing dhcp.conf behaves exactly like the old hardcoded server.
enable_dhcpv6 = true
# Server DUID served in SERVERID options (opaque hex, 1..=128 bytes).
server_duid = 00:03:00:01:02:00:5e:aa:bb:cc
# First address of the managed IPv6 pool.
ipv6_start = fd00::100
# Pool size. fd00::100 + 1000 covers fd00::100 .. fd00::4e7.
ipv6_lease_num = 1000
# DNS servers advertised to DHCPv6 clients, comma-separated (option 23).
ipv6_dns = 2001:4860:4860::8888
# IPv6 lease lifetime, seconds (preferred + valid lifetimes in IAADDR).
ipv6_lease_duration_secs = 86400
# v6 reservations file, one `duid-hex,ipv6` per line, e.g.:
# 00:03:00:01:02:00:5e:aa:bb:cc,fd00::100
leases_file_v6 = leases6
# Local address to bind for DHCPv6 (server port 547).
listen_addr_v6 = [::]:547