Dhcpd on eth1

From DaqWiki
Jump to navigation Jump to search
  • Install dhcp on the machine if not yet done: yum -y install dhcp
  • Edit the dhcpd.conf (/etc or /etc/dhcp/) to include your LAN hosts
# /etc/dhcpd.conf
allow booting;
allow bootp;
ignore unknown-clients;
ddns-update-style ad-hoc;

# set lease time to 3 days
default-lease-time 259200;
max-lease-time 259200;

# Define the new subnet
subnet netmask {
    interface eth1;
    not authoritative;
    deny unknown-clients;

# Define a group for your new LAN hosts
group {
	default-lease-time infinite;
	max-lease-time infinite;
	host host1 { fixed-address host1; hardware ethernet xx:xx:xx:xx:xx:xx; }
	host host2 { fixed-address host2; hardware ethernet xx:xx:xx:xx:xx:xx; }
	host host3 { fixed-address host3; hardware ethernet xx:xx:xx:xx:xx:xx; }
	host host4 { fixed-address host4; hardware ethernet xx:xx:xx:xx:xx:xx; }
#end file
  • Edit the hosts (/etc/) file to assign name to your list of LAN hosts   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6  host1  host2  host3  host4
  • Edit the ifcfg-eth1 (/etc/sysconf/network-scripts/) to define the IP for this ETH port
# No Network Manager
  • Restart the network
el6: service network restart
el7: no action
  • Include the dhcpd in your runlevel
el6: chkconfig --level 56 dhcpd on
el6: chkconfig --list | grep dhcpd
el7: systemctl enable dhcpd
  • Start dhcpd
el6: service dhcpd start
el7: systemctl restart dhcpd; systemctl status dhcpd
  • Check the log message for any errors
tail -100 /var/log/messages
  • Should be able to ping the LAN hosts