SLAC CPE Software Engineering Group
Stanford Linear Accelerator Center
System Admin

MCC DHCP Configuration

SLAC Detailed
SLAC Computing
Software Home
Software Detailed
 

 

 

Programmers' Guides, Users' Guides

Modified: 17-Jun-2014


DHCP Configuration

DHCP, Dynamic Host Configuration Protocal, implemented via dhcpd, automatically assigns IP and other network configuration information (subnet mask, broadcast address) to computers on a network. IP addresses are either dynamically assigned from a range, or statically assigned by MAC address. A DHCP client will send out a broadcast request to the DHCP server requesting an address. The DHCP server will then issue a "lease" and assign it to that client. DHCP, a superset of BOOTP, provides service to both DHCP cleint and BOOTP cleints. DHCP reduces the ammount of time required to configure clients and allows one to move a computer to various networks and be configured with the appropriate IP address, gateway and subnet mask

 

How to update DHCP service

  1. On mccsrv01, update /etc/dhcpd.conf
  2. Set up monitoring
    1. login mccsyslog
    2. tail –f /var/log/messages | grep mccsrv
  3. Verify dhcpd config file
    1. On mccsrv01: service dhcpd configtest
      1. service dhcpd configtest
        Syntax: OK
  4. On mccsrv01:  service dhcpd restart
  5. test:
    1. unplug sunray (on Ken's desk) and plug back in. -Monitor syslog
    2. On MCCSYSLOG: tail –f /var/log/messages | grep mccsrv
  6. Copy dhcpd.conf to mccsrv02 and restart dhcp on mccsrv02
    1. scp /etc/dhcpd.conf mccsrv02:/etc/
    2. ssh mccsrv02 service dhcpd restart
      1. Check syslog for errors

 


 

DHCP Installation


yum install dhcp

[root@lcls-srv20 ~]# rpm -qa | grep dhcp
dhcp-3.0.1-65.el4_8.1

DHCP daemon Setup

/sbin/chkconfig --list dhcpd
dhcpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off

/sbin/chkconfig dhcpd on

DHCP restart

service dhcpd restart

 

DHCP Server Configuration

dhcpd, DHCP daemon, is configured in /etc/dhcpd.conf.  A leases file is kept in /var/lib/dhcp/dhcpd.leases. 

[root@mccsrv01 ~]# cat /etc/dhcpd.conf

#Required for dhcp 3.0+ / RHEL4 +. Otherwise, dhcpd wont start.

ddns-update-style interim;    
#
shared-network "MCC-CTRLS_VLAN"
{
subnet 172.19.52.0 netmask 255.255.252.0
{

# default DNS to be used by DHCP clients

option domain-name-servers mcc-pep.slac.stanford.edu, mccdev-pep.slac.stanford.edu;                                                             
option domain-name "slac.stanford.edu";

# default gateway to be used by DHCP clients

option routers 172.19.55.1;

# default subnet mask to be used by DHCP clients
option subnet-mask 255.255.252.0;

# default broadcast address to be used by DHCP clients
option broadcast-address 172.19.55.255;
}

}

... more exmaples with comments...

The configuration file is visible to the public via

http://www.slac.stanford.edu/grp/cd/soft/unix/DHCP.html

DHCP Client Configuration

.... make entry here...

DHCP Test

First, test configuration file for syntax errors with the following command:

service dhcpd configtest   -while monitoring /var/log/messages ( tail –f /var/log/messages ) for any error messages. It is important to test the configuration file if there is any change made, before restart dhcpd.

 

When dhcpd is running it will generate entries in the file: /var/lib/dhcp/dhcpd.leases

DHCP monitoring

login mccsyslog

tail –f /var/log/messages | grep mccsrv

 


 

Backup of dhcpd.conf

 

A cronjob runs every morning at 1:30AM and copies the dhcpd.conf file to dhcpd.conf-date

(ex: dhcpd.conf-Jun-17-14)

 

RHEL5: /etc/

RHEL6: /etc/dhcp/

Also copies a file to our NFS server: (for tape backup)

 

mccfs8:/u1/lcls/sys/dhcp/dhcpd.conf-$HOSTNAME-$TDATE

(ex: dhcpd.conf-mccsrv03-Jun-17-14)

/root/scripts/copy-dhcp

Crontab:

 

[root@mccsrv03 opt]# crontab -l
30 1 * * * /root/scripts/copy-dhcp 1> /tmp/copy-dhcp.log 2>&1

*Remember mccsrv01 and mccsrv02 each have a copy of dhcpd.conf

 

 

Ken's Original Note

Test config on mccsrv01

Test config on mccsrv01

  • Install DHCP RPM:
    • yum install dhcp
  • Turn on DHCP
    • chkconfig dhcpd on
  •  Create /etc/dhcpd.conf file
    • Put:  “ddns-update-style interim; “   at top of file –required
  • Started DHCP server
    • service dhcp start
    • monitor /var/log/messages ( tail –F /var/log/messages )

DHCP Management:

  1. Always make changes on mccsrv01 
  2. Always make a copy of DHCP file.  (Remember mccsrv02 also has a copy)
  3. Edit dhcpd.conf file
    1. Bring up mccsyslog ( tail -F /var/log/messages )
    2. Restart dhcpd services ( service dhcpd restart )
      1. Monitor on syslog
  4. If dhcpd.conf file is correct then copy to mccsrv02 ( scp /etc/dhcpd.conf root@mccsrv02:/etc/  )
  5. Restart dhcp on mccsrv02  (  ssh root@mccsrv02 service dhcpd restart  )
    1. Monitor on syslog
 



 

Programmers' Guides, Users' Guides, Requirements, Design, Papers, Administration, How-To, Hardware, IOC, Database

 

[SLAC CPE Software Engineering Group][ SLAC Home Page]

 


Created by: Ken Brobeck  14-May-2010