plan9fox/sys/man/8/dhcpd
cinap_lenrek e4f30c89f4 ip/tftpd: add -m argument for name substitution using regular expressions
This allows mapping incoming filenames to a different name
using regular expressions, followed by subtitutions
of the %[ICE] format strings.

I needed this to have individual cmdline.txt files for
netbooted raspberry pi's. In this example, i map cmdline.txt
to %C, which gets substituted for /cfg/pxe/$ether of the client.
2022-02-05 01:34:22 +00:00

356 lines
6.3 KiB
Plaintext

.TH DHCPD 8
.SH NAME
dhcpd, dhcp6d, dhcpleases, rarpd, tftpd \- Internet booting
.SH SYNOPSIS
.PP
.B ip/dhcpd
.RB [ -dmnprsSZ ]
.RB [ -h
.IR homedir ]
.RB [ -f
.IR ndbfile ]
.RB [ -M
.IR secs ]
.RB [ -x
.IR netmtpt ]
.RB [ -Z
.IR secs ]
[
.I address
.I n
] ...
.PP
.B ip/dhcpleases
.PP
.B ip/dhcp6d
.RB [ -d ]
.RB [ -f
.IR ndbfile ]
.RB [ -x
.IR netmtpt ]
.PP
.B ip/rarpd
.RB [ -d ]
.RB [ -e
.IR etherdev ]
.RB [ -x
.IR netmtpt ]
.PP
.B ip/tftpd
.RB [ -dr ]
.RB [ -h
.IR homedir ]
.RB [ -x
.IR netmtpt ]
.RB [ -n
.IR nsfile ]
.RB [ -m
.IR mapfile ]
.SH DESCRIPTION
These programs support booting over the Internet.
They should all be run on the same server to
allow other systems to be booted.
.IR Dhcpd ,
.I dhcp6d
and
.I tftpd
are used to boot everything;
.I rarpd
is an extra piece just for Suns.
.PP
.I Dhcpd
runs the
.SM BOOTP
and
.SM DHCP
protocols.
Clients use these protocols to obtain configuration information.
This information comes from attribute/value pairs in the network database
(see
.IR ndb (6)
and
.IR ndb (8)).
DHCP requests are honored both for static addresses found in
the NDB and for dynamic addresses listed in the command line.
DHCP requests are honored if either:
.br
\- there exists an NDB entry
containing both the ethernet address of the requester and
an IP address on the originating network or subnetwork.
.br
\- a free dynamic address exists on the originating network or subnetwork.
.PP
A BOOTP request is honored if all of the following are true:
.br
\- there exists an NDB entry
containing both the ethernet address of the requester and
an IP address on the originating network or subnetwork.
.br
\- the entry contains a
.B bootf=
attribute
.br
\- the file in the
.B bootf=
attribute is readable.
.PP
Dynamic addresses are specified on the command line as a list
of addresses and number pairs.
For example,
.EX
ip/dhcpd 10.1.1.12 10 10.2.1.70 12
.EE
directs
.I dhcpd
to return dynamic addresses 10.1.1.12 through 10.1.1.21 inclusive
and 10.2.1.70 through 10.2.1.81 inclusive.
.PP
.I Dhcpd
maintains a record of all dynamic addresses in the directory
.BR /lib/ndb/dhcp ,
one file per address.
If multiple servers have access to this common directory,
they will correctly coordinate their actions.
.PP
Attributes come from either the NDB entry for the system, the entry for its
subnet, or the entry for its network. The system entry has precedence,
then the subnet, then the network.
The NDB attributes used are:
.TF rootserver
.TP
.B ip
the IP address
.TP
.B ipmask
the IP mask
.TP
.B ipgw
the default IP gateway
.TP
.B dom
the domain name of the system
.TP
.B fs
the default Plan 9 file server
.TP
.B auth
the default Plan 9 authentication server
.TP
.B dns
a domain name server
.TP
.B ntp
a network time protocol server
.TP
.B time
a time server
.TP
.B wins
a
.SM NETBIOS
name server
.TP
.B www
a World Wide Web proxy
.TP
.B pop3
a POP3 mail server
.TP
.B smtp
an SMTP mail server
.TP
.B bootf
the default boot file;
see
.IR ndb (6)
.TP
.B tftp
the TFTP server to fetch
.I bootf
from
.TP
.B rootpath
the NFS root for unix machines
.TP
.B rootserver
the NFS server used with
.I rootpath
.TP
.B vendor
Specific vendor attribute for dhcp and bootp
.PD
.PP
.I Dhcpd
will answer
.SM BOOTP
requests only if it has been specifically targeted or if it
has read access to the boot file for the requester. That means that the requester
must specify a boot file in the request or one has to exist in NDB for
.I dhcpd
to answer.
.I Dhcpd
will answer all
.SM DHCP
requests for which it can associate an IP address with the
requester.
The options are:
.TP
.B d
Print debugging to standard output.
.TP
.B h
Change directory to
.IR homedir .
The default is
.BR / .
This should match the
.I homedir
setting of
.I tftpd
so that the existence check of non-rooted file names
is consistent.
.TP
.B f
Specify a file other than
.B /lib/ndb/local
as the network database.
.TP
.B m
Mute: don't reply to requests, just log them and what
.I dhcpd
would have done.
.TP
.B M
Use
.I secs
as the minimum lease time for dynamic addresses.
.TP
.B n
Don't answer
.SM BOOTP
requests.
.TP
.B p
Answer
.SM DHCP
requests from
.SM PPTP
clients only.
.TP
.B r
Mute static addresses: don't reply to requests for static addresses,
just log them and what
.I dhcpd
would have done.
.TP
.B s
Sleep 2 seconds before answering requests for static addresses.
This is used to make a server be a backup only.
.TP
.B S
Sleep 2 seconds before answering requests for dynamic addresses.
.TP
.B x
The IP stack to use is mounted at
.IR netmtpt .
The default is
.BR /net .
.TP
.B Z
Use
.I secs
as the minimum lease time for static addresses.
.PD
.PP
.I Dhcp6d
provides DHCPv6 service for IPv6 clients. Only network boot and
DNS parameters are supported.
.PP
.I Dhcpleases
prints out the currently valid DHCP leases found in the
.B /lib/ndb/dhcp
directory.
.PP
.I Rarpd
performs the Reverse Address Resolution Protocol, translating
Ethernet addresses into IP addresses.
The options are:
.TP
.B d
Print debugging to standard output.
.TP
.B e
Use the Ethernet mounted at
.BI /net/ etherdev\f1.
.TP
.B x
The IP stack to use is mounted at
.IR netmtpt .
The default is
.BR /net .
.PD
.PP
.I Tftpd
transfers files to systems that are booting.
It runs as user
.B none
and can only access files with global read permission.
The options are:
.TP
.B d
Print debugging to standard output.
.TP
.B x
The IP stack to use is mounted at
.IR netmtpt .
The default is
.BR /net .
.TP
.B h
Change directory to
.IR homedir .
The default is
.BR / .
All requests for files with non-rooted file names are served starting at this
directory. This needs to be consistent with the
.I homedir
setting of
.IR dhcpd .
.I Tftpd
supports only octet mode.
.TP
.B r
Restricts access to only those files rooted in the
.IR homedir .
.TP
.B n
Sets the namespace file (default /lib/namespace).
.TP
.B m
Loads name substitutions from
.IR mapfile .
The format is a space or tab separated two-column text
with the first column being a regular expression
(see
.IR regexp (6))
that is matched against the requested file name
and the second column contains a subsitution.
Lines starting with
.B #
are ignored.
Occurances in the resulting filename of
.BR %I ,
.B %C
or
.B %E
are replaced with the ip, cfgpxe name or ether MAC of
of the client.
.PD
.SH FILES
.BR /lib/ndb/dhcp " directory of dynamic address files
.SH SOURCE
.B /sys/src/cmd/ip
.SH "SEE ALSO"
.IR ndb (6),
.IR booting (8)