How To Configure DHCP Server On CentOS
How To Configure DHCP Server On CentOS
How To Configure DHCP Server On CentOS
DHCP ( Dynamic Host Configuration Protocol ) is a network protocol used for assigning IP address to network
clients dynamically from predefined IP pool. It is useful for LAN network, but not generally used for
production servers. This article will help you for Configuring DHCP Server on CentOS, Red Hat System. Read
more about dhcp here.
# cp /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample /etc/dhcp/dhcpd.conf
default-lease-time 600;
max-lease-time 7200;
authoritative;
log-facility local7;
}
3.3 -Assign Static IP Address to Host
In some cases we need to assign a fixed ip to an interface each time it requested from dhcp. We can also assign
a fixed ip on basis of MAC address (hardware ethernet) of that interface. Setup host-name is optional to set up.
host station1 {
fixed-address 192.168.1.100;
For CentOS/RHEL 7
For CentOS/RHEL 7
# vim /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
BOOTPROTO=dhcp
TYPE=Ethernet
ONBOOT=yes
For CentOS/RHEL 7
Network Scenario:
DNS Server IP: 192.168.1.254
DNS Server Name: ns1.tecadmin.net, ns2.tecadmin.net
Domain Name: demotecadmin.net
Domain IP to point: 192.168.1.100
# vim /var/named/chroot/etc/named.conf
// /var/named/chroot/etc/named.conf
options {
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
recursion yes;
dnssec-enable yes;
dnssec-validation yes;
dnssec-lookaside auto;
bindkeys-file "/etc/named.iscdlv.key";
managed-keys-directory "/var/named/dynamic";
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
zone "." IN {
type hint;
file "named.ca";
};
zone "demotecadmin.net" IN {
type master;
file "/var/named/demotecadmin.net.db";
};
include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";
# vim /var/named/chroot/var/named/demotecadmin.net.db
$TTL 14400
demotecadmin.net. IN A 192.168.1.100
demotecadmin.net. IN MX 0 mail.demotecadmin.net.
If you are having more domain, its required to create zone files for each domain individually.
type master;
file "/var/named/demotecadmin.net.db";
};
# chkconfig named on
Server: 192.168.1.254
Address: 192.168.1.254#53
Name: demotecadmin.net
Address: 192.168.1.100
Above output is showing that dns server has successfully resolved domain demotecadmin.net.