DHCP API
List reservation
/v1/?action=list-ips
Example
[
{
host: "DISP001",
ip: "08:00:27:8B:80:A3",
mac: "192.168.1.10",
comment: "alice",
sector: "primary",
type: "static"
}
];
Command
$ cat /etc/dhcp/dhcpd.conf
$ cat /var/lib/dhcp/dhcpd.leases
Add reservation
/v1/?action=add-ip&comment=:comment&mac=:mac&host=:host&ip=:ip§or=:sector
Params
Name | Type | Description |
---|---|---|
:host | String | Hostname |
:mac | String | MAC Address |
:ip | String | IP Address |
:sector | String | Sector |
:comment | String | Comment |
Example
{
"status":"host added successfully"
}
Command
# echo "host DISP001 {hardware ethernet 08:00:27:8B:80:A3; fixed-address 192.168.1.10;} # alice (primary)" | sudo tee --append /etc/dhcp/dhcpd.conf
# service isc-dhcp-server restart
$ cat /etc/dhcp/dhcpd.conf
Remove reservation
/v1/?action=rm-ip&ip=:ip
Params
Name | Type | Description |
---|---|---|
:ip | String | IP Address |
Example
{
"status":"host removed successfully"
}
Command
# sed '/192.168.1.10/d' /etc/dhcp/dhcpd.conf
# service isc-dhcp-server restart
$ cat /etc/dhcp/dhcpd.conf