On moving DHCP from an endagered host

July 2007


iwi202 Was the DHCP server and it also checked mail for viruses and spam. Now it is becoming old: it has one bad sector already. The machine is out of service and I have a week left before my vacation: no time to buy new hardware or do serious migration of users. I'm moving mailchecking and DHCPto iwi2.

Procedure 52.  Things to do on the new server

  1. Bring the machine up to date: apt-get update && apt-get dist-upgrade

  2. Configure the IP number statically. Modify /etc/network/interfaces to contain a stanza:

    #iface eth0 inet dhcp
    iface eth0 inet static
    address nnn.nnn.nnn.nnn
    netmask 255.255.255.0   
    	

  3. Make sure it finds the nameserver when the NIC comes up. It seems this thing runs BIND already, it is its own nameserver:

    search mydomain.com
    nameserver 127.0.0.1
    	

  4. install the DHCP daemon: apt-get install dhcp3-server

  5. Enable the DHCP server by editing /etc/default/dhcp3-server:

    INTERFACES="eth0"
    	

  6. Set aside the original dhcpd config: cd /etc/dhcp3 && mv dhcpd.conf dhcpd.conf.dist

  7. Copy the DHCP config from the old system, iwi202:


      
    cd /etc/dhcp3 && \
    scp root@iwi202:/etc/dhcp3/dhcpd.conf ./ && \
    scp -r root@iwi202:/etc/dhcp3/IWI-NET ./
      

  8. Start the DHCP server: /etc/init.d/dhcp3-server restart

  9. Copy /usr/local/bin/dhcprestart from another host for convenience.

  10. Put the DHCP daemon in the startup scripts: update-rc.d dhcp3-server defaults

  11. And start the DHCP daemon: /etc/init.d/dhcp3-server restart

Procedure 53.  Things to do on the old server

  1. Remove the DHCP server from the startup scripts: update-rc.d -f dhcp3-server remove

  2. And stop the DHCP daemon: /etc/init.d/dhcp3-server stop