Skip to content

DHCPv4-Relay (opinionated Golang implementation).

License

Notifications You must be signed in to change notification settings

Mirantis/dhcp-relay

Repository files navigation

DHCPv4-Relay (opinionated Golang implementation).

This repository contains a DHCPv4 Relay agent written in Go (Golang). This relay agent listens for DHCPv4 requests and forwards them to the specified DHCPv4 server. The application is specially tailored to work in Kubernetes clusters using the hostNetwork container option but can also operate in any other Linux based environment.

Features

  • Listens to traffic on all interfaces without specifically binding to them.
  • No restarts on interface changes.
  • Supports forwarding to the DHCPv4 server via IP address or a dynamic DNS record (K8s Service).
  • Uses BPF to filter out unrelated network traffic in kernel space.
  • Minimalistic design with minimal configuration from CLI.
  • On-demand runtime pprof endpoints availability for on-premises debugging.
  • Requires only CAP_NET_RAW to operate.

Non-features

  • Support for DHCPv6 (DHCP for IPv6).
  • Support for RFC3396 (split options).
  • Explicit list of interfaces to bind to (upstream and/or downstream).
  • Hot reloading for any CLI config options (obviously).
  • Custom interface to range bindings via Link Selection sub-option.
  • Full support for chained DHCPv4-Relay setups (point your relays directly to DHCP Server).

Minimal operation expectations

  • Linux kernel with AF_PACKET, BPF support.
  • CAP_NET_RAW.
  • Network connectivity to DHCPv4 server (and relayed clients).
  • At least one Global unicast IPv4 address on the receiving network interface.
  • Enough CPU/MEM resources for expected load footprint.

Known Issues and Limitations

  • No-op PacketConn listner on DHCPv4 Server port (Severity: none).
  • Some unrelated network traffic comes through to the application before BPF gets applied to the listening socket (Severity: annoyance).
  • Tested only on linux,amd64 platform (Severity: low).

Additional Documentation & Resources

Contribution

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.