Вы находитесь на странице: 1из 3

Docs DHCP and PXE server

DHCP and PXE server


The Dynamic Host Conguration Protocol (DHCP) [1] server centralizes the management of the
local network conguration for any device connected to it. When a computer (or a device such as
a printer, smartphone, etc.) connects to the local network, it can ask the network conguration
parameters by means of the DHCP protocol. The DHCP server replies, providing the IP, DNS, and
other relevant network parameters.
Note
In most cases, the devices are already congured to use DHCP protocol on start up.

The Preboot eXecution Environment (PXE) [3] specication allows a network device to retrieve
the operating system from a centralized network location while starting up, through the DHCP
and TFTP protocols. See Boot from network conguration for an example about conguring a
such case.

DHCP conguration
The DHCP server can be enabled on all green and blue interfaces (see Network). NethServer will
assign a free IP address within the congured DHCP range in DHCP > DHCP server page.
The DHCP range must be dened within the network of the associated interface. For instance, if
the green interface has IP/netmask 192.168.1.1/255.255.255.0 the range must be
192.168.1.2192.168.1.254

Host IP reservation
The DHCP server leases an IP address to a device for a limited period of time. If a device requires
to always have the same IP address, it can be granted an IP reservation associated to its MAC
address.
The page DHCP > IP reservation lists the currently assigned IP addresses:
a line with IP reservation button identies an host with a temporary lease (gray color);
a line with Edit button identies an host with a reserved IP (black color). A small two arrows

icon near the host name says the DHCP lease is expired: this is a normal condition for hosts
with static IP conguration, as they never contact the DHCP server.

Boot from network conguration


To allow clients to boot from network, the following components are required:
the DHCP server, as we have seen in the previous sections,
the TFTP server [2],
the software for the client, served through TFTP.
TFTP is a very simple le transfer protocol and usually it is used for automated transfer of
conguration and boot les.
In NethServer the TFTP implementation comes with the DHCP module and is enabled by default.
To allow accessing a le through TFTP, simply put it in /var/lib/tftpboot directory.
Note
To disable TFTP type the following commands in a roots console:

configsetpropdhcptftpstatusdisabled
signaleventnethserverdnsmasqsave

For instance, we now congure a client to boot CentOS from the network. In NethServer, type at
roots console:

yuminstallsyslinux
cp/usr/share/syslinux/{pxelinux.0,menu.c32,memdisk,mboot.c32,chain.c32}/var/lib/tftpboot/
configsetpropdnsmasqdhcpbootpxelinux.0
signaleventnethserverdnsmasqsave
mkdir/var/lib/tftpboot/pxelinux.cfg

Then create the le

/var/lib/tftpboot/pxelinux.cfg/default

with the following content:

defaultmenu.c32
prompt0
timeout300
MENUTITLEPXEMenu
LABELCentOS
kernelCentOS/vmlinuz
appendinitrd=CentOS/initrd.img

Create a CentOS directory:

mkdir/var/lib/tftpboot/CentOS

Copy inside the directory


the ISO image, in

vmlinuz

/images/pxeboot

and

initrd.img

les. These les are public, and can be found in

directory or downloaded from a CentOS mirror.

Finally, power on the client host, selecting PXE boot (or boot from network) from the start up
screen.
References
[1]

Dynamic Host Conguration Protocol (DHCP)


http://en.wikipedia.org/wiki/Dynamic_Host_Conguration_Protocol

[2]

Trivial File Transfer Protocol https://en.wikipedia.org/wiki/Tftp

[3]

Preboot eXecution Environment http://en.wikipedia.org/wiki/Preboot_Execution_Environment

Вам также может понравиться