Posts tagged ‘dhcpd’

Fairly straight forward

yum install dhcp
chkconfig dhcpd on
Create /etc/dhcpd.conf from samples
/etc/rc.d/init.d/dhcpd on
/sbin/iptables -A INPUT -i eth0 -p tcp --dport 53 -j ACCEPT
/sbin/iptables -A INPUT -i eth0 -p udp --dport 53 -j ACCEPT

The example below allocates in the range 192.168.0.129 – 192.168.0.254

open up the ports on your machine (careful to only open it up on the internal side if the machine is dual facing).
You could use system-config-securitylevel and add port 53 for TCP and UDP. If you are having problems getting an IP address, check that it’s eth0 (and not say eth1), and if that fails, briefly turn off the firewall while testing.

/etc/dhcpd.conf: you’ll need to edit this to put in the address of your gateway (router), and the ip addresses of your dns servers, and add in any fixed ip address computers at the bottom.

ddns-update-style none;
ddns-updates off;
option T150 code 150 = string;
deny client-updates;
one-lease-per-client false;
allow bootp;
#
# DHCP Server Configuration file.
#   see /usr/share/doc/dhcp*/dhcpd.conf.sample
#

ddns-update-style interim;
ignore client-updates;

subnet 192.168.0.0 netmask 255.255.255.0 {

# — default gateway
option routers 192.168.0.1;
option subnet-mask 255.255.255.0;

option nis-domain “mydomain.example.com”;
option domain-name “mydomain.example.com”;

#enter IP addresses of your dns servers (from /etc/resolv.conf)
option domain-name-servers changeme.dns.server.ip, xx.yy,zz.aa;

#option time-offset -18000; # Eastern Standard Time
# option ntp-servers 192.168.1.1;
# option netbios-name-servers 192.168.1.1;
# — Selects point-to-point node (default is hybrid). Don’t change this unless
# — you understand Netbios very well
# option netbios-node-type 2;

range dynamic-bootp 192.168.0.129 192.168.0.254;
default-lease-time 21600;
max-lease-time 43200;

host MYMACHINE {
fixed-address 192.168.0.66;
hardware ethernet 00:26:44:72:e9:15;
}
}