Difference between revisions of "Configuring basic DHCP server"
From Notes_Wiki
(Created page with "<yambe:breadcrumb>Dhcp_server_configuration|Dhcp server configuration</yambe:breadcrumb> =Configuring basic DHCP server= To configure basic DHCP server install '<tt>dhcp</tt>...") |
m |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
[[Main Page|Home]] > [[CentOS]] > [[CentOS 6.x]] > [[Dhcp server configuration]] > [[Configuring basic DHCP server]] | |||
To configure basic DHCP server install '<tt>dhcp</tt>' package. Then edit '<tt>/etc/dhcp/dhcpd.conf</tt>' file so that it has contents similar to: | To configure basic DHCP server install '<tt>dhcp</tt>' package. Then edit '<tt>/etc/dhcp/dhcpd.conf</tt>' file so that it has contents similar to: | ||
Line 27: | Line 26: | ||
# After all changes to dhcpd.conf file, '<tt>service dhcpd restart</tt>' is required | # After all changes to dhcpd.conf file, '<tt>service dhcpd restart</tt>' is required | ||
# All dynamic IP addresses assigned by DHCP can be seen in '<tt>/var/lib/dhcpd/dhcpd.leases</tt>' file. If this file is edited manually then restart server again. Static addresses will not appear in leases file. Addresses bound using "host __ {hardware ethernet __; fixed-address __; }" also do not appear in dhcpd.leases file | # All dynamic IP addresses assigned by DHCP can be seen in '<tt>/var/lib/dhcpd/dhcpd.leases</tt>' file. If this file is edited manually then restart server again. Static addresses will not appear in leases file. Addresses bound using "host __ {hardware ethernet __; fixed-address __; }" also do not appear in dhcpd.leases file | ||
==DHCP server setup in CentOS 7.0== | |||
For CentOS 7.0 the above steps should work. Optionally firewalld can be configured using: | |||
<pre> | |||
firewall-cmd --add-service=dhcp --permanent | |||
firewall-cmd --reload | |||
</pre> | |||
Add '--zone' appropriately if zones are used. | |||
Refer http://www.server-world.info/en/note?os=CentOS_7&p=dhcp | |||
[[Main Page|Home]] > [[CentOS]] > [[CentOS 6.x]] > [[Dhcp server configuration]] > [[Configuring basic DHCP server]] |
Latest revision as of 11:08, 14 July 2022
Home > CentOS > CentOS 6.x > Dhcp server configuration > Configuring basic DHCP server
To configure basic DHCP server install 'dhcp' package. Then edit '/etc/dhcp/dhcpd.conf' file so that it has contents similar to:
subnet <network-1> netmask <netmask-1> { } subnet 192.168.100.0 netmask 255.255.255.0 { option domain-name "rekallsoftware.com"; option domain-name-servers 192.168.100.1; option routers 192.168.100.1; range 192.168.100.50 192.168.100.150; host hp_laserjet_m1536dnf_1 { hardware ethernet 2c:59:e5:d6:51:dd; fixed-address 192.168.100.4; } }
Please note following points:
- For every interface of router a corresponding subnet must be present in dhcpd.conf file for DHCP server to work
- Additional subnets can be defined which are useful if 'ip helper-address' type of configuration is done on L3 switch where VLAN is defined. This would allow forwarding DHCP requests for other VLAN to DHCP server even when DHCP server is not in same subnet.
- Defined subnets can be completely empty or could have configuration lines as shown in example above.
- Static IP address can be mapped to a particular MAC address in DHCP server. This setting can be done for each subnet separately if same host understandably needs different IP in each subnet.
- After all changes to dhcpd.conf file, 'service dhcpd restart' is required
- All dynamic IP addresses assigned by DHCP can be seen in '/var/lib/dhcpd/dhcpd.leases' file. If this file is edited manually then restart server again. Static addresses will not appear in leases file. Addresses bound using "host __ {hardware ethernet __; fixed-address __; }" also do not appear in dhcpd.leases file
DHCP server setup in CentOS 7.0
For CentOS 7.0 the above steps should work. Optionally firewalld can be configured using:
firewall-cmd --add-service=dhcp --permanent firewall-cmd --reload
Add '--zone' appropriately if zones are used.
Refer http://www.server-world.info/en/note?os=CentOS_7&p=dhcp
Home > CentOS > CentOS 6.x > Dhcp server configuration > Configuring basic DHCP server