Install DHCP on CentOs 7 / RHEL 7
DHCP Stands for Dynamic Host Configurations Protocol that is used to dynamically assign IP Addresses to Clients, on every device attached on network requires an IP Address to communicate with other devices.
If you notice when you connect to a network and you get an IP address automatically that is given by DHCP Server.
Step – 1
Open the terminal window and install DHCP package using yum command.
yum install dhcp -y
Step - 2
Edit the configuration file.
vi /etc/etc/dhcp/dhcpd.conf
Copy and paste below code into '/etc/dhcp/dhcpd.conf' file, and change according to your desired settings.
# DHCP Server Configuration file. # see /usr/share/doc/dhcp*/dhcpd.conf.example # see dhcpd.conf(5) man page # # Option definitions common to all supported networks # Specify domain name option domain-name “hackthesec.co.in”; # Specify name server’s hostname or IP address option domain-name-servers 192.168.1.1; # Default lease time default-lease-time 600; # Max lease time max-lease-time 7200; # This DHCP server Authoritative server in the Network. authoritative; subnet 192.168.1.0 netmask 255.255.255.0 {# Specify the range of lease IP address range dynamic-bootp 192.168.1.11 192.168.1.100; # Specify broadcast address option broadcast-address 192.168.1.255; # Specify default gateway option routers 192.168.1.1; }
Now Save and Exit the file.
:wq
Step - 3
Now its time to Enable and start the DHCP Service.
systemctl enable dhcpd
systemctl start dhcpd
If you didn’t miss anything clients machines on your network now able to get automatic ip addresses from your DHCP server.
So, setup your client machine on "Obtain an IP Address Automatically" it should get an automatic ip addresses from the specified range in the DHCP server.
0 comments:
Post a Comment