Difference between revisions of "Configuring basic DHCP server"
From Notes_Wiki
m |
m |
||
Line 34: | Line 34: | ||
<pre> | <pre> | ||
firewall-cmd --add-service=dhcp --permanent | firewall-cmd --add-service=dhcp --permanent | ||
firewall-cmd -- | firewall-cmd --reload | ||
</pre> | </pre> | ||
Add '--zone' appropriately if zones are used. | Add '--zone' appropriately if zones are used. |
Revision as of 14:11, 19 March 2021
<yambe:breadcrumb>Dhcp_server_configuration|Dhcp server configuration</yambe:breadcrumb>
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
<yambe:breadcrumb>Dhcp_server_configuration|Dhcp server configuration</yambe:breadcrumb>