DragonFly On-Line Manual Pages
omcmd(1) omcmd(1)
NAME
omcmd - Update ISC dhcpd dynamically with OMAPI
SYNOPSIS
omcmd [-k <keyname> <secret> | -K <keyfile> ] [-p port] [-s server]
[-v] <command> <objtype> <args>
DESCRIPTION
omcmd is a scriptable CLI program for performing actions on a running
ISC dhcp server using OMAPI. It can currently be used to create,
remove, modify and look up hosts and leases. Note that host and lease
objects have persistent storage in the leases file.
The keyname and secret are the same as the values in the dhcpd.conf
file; the secret should be base64 encoded. If using a 'keyfile',
line1=keyname, line2=secret.
The -v option affects the lookup|find command, see below.
Commands
In the command descriptions below, 'indexproperty' is used to indicate
a property that specifies the object uniquely to the dhcp server.
I.e., ip-address uniquely specifies a lease object.
lookup|find <objecttype> <indexproperty=value> [property ...]
Look up a lease or host. For leases, specify the ip-address or
hardware-address. For hosts, specify the name or hardware-
address. If property names are specified after the lookup
property, only those property values will be returned, one per
line. if -v is given, they will be returned in property=value
format.
create|add|new <objecttype> <property=value> ...
Create a new object, usually a 'host'. For hosts, specify name,
hardware-address, hardware-type (usually 1 for ethernet), and
optionally ip-address.
remove|delete <objecttype> <indexproperty=value>
Delete an object, usually a host. For hosts, you must specify
name or hardware-address. At the time this was written, you
cannot delete a lease; you can, however, modify the lease and
change it's 'state' to 'free', but this requires a patched
version of dhcp (as of dhcp-3.0.1, see the README included with
the source). See modify, below.
modify|change|update <objecttype> <indexproperty=value>
<property=value> ...
Change an object. Mostly used to change the 'state' of a
'lease'.
Object Types
Currently omcmd only has support for host and lease object types.
Properties
The following properties are known to omcmd:
state - the lease state
ip-address
dhcp-client-identifier
client-hostname
hardware-address
hardware-type - normally 1 for ethernet
ends
tstp
tsfp
cltt
name - unique name for host object
statements
known
Note: check the dhcp man pages listed in SEE ALSO, below, for more
information on the properties and object types.
RETURN VALUE
On success, omcmd returns 0. For an OMAPI error, it returns the
isc_result_t value. (See include/isc-dhcp/result.h). Command syntax
errors return -1.
EXAMPLES
Lookup a lease and print everything:
$ ./omcmd -K ~/keyfile -s myserver lookup lease ip-address=10.20.93.155
state=active
ip-address=10.20.93.155
dhcp-client-identifier=01:00:e0:b8:72:8f:90
client-hostname=AU1201
hardware-address=00:e0:b8:72:8f:90
hardware-type=1
ends=Sat Jul 31 15:54:28 2004
tstp=Wed Dec 31 19:00:00 1969
tsfp=Wed Dec 31 19:00:00 1969
cltt=Wed Dec 31 19:00:00 1969
Lookup a lease and just give the hardware-address:
$ ./omcmd -K ~/keyfile -s myserver lookup lease ip-address=10.20.93.155
hardware-address
00:e0:b8:72:8f:90
Change a lease state to free:
$ ./omcmd -K ~/keyfile -s myserver modify lease ip-address=10.20.162.42
state=free
Create a new host:
$ ./omcmd -K ~/keyfile -s myserver create host ip-address=10.20.162.242
name=ioreth hardware-type=1 hardware-address=00:e0:b8:50:0f:ab
Note: ip-address is optional.
Delete that host:
$ ./omcmd -K ~/keyfile -s myserver remove host name=ioreth
SEE ALSO
dhcpd(8), omshell(1)
BUGS
Report all bugs (and send all patches) to parsley@linuxjedi.org.
AUTHOR
omcmd was written by David L. Parsley (parsley@linuxjedi.org) for use
with a custom 'netreg' system.
Free Software 2005 Oct 10 omcmd(1)