All Projects → lclarkmichalek → Etcdhcp

lclarkmichalek / Etcdhcp

Licence: gpl-3.0
A DHCP server backed by etcd

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Etcdhcp

kstone
Kstone is an etcd management platform, providing cluster management, monitoring, backup, inspection, data migration, visual viewing of etcd data, and intelligent diagnosis.
Stars: ✭ 592 (+136.8%)
Mutual labels:  etcd, cloudnative
Gosiris
An actor framework for Go
Stars: ✭ 222 (-11.2%)
Mutual labels:  etcd
Swarmstack
A Docker swarm-based starting point for operating highly-available containerized applications.
Stars: ✭ 181 (-27.6%)
Mutual labels:  etcd
Netboot.xyz
Your favorite operating systems in one place. A network-based bootable operating system installer based on iPXE.
Stars: ✭ 2,753 (+1001.2%)
Mutual labels:  dhcp
Kruise
Automate application management on Kubernetes (project under CNCF)
Stars: ✭ 2,819 (+1027.6%)
Mutual labels:  cloudnative
Dbtester
Distributed database benchmark tester
Stars: ✭ 214 (-14.4%)
Mutual labels:  etcd
Cobbler
Cobbler is a versatile Linux deployment server
Stars: ✭ 2,222 (+788.8%)
Mutual labels:  dhcp
Mgmt
Next generation distributed, event-driven, parallel config management!
Stars: ✭ 2,708 (+983.2%)
Mutual labels:  etcd
Constructr
Coordinated (etcd, ...) cluster construction for dynamic (cloud, containers) environments
Stars: ✭ 219 (-12.4%)
Mutual labels:  etcd
Source Code Reading Notes
源码阅读笔记
Stars: ✭ 207 (-17.2%)
Mutual labels:  etcd
Aws Workshop For Kubernetes
AWS Workshop for Kubernetes
Stars: ✭ 2,450 (+880%)
Mutual labels:  cloudnative
Kubefate
Manage federated learning workload using cloud native technologies.
Stars: ✭ 195 (-22%)
Mutual labels:  cloudnative
Kics
Find security vulnerabilities, compliance issues, and infrastructure misconfigurations early in the development cycle of your infrastructure-as-code with KICS by Checkmarx.
Stars: ✭ 189 (-24.4%)
Mutual labels:  cloudnative
Go Flagz
Dynamic flag management for Go.
Stars: ✭ 191 (-23.6%)
Mutual labels:  etcd
Go Fastdfs
go-fastdfs 是一个简单的分布式文件系统(私有云存储),具有无中心、高性能,高可靠,免维护等优点,支持断点续传,分块上传,小文件合并,自动同步,自动修复。Go-fastdfs is a simple distributed file system (private cloud storage), with no center, high performance, high reliability, maintenance free and other advantages, support breakpoint continuation, block upload, small file merge, automatic synchronization, automatic r…
Stars: ✭ 2,923 (+1069.2%)
Mutual labels:  cloudnative
Netdot
Network Documentation Tool
Stars: ✭ 180 (-28%)
Mutual labels:  dhcp
Remco
remco is a lightweight configuration management tool
Stars: ✭ 200 (-20%)
Mutual labels:  etcd
Node Dhcp
A DHCP server and client written in pure JavaScript
Stars: ✭ 212 (-15.2%)
Mutual labels:  dhcp
Fluent Bit
Fast and Lightweight Logs and Metrics processor for Linux, BSD, OSX and Windows
Stars: ✭ 3,223 (+1189.2%)
Mutual labels:  cloudnative
Forest
分布式任务调度平台,分布式,任务调度,schedule,scheduler
Stars: ✭ 231 (-7.6%)
Mutual labels:  etcd

etcDHCP

Ever wondered what was going on with your DHCP leases? Not comfortable looking at /var/lib/dhcp/dhcp.leases? Feel like your DHCP should be a bit higher availablilty, and a little bit more stateless? Prefer GRPC to ARP? Want to make your DHCP server a legitimate microservice? Is dhcpd not cloud native enough for you?

