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 192.168.11.0 netmask 255.255.255.0 {
    interface eth1;
    range  192.168.11.100 192.168.11.254; 
    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
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.11.101  host1
192.168.11.102  host2
192.168.11.103  host3
192.168.11.104  host4
  • Edit the ifcfg-eth1 (/etc/sysconf/network-scripts/) to define the IP for this ETH port
DEVICE="eth1"
BOOTPROTO="none"
IPADDR="192.168.11.1"
NETMASK="255.255.255.0"
# No Network Manager
NM_CONTROLLED="no"
ONBOOT="yes"
TYPE="Ethernet"
  • 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