Skip to content

Advanced DHCP server

Notifications You must be signed in to change notification settings

sadeemio/shabik

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shabik

Advanced DHCP server that provides public and private IP leases for VMs created by Sadeem.io, by connecting to Sadeem.io rabbitmq to fetch VM leases, store them on a key/vlue store DB (boltdb), and serve the leases to the VMs upon request. Updates on the leases happen in real time without the need to restart shabik service to reload the new leases, it will server the new leases directly once they are consumed from sadeem.io rabbitmq.

In case the lease Gateway is not on the same subnet, Shabik will push a classless route with the lease which will be operated by dhclient on the VM, to configure the Gateway.

TODO

1- Implement release IP call 2- Update Leases in DB bucket instead of destroying bucket on each new pull 3- Track leases to prevent, assign IP to more than one mac at same time

Known BUGS and Fixes

There are some known bugs not related to the DHCP server itself, but to the way Bridged interfaces work, or the dhclient itself. Those are the known bugs so far and the fixes:

Dhclinet report error "5 bad UDP checksums in 5 packets"

this error is irrelevant, it pops up because of an old issue related to Linux transmit (Tx) checksum offload handling for virtual devices

Solution :

1- Install ethtool on each hypervisor during the installation time

2- Add this line to /etc/network/interfaces after each bridge configuration

up /sbin/ethtool -K $BRDG tx off # <== TURN OFF TX CHECKSUM OFFLOAD

replace $BRDG with bridge name (cloud-privat or cloud-public)

Another solution is to use iptables to fill the checksum for the udp packets using the following rule:

iptables -A POSTROUTING -t mangle -p udp --dport bootpc -j CHECKSUM --checksum-fill

Dhclient report error "shift: can't shift that many"

this error occurs when we send a rfc3442-classless-static-routes option with the lease for IPs with GW out of its netmask reach, the issue is a bug in the implementation of parsing rfc3442-classless-static-routes on dhclient

Solution :

Apply the follwoing PATCH to the file /etc/dhcp/dhclient-exit-hooks.d/rfc3442-classless-routes on each VM template

Accepted json format

{
  "leases": [
    {
      "ip": "192.168.124.23",
      "mac": "52:54:77:4e:00:02",
      "hostname": "travirs",
      "gateway": "192.168.124.254",
      "netmask": "255.255.255.0"
    },
    {
      "ip": "10.11.10.1",
      "mac": "21:64:77:5e:11:02",
      "hostname": "manog",
      "gateway": "10.0.0.22",
      "netmask": "255.255.255.0"
    },
    {
      "ip": "10.11.10.22",
      "mac": "23:64:77:5e:11:02",
      "hostname": "duplicated",
      "gateway": "10.0.0.22",
      "netmask": "255.255.255.0"
    }
  ]
}

Releases

No releases published

Packages

No packages published