If any of that applies to you, I may have the DHCP server of your dreams, right here. etcDHCP is the worlds first strongly consistent distributed DHCP server (in the absence of any other google results), using CoreOS's etcd to ensure that whatever happens, your leases will remain available. Well, at least, in 49% of cases. Assuming all cases have an independent effect on your etcd nodes.

Install

If you've never built a Go project before, I'm sorry.

$ go get -u github.com/golang/dep/cmd/dep
$ go get github.com/lclarkmichalek/etcdhcp
$ cd $GOPATH/src/github.com/lclarkmichalek/etcdhcp
$ dep ensure
$ go install

Setup

etcd

etcDHCP requires etcd, surprisingly enough. Notably, it requires at least version 3.3.0. However, this version doesn't actually exist yet, so just run master.

etcDHCP

Because running --help is hard, I guess.

$ etcdhcp \
  -etcd.discovery.endpoints localhost:2379 \
  -v=2 \
  -dhcp.router 10.6.9.1 \
  -dhcp.dns 10.6.9.1 \
  -dhcp.server-if wlan0_ap \
  -dhcp.server-ip 10.6.9.1 \
  -dhcp.subnet-mask 255.255.255.0 \
  -dhcp.issue-from 10.6.9.10 \
  -dhcp.issue-to 10.6.9.100 \
I0717 17:39:22.076564   25273 main.go:51] starting dhcp listener
I0717 17:39:22.076564   25273 main.go:45] starting admin server on :9842

There are tons of etcd options, most of which will probably be useless, as if you're not yet running a DHCP server, there's a decent chance that SRV record resolution won't be working. Notably missing is discovery via MAC address. Now that'd be fun..

The DHCP options should be, um, well, let's hope you've configured a DHCP server before. Plenty of things aren't supported, but you can certainly get a lot of stuff working by writing to etcd directly.

Operating concerns

Like all good cloud native software, etcDHCP exports Prometheus metrics on :9842. There's also pprof endpoints exposed. I didn't implement a readiness or liveness endpoint, as um, well they'd be a bit pointless. Also no graceful shutdowns because github.com/krolaw/dhcp4 doesn't support context yet.

etcd structure

$ ./etcdctl get etcdhcp::ips::leased::10.6.9.99
etcdhcp::ips::leased::10.6.9.99
5c:96:56:a4:be:eb
$ ./etcdctl get etcdhcp::ips:🆓:10.6.9.94
etcdhcp::ips:🆓:10.6.9.94
10.6.9.94
$ ./etcdctl get etcdhcp::nics::leased::08:9e:08:b5:af:01
etcdhcp::nics::leased::08:9e:08:b5:af:01
10.6.9.97

Want to add more IPs? Either restart the dhcp server with a different range, or..

$ for i in `seq 200 220`; do ./etcdctl put etcdhcp::ips:🆓:10.6.9.$i 10.6.9.$i; done

Warning: IPs that aren't in the range of a running server will gradually be phased out. They'll be removed when they are picked up by a client, and that client allows the lease to expire.

Want to react to a device connecting? Watch the nic entry for the device's MAC address:

$ etcdctl watch etcdhcp::nics::leased::08:9e:08:b5:af:01

Beware that renewals will cause updates to the nic key (updating/changing the lease to one with a more recent expiry). make sure to watch for creation/deletion events only.

Want to give a specific device a specific ip? Just associate the two, and any DHCP discovery request will pick up the existing association.

$ etcdctl put etcdhcp::nics::leased::08:9e:08:b5:af:01 10.6.9.2
$ etcdctl put etcdhcp::ips::leased::10.6.9.2 08:9e:08:b5:af:01
$ etcdctl delete etcdhcp::ips:🆓:10.6.9.2

Warning: the leased keys have ttls set when a lease is issued, so you should set this up in a cron or something.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].