{"id":13700927,"url":"https://github.com/lclarkmichalek/etcdhcp","last_synced_at":"2026-01-27T03:09:31.876Z","repository":{"id":50451338,"uuid":"97523902","full_name":"lclarkmichalek/etcdhcp","owner":"lclarkmichalek","description":"A DHCP server backed by etcd","archived":false,"fork":false,"pushed_at":"2017-07-18T19:08:37.000Z","size":22,"stargazers_count":261,"open_issues_count":2,"forks_count":20,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-08-14T12:24:14.502Z","etag":null,"topics":["cloudnative","dhcp","etcd"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lclarkmichalek.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-17T21:28:45.000Z","updated_at":"2025-08-14T10:46:41.000Z","dependencies_parsed_at":"2022-09-15T21:11:25.375Z","dependency_job_id":null,"html_url":"https://github.com/lclarkmichalek/etcdhcp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lclarkmichalek/etcdhcp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lclarkmichalek%2Fetcdhcp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lclarkmichalek%2Fetcdhcp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lclarkmichalek%2Fetcdhcp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lclarkmichalek%2Fetcdhcp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lclarkmichalek","download_url":"https://codeload.github.com/lclarkmichalek/etcdhcp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lclarkmichalek%2Fetcdhcp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28798662,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T01:07:07.743Z","status":"online","status_checked_at":"2026-01-27T02:00:07.755Z","response_time":168,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cloudnative","dhcp","etcd"],"created_at":"2024-08-02T20:01:09.052Z","updated_at":"2026-01-27T03:09:31.859Z","avatar_url":"https://github.com/lclarkmichalek.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# etcDHCP\n\nEver wondered what was going on with your DHCP leases? Not comfortable looking\nat `/var/lib/dhcp/dhcp.leases`? Feel like your DHCP should be a bit higher\navailablilty, and a little bit more stateless? Prefer GRPC to ARP? Want to make\nyour DHCP server a legitimate microservice? Is dhcpd not cloud native enough for\nyou?\n\nIf any of that applies to you, I may have the DHCP server of your dreams, right\nhere. etcDHCP is the worlds first strongly consistent distributed DHCP server\n(in the absence of any other google results), using CoreOS's etcd to ensure that\nwhatever happens, your leases will remain available. Well, at least, in 49% of\ncases. Assuming all cases have an independent effect on your etcd nodes.\n\n## Install\n\nIf you've never built a Go project before, I'm sorry.\n\n```\n$ go get -u github.com/golang/dep/cmd/dep\n$ go get github.com/lclarkmichalek/etcdhcp\n$ cd $GOPATH/src/github.com/lclarkmichalek/etcdhcp\n$ dep ensure\n$ go install\n```\n\n## Setup\n\n### etcd\n\netcDHCP requires etcd, surprisingly enough. Notably, it requires at least\nversion 3.3.0. However, this version doesn't actually exist yet, so just run\nmaster.\n\n### etcDHCP\n\nBecause running `--help` is hard, I guess.\n\n```\n$ etcdhcp \\\n  -etcd.discovery.endpoints localhost:2379 \\\n  -v=2 \\\n  -dhcp.router 10.6.9.1 \\\n  -dhcp.dns 10.6.9.1 \\\n  -dhcp.server-if wlan0_ap \\\n  -dhcp.server-ip 10.6.9.1 \\\n  -dhcp.subnet-mask 255.255.255.0 \\\n  -dhcp.issue-from 10.6.9.10 \\\n  -dhcp.issue-to 10.6.9.100 \\\nI0717 17:39:22.076564   25273 main.go:51] starting dhcp listener\nI0717 17:39:22.076564   25273 main.go:45] starting admin server on :9842\n```\n\nThere are tons of etcd options, most of which will probably be useless, as if\nyou're not yet running a DHCP server, there's a decent chance that SRV record\nresolution won't be working. Notably missing is discovery via MAC address. Now\nthat'd be fun..\n\nThe DHCP options should be, um, well, let's hope you've configured a DHCP server\nbefore. Plenty of things aren't supported, but you can certainly get a lot of\nstuff working by writing to etcd directly.\n\n## Operating concerns\n\nLike all ~~good~~ cloud native software, etcDHCP exports Prometheus metrics on\n`:9842`. There's also pprof endpoints exposed. I didn't implement a readiness or\nliveness endpoint, as um, well they'd be a bit pointless. Also no graceful\nshutdowns because github.com/krolaw/dhcp4 doesn't support context yet.\n\n## etcd structure\n\n```\n$ ./etcdctl get etcdhcp::ips::leased::10.6.9.99\netcdhcp::ips::leased::10.6.9.99\n5c:96:56:a4:be:eb\n$ ./etcdctl get etcdhcp::ips::free::10.6.9.94\netcdhcp::ips::free::10.6.9.94\n10.6.9.94\n$ ./etcdctl get etcdhcp::nics::leased::08:9e:08:b5:af:01\netcdhcp::nics::leased::08:9e:08:b5:af:01\n10.6.9.97\n```\n\nWant to add more IPs? Either restart the dhcp server with a different range,\nor..\n\n```\n$ for i in `seq 200 220`; do ./etcdctl put etcdhcp::ips::free::10.6.9.$i 10.6.9.$i; done\n```\n\nWarning: IPs that aren't in the range of a running server will gradually be\nphased out. They'll be removed when they are picked up by a client, and that\nclient allows the lease to expire.\n\nWant to react to a device connecting? Watch the nic entry for the device's MAC\naddress:\n\n```\n$ etcdctl watch etcdhcp::nics::leased::08:9e:08:b5:af:01\n```\n\nBeware that renewals will cause updates to the nic key (updating/changing the\nlease to one with a more recent expiry). make sure to watch for\ncreation/deletion events only.\n\nWant to give a specific device a specific ip? Just associate the two, and any\nDHCP discovery request will pick up the existing association.\n\n```\n$ etcdctl put etcdhcp::nics::leased::08:9e:08:b5:af:01 10.6.9.2\n$ etcdctl put etcdhcp::ips::leased::10.6.9.2 08:9e:08:b5:af:01\n$ etcdctl delete etcdhcp::ips::free::10.6.9.2\n```\n\nWarning: the leased keys have ttls set when a lease is issued, so you should set\nthis up in a cron or something.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flclarkmichalek%2Fetcdhcp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flclarkmichalek%2Fetcdhcp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flclarkmichalek%2Fetcdhcp/lists"}