How to Configure a DHCP Server in Linux: Step-by-Step Guide
DHCP SERVER:
Dynamic Host Configuration Protocol (DHCP) is a network protocol that enables a server to
automatically assign an IP address to a computer from a defined range of numbers (i.e., a
scope) configured for a given network.
DHCP allows a computer to join an IP-based network without having a pre-configured IP
address. DHCP is a protocol that assigns unique IP addresses to devices, then releases and
renews these addresses as devices leave and re-join the network.
Internet service providers usually use DHCP to help customers join their networks with
minimum setup effort required. Likewise, home network equipment like broadband
routers offers DHCP support for added convenience in joining home computers to local area networks (LANs).
How does DHCP works?
DHCP assigns an IP address when a system is started, for example:
1. A user turns on a computer with a DHCP client.
2. The client computer sends a broadcast request (called a DISCOVER or DHCPDISCOVER), looking for a DHCP server to answer.
3. The router directs the DISCOVER packet to the correct DHCP server.
4. The server receives the DISCOVER packet. Based on availability and usage policies set
on the server, the server determines an appropriate address (if any) to give to the
client. The server then temporarily reserves that address for the client and sends
back to the client an OFFER (or DHCPOFFER) packet, with that address information.
The server also configures the client's DNS servers, WINS servers, NTP servers, and
sometimes other services as well.
5. The client sends a REQUEST (or DHCPREQUEST) packet, letting the server know that it intends to use the address.
6. The server sends an ACK (or DHCPACK) packet, confirming that the client has a been given a lease on the address for a server-specified period of time.
When a computer uses a static IP address, it means that the computer is manually
configured to use a specific IP address. One problem with static assignment, which can
result from user error or inattention to detail, occurs when two computers are configured
with the same IP address. This creates a conflict that results in loss of service. Using DHCP to
dynamically assign IP addresses minimizes these conflicts.
Configuring a DHCP server:
Step1: Check whether the package is installed or not
#rpm -q dhcp
Step2: Install the package using yum
#yum install dhcp* -y
Step3: Copy the example file for dhcp configuration over dhcp configuration file,i.e., /etc/dhcp/dhcpd.conf
#cp -p /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample /etc/dhcp/dhcpd.conf
Step4: Open the configuration file and edit it as per the requirement.
#vim /etc/dhcp/dhcpd.conf
# A slightly different configuration for an internal subnet.
subnet 192.168.223.0 netmask 255.255.255.0 {
range 192.168.223.10 192.168.223.30;
option routers 192.168.223.1;
option broadcast-address 10.5.5.31;
default-lease-time 600;
max-lease-time 7200;
}
Subnet : The subnet of the network
Netmask : The netmask of the network
Range : The range of IP address to be assigned to the clients, in short “Scope”
Option routers : gateway address (optional)
Default-lease-time : The minimum lease time of the ip assigned to the clients
Max-lease-time : The maximum lease time of the IP assigned to the clients
Step5: Make sure the dhcp server contains same range static IP as follows
Step6: Start/Restart the dhcp services and make it permanent
#cd /etc/init.d/
#service dhcpd restart
(or)
#/etc/init.d/dhcpd restart
Step 7: Allow dhcp in firewall
#firewall-cmd --add-service=dhcp --permanent
#firewall-cmd --reload
sudo iptables -I INPUT -p tcp -m tcp --dport 67 -j ACCEPT
sudo iptables -I INPUT -p tcp -m tcp --dport 68 -j ACCEPT
#service iptables stop
Client side configuration for DHCP: (RHEL6 Client):
Step1: Make the dhcp option enabled in network configuration using #setup command.
Note :- Click space bar for * in DHCP
Step2: Restart the network services and check the IP address is in dhcp scope.
#service network restart
Step3: Check the IP address using #ifconfig command
#ifconfig eth0
RHEL7 as a client:
Step1: Make the dhcp option enabled in network configuration using nmcli command
#nmcli con mod ens#(connection name) ipv4.method auto (dhcp)
#nmcli con mod ens8 ipv4.method auto
Step2: activate the connection
#nmcli con up con-name
#nmcli con up ens8
Step3: Check the IP address using #ifconfig command
#ifconfig ens8
#DHCPMagic
#DynamicIP
#arn
#arntech
#arntraining
#arntrainings
#arntechtrainings
configure dhcp server in linux,linux dhcp configuration,dynamic host configuration protocol,dhcp client,dhcp server,how to install dhcp in linux,dhcp,configure your dhcp server in linux,dhcp client linux,dhcp in linux,install dhcp,linux dhcp,how to configure your dhcp server linux,linux,dhcp relay agent,dhcp server in redhat,dhcp snooping,configure dhcp server,mastering Linux DHCP: Simple installation & configuration,linux dhcp server
Видео How to Configure a DHCP Server in Linux: Step-by-Step Guide канала ARN Tech Trainings
Dynamic Host Configuration Protocol (DHCP) is a network protocol that enables a server to
automatically assign an IP address to a computer from a defined range of numbers (i.e., a
scope) configured for a given network.
DHCP allows a computer to join an IP-based network without having a pre-configured IP
address. DHCP is a protocol that assigns unique IP addresses to devices, then releases and
renews these addresses as devices leave and re-join the network.
Internet service providers usually use DHCP to help customers join their networks with
minimum setup effort required. Likewise, home network equipment like broadband
routers offers DHCP support for added convenience in joining home computers to local area networks (LANs).
How does DHCP works?
DHCP assigns an IP address when a system is started, for example:
1. A user turns on a computer with a DHCP client.
2. The client computer sends a broadcast request (called a DISCOVER or DHCPDISCOVER), looking for a DHCP server to answer.
3. The router directs the DISCOVER packet to the correct DHCP server.
4. The server receives the DISCOVER packet. Based on availability and usage policies set
on the server, the server determines an appropriate address (if any) to give to the
client. The server then temporarily reserves that address for the client and sends
back to the client an OFFER (or DHCPOFFER) packet, with that address information.
The server also configures the client's DNS servers, WINS servers, NTP servers, and
sometimes other services as well.
5. The client sends a REQUEST (or DHCPREQUEST) packet, letting the server know that it intends to use the address.
6. The server sends an ACK (or DHCPACK) packet, confirming that the client has a been given a lease on the address for a server-specified period of time.
When a computer uses a static IP address, it means that the computer is manually
configured to use a specific IP address. One problem with static assignment, which can
result from user error or inattention to detail, occurs when two computers are configured
with the same IP address. This creates a conflict that results in loss of service. Using DHCP to
dynamically assign IP addresses minimizes these conflicts.
Configuring a DHCP server:
Step1: Check whether the package is installed or not
#rpm -q dhcp
Step2: Install the package using yum
#yum install dhcp* -y
Step3: Copy the example file for dhcp configuration over dhcp configuration file,i.e., /etc/dhcp/dhcpd.conf
#cp -p /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample /etc/dhcp/dhcpd.conf
Step4: Open the configuration file and edit it as per the requirement.
#vim /etc/dhcp/dhcpd.conf
# A slightly different configuration for an internal subnet.
subnet 192.168.223.0 netmask 255.255.255.0 {
range 192.168.223.10 192.168.223.30;
option routers 192.168.223.1;
option broadcast-address 10.5.5.31;
default-lease-time 600;
max-lease-time 7200;
}
Subnet : The subnet of the network
Netmask : The netmask of the network
Range : The range of IP address to be assigned to the clients, in short “Scope”
Option routers : gateway address (optional)
Default-lease-time : The minimum lease time of the ip assigned to the clients
Max-lease-time : The maximum lease time of the IP assigned to the clients
Step5: Make sure the dhcp server contains same range static IP as follows
Step6: Start/Restart the dhcp services and make it permanent
#cd /etc/init.d/
#service dhcpd restart
(or)
#/etc/init.d/dhcpd restart
Step 7: Allow dhcp in firewall
#firewall-cmd --add-service=dhcp --permanent
#firewall-cmd --reload
sudo iptables -I INPUT -p tcp -m tcp --dport 67 -j ACCEPT
sudo iptables -I INPUT -p tcp -m tcp --dport 68 -j ACCEPT
#service iptables stop
Client side configuration for DHCP: (RHEL6 Client):
Step1: Make the dhcp option enabled in network configuration using #setup command.
Note :- Click space bar for * in DHCP
Step2: Restart the network services and check the IP address is in dhcp scope.
#service network restart
Step3: Check the IP address using #ifconfig command
#ifconfig eth0
RHEL7 as a client:
Step1: Make the dhcp option enabled in network configuration using nmcli command
#nmcli con mod ens#(connection name) ipv4.method auto (dhcp)
#nmcli con mod ens8 ipv4.method auto
Step2: activate the connection
#nmcli con up con-name
#nmcli con up ens8
Step3: Check the IP address using #ifconfig command
#ifconfig ens8
#DHCPMagic
#DynamicIP
#arn
#arntech
#arntraining
#arntrainings
#arntechtrainings
configure dhcp server in linux,linux dhcp configuration,dynamic host configuration protocol,dhcp client,dhcp server,how to install dhcp in linux,dhcp,configure your dhcp server in linux,dhcp client linux,dhcp in linux,install dhcp,linux dhcp,how to configure your dhcp server linux,linux,dhcp relay agent,dhcp server in redhat,dhcp snooping,configure dhcp server,mastering Linux DHCP: Simple installation & configuration,linux dhcp server
Видео How to Configure a DHCP Server in Linux: Step-by-Step Guide канала ARN Tech Trainings
configure dhcp server in linux linux dhcp configuration dynamic host configuration protocol dhcp client dhcp server how to install dhcp in linux dhcp configure your dhcp server in linux dhcp client linux dhcp in linux install dhcp linux dhcp how to configure your dhcp server linux linux dhcp relay agent dhcp server in redhat dhcp snooping configure dhcp server mastering Linux DHCP: Simple installation & configuration linux dhcp server
Комментарии отсутствуют
Информация о видео
12 февраля 2025 г. 17:30:29
00:47:34
Другие видео канала




















