Documentation ¶
Overview ¶
Package file enables static mapping of MAC <--> IP addresses. The mapping is stored in a text file, where each mapping is described by one line containing two fields separated by spaces: MAC address, and IP address. For example:
$ cat file_leases.txt 00:11:22:33:44:55 10.0.0.1 01:23:45:67:89:01 10.0.10.10
To specify the plugin configuration in the server6/server4 sections of the config file, just pass the leases file name as plugin argument, e.g.:
$ cat config.yml server6: ... plugins: - file: "file_leases.txt" [autorefresh] ...
If the file path is not absolute, it is relative to the cwd where coredhcp is run.
Optionally, when the 'autorefresh' argument is given, the plugin will try to refresh the lease mapping during runtime whenever the lease file is updated.
Index ¶
Constants ¶
This section is empty.
Variables ¶
DHCPv6Records and DHCPv4Records are mappings between MAC addresses in form of a string, to network configurations.
var Plugin = plugins.Plugin{
Name: "file",
Setup6: setup6,
Setup4: setup4,
}
Plugin wraps plugin registration information
var StaticRecords map[string]net.IP
StaticRecords holds a MAC -> IP address mapping
Functions ¶
func LoadDHCPv4Records ¶
LoadDHCPv4Records loads the DHCPv4Records global map with records stored on the specified file. The records have to be one per line, a mac address and an IPv4 address.
Types ¶
This section is empty.