Per te realizuar kete ushtrim:
Dynamic Host Configuration Protocol (DHCP) is a network protocol that automatically assigns TCP/IP information to client machines. Each DHCP client connects to the centrally located DHCP server, which returns the network configuration (including the IP address, gateway, and DNS servers) of that client.
DHCP is useful for automatic configuration of client network interfaces. When configuring the client system, you can choose DHCP instead of specifying an IP address, netmask, gateway, or DNS servers. The client retrieves this information from the DHCP server. DHCP is also useful if you want to change the IP addresses of a large number of systems. Instead of reconfiguring all the systems, you can just edit one configuration file on the server for the new set of IP addresses. If the DNS servers for an organization changes, the changes happen on the DHCP server, not on the DHCP clients. When you restart the network or reboot the clients, the changes go into effect.
If an organization has a functional DHCP server correctly connected to a network, laptops and other mobile computer users can move these devices from office to office.
The dhcp package contains an Internet Systems Consortium (ISC) DHCP server.
First, install the package as the superuser:
Installing the dhcp package creates a file, /etc/dhcp/dhcpd.conf, which is merely an empty configuration file:
The first step in configuring a DHCP server is to create the configuration file that stores the network information for the clients. Use this file to declare options and global options for client systems.
Note:The example below provides a dhcp.conf configuration file
This configuration file defines a subnet and declares options for the dhcp configurations.
It defines a parameter called range which defines the range of available IP addresses ( 192.168.1.10-192.168.1.100)
The routers, subnet-mask, domain-search, domain-name-servers, and time-offset options are used for any host statements declared below it.For :
there must be one subnet declaration, which tells the DHCP daemon how to recognize that an address is on that subnet.
A subnet declaration is required for each subnet even if no addresses will be dynamically allocated to that subnet.
In this example, there are global options for every DHCP client in the subnet and a range declared.
Clients are assigned an IP address within the range.
To configure a DHCP server that leases a dynamic IP address to a system within a subnet, modify the example below with your values.
It declares a default lease time, maximum lease time, and network configuration values for the clients.
This example assigns IP addresses in the range 192.168.1.10 and 192.168.1.100 to client systems.
To assign an IP address to a client based on the MAC address of the network interface card, use the hardware ethernet parameter within a host declaration.
As demonstrated in the example below , the host apex declaration specifies that the network interface card with the MAC address 00:A0:78:8E:9E:AA
always receives the IP address 192.168.1.4.
Note that you can also use the optional parameter host-name to assign a host name to the client.
All subnets that share the same physical network should be declared within a shared-network declaration as shown in the example below.
Parameters within the shared-network, but outside the enclosed subnet declarations, are considered to be global parameters.
The name of the shared-network must be a descriptive title for the network, such as using the title 'test-lab' to describe all the subnets in a test lab environment.
For example, shared networks, subnets, and hosts can be grouped.
You can use the provided sample configuration file as a starting point and add custom configuration options to it.
To copy this file to the proper location, use the following command:
where <version_number> is the DHCP version number.
or use the nano editor.
On the DHCP server, the file
Do not change this file.
DHCP lease information for each recently assigned IP address is automatically stored in the lease database.
The information includes:
All times in the lease database are in Coordinated Universal Time (UTC), not local time.
The lease database is recreated from time to time so that it is not too large.
First, all known leases are saved in a temporary lease database.
The DHCP daemon could be killed or the system could crash after the lease database has been renamed to the backup file but before the new file has been written.
If this happens, the
Do not create a new lease file. If you do, all old leases are lost which causes many problems.
The correct solution is to rename the dhcpd.leases~ backup file to dhcpd.leases and then start the daemon.
To start the DHCP service, use the command
To stop the DHCP server, use the command
By default, the DHCP service does not start at boot time.
A a default the DHCP Server listens on all attached interfaces.
If more than one network interface is attached to the system, but the DHCP server should only be started on one of the interfaces,
you can configure the DHCP server to start only on that device.
This is useful for a firewall machine with two network cards.
One network card can be configured as a DHCP client to retrieve an IP address to the Internet.
The other network card can be used as a DHCP server for the internal network behind the firewall.
Specifying only the network card connected to the internal network makes the system more secure because users can not connect to the daemon via the Internet.
Other command line options that can be specified in
The DHCP Relay Agent (dhcrelay) allows for the relay of DHCP and BOOTP requests from a subnet with no DHCP server on it to one or more DHCP servers on other subnets.
When a DHCP client requests information, the DHCP Relay Agent forwards the request to the list of DHCP servers specified when the DHCP Relay Agent is started.
When a DHCP server returns a reply, the reply is broadcast or unicast on the network that sent the original request.
The DHCP Relay Agent listens for DHCP requests on all interfaces unless the interfaces are specified in /etc/sysconfig/dhcrelay with the INTERFACES directive.
To start the DHCP Relay Agent, use the command service dhcrelay start.
Understanding relay agents
A relay agent is a small program that relays DHCP/BOOTP messages between clients and servers on different subnets.
DHCP/BOOTP relay agents are part of the DHCP and BOOTP standards and function according to the Request for Comments (RFCs),
standard documents that describe protocol design and related behavior.
How relay agents work
A relay agent relays DHCP/BOOTP messages that are broadcast on one of its connected physical interfaces, such as a network adapter, to other remote subnets to which it is connected by other physical interfaces. The following illustration shows how client C on Subnet 2 obtains a DHCP address lease from DHCP server 1 on Subnet
and the configuration file for each network device in the
In this directory, each device should have a configuration file named
Make sure that the
To use DHCP, set a configuration file for each device.
Other options for the network script include:
DHCP_HOSTNAME — Only use this option if the DHCP server requires the client to specify a hostname before receiving an IP address.
PEERDNS=<answer>, where <answer> is one of the following:
yes — Modify /etc/resolv.conf with information from the server. If using DHCP, then yes is the default.
no — Do not modify /etc/resolv.conf.
Personeli akademik > Prof. Asoc. Dr. Endri Xhina > Lendet > 2015-2016 > Teknologjite Wireless ( Linux Admin) >