DHCP server: Difference between revisions

From CLONWiki
Jump to navigation Jump to search
Boiarino (talk | contribs)
No edit summary
Boiarino (talk | contribs)
 
(71 intermediate revisions by the same user not shown)
Line 1: Line 1:
'''Setting DHCP server on clon10new (RHEL7)'''
== Configure DHCP server on RHEL9 ==


  yum install dhcp tftp tftp-server
  yum install dhcp-server


mkdir /tftpboot
In this example, server on subnet 167 (129.57.167.139), and client on subnet 86.


grub2-mknetdir --net-directory=/tftpboot/efi
Config file /etc/dhcp/dhcpd.conf should looks like this (replace 129.57.167.139 with the server address):


#
# DHCP Server Configuration file.
#  see /usr/share/doc/dhcp-server/dhcpd.conf.example
#  see dhcpd.conf(5) man page
#
option domain-name "jlab.org";
option domain-name-servers 129.57.90.255, 129.57.32.101;
default-lease-time 600;
max-lease-time 7200;
# subnet 167
subnet 129.57.167.0 netmask 255.255.255.0 {
      option routers 129.57.167.99;
      deny unknown-clients;
}
# subnet 86
subnet 129.57.86.0 netmask 255.255.255.0 {
      option broadcast-address 129.57.86.255;
      option subnet-mask 255.255.255.0;
      option routers 129.57.86.1;
      deny unknown-clients;
      allow declines;
}
# important settings to recognize PXE boot from UEFI boot controllers
set vendorclass = option vendor-class-identifier;
option pxe-system-type code 93 = unsigned integer 16;
set pxetype = option pxe-system-type;
# DISKLESS Clients in here
group
{
    if substring(vendorclass, 0, 9)="PXEClient" {
        if pxetype=00:06 or pxetype=00:07 {
            filename  "efi/boot/grub2/x86_64-efi/core.efi";
        } else {
            filename "linux-install/pxelinux.0";
        }
    }
    next-server 129.57.167.4;
    host test333 {
        hardware ethernet 00:20:38:04:3a:8a;
        fixed-address 129.57.86.7;
    }
   
    host test444 {
        hardware ethernet 00:20:38:10:15:03;
        fixed-address 129.57.86.5;
    }
} # Diskless clients group
Enable and start service:
systemctl enable dhcpd
systemctl start dhcpd
Check service status, fix errors if any:


systemctl status dhcpd


== Configure local DHCP server on RHEL7 ==


Create file ''/tftpboot/efi/boot/grub2/grub.cfg'' with following contents:
yum install dhcp


  function load_video {
Config file ''/etc/dhcp/dhcpd.conf'' should looks like this:
  insmod efi_gop
#
  insmod efi_uga
  # DHCP Server Configuration file.
  insmod video_bochs
  #  see /usr/share/doc/dhcp*/dhcpd.conf.example
  insmod video_cirrus
  #  see dhcpd.conf(5) man page
  insmod all_video
  #
   
  subnet 192.168.10.0 netmask 255.255.255.0 {
        option domain-name "clontest.com jlab.org";
        option domain-name-servers 192.168.10.1;
        option routers 192.168.10.1;
        use-host-decl-names true;
pool {
    range 192.168.10.2 192.168.10.20;
    deny dynamic bootp clients;
    allow unknown clients;
    }
  }
  }
set vendorclass = option vendor-class-identifier;
option pxe-system-type code 93 = unsigned integer 16;
set pxetype = option pxe-system-type;
# DISKLESS Clients in here
group
{
if substring(vendorclass, 0, 9)="PXEClient" {
  if pxetype=00:06 or pxetype=00:07 {
      filename  "efi/boot/grub2/x86_64-efi/core.efi";
  } else {
      filename "linux-install/pxelinux.0";
  }
}
  next-server 192.168.10.1;
host test5 {
hardware ethernet 00:20:38:10:14:f7;
fixed-address 192.168.10.5;
}
host test6 {
hardware ethernet 00:20:38:0A:07:D7;
fixed-address 192.168.10.6;
}
host test7 {
hardware ethernet 00:20:38:0F:2C:0D;
fixed-address 192.168.10.7;
}
} # Diskless clients group
Enable and start service:
systemctl enable dhcpd
systemctl start dhcpd


load_video
Check service status, fix errors if any:
set gfxpayload=keep
  systemctl status dhcpd
insmod gzio
set timeout=2
menuentry 'Diskless CentOS7 x86_64, any network device'  --class redhat --class gnu-linux --class gnu --class os {
linuxefi linux-install/CentOS7-x86_64-Diskless/vmlinuz-3.10.0-1062.9.1.el7.x86_64 zram=1 ip=::::::dhcp root=nfs:129.57.29.103:/daqfs/diskless/CentOS7-devel/x86_64/root-jvme ro vga=0x305 module_blacklist=ipmi_si,ipmi_msghandler,ipmi_devintf,w83977f_wdt
initrdefi linux-install/CentOS7-x86_64-Diskless/initramfs-jvme-3.10.0-1062.9.1.el7.x86_64.img
  }

Latest revision as of 09:36, 9 September 2025

Configure DHCP server on RHEL9

yum install dhcp-server

In this example, server on subnet 167 (129.57.167.139), and client on subnet 86.

Config file /etc/dhcp/dhcpd.conf should looks like this (replace 129.57.167.139 with the server address):

#
# DHCP Server Configuration file.
#   see /usr/share/doc/dhcp-server/dhcpd.conf.example
#   see dhcpd.conf(5) man page
#

option domain-name "jlab.org";
option domain-name-servers 129.57.90.255, 129.57.32.101;
default-lease-time 600;
max-lease-time 7200;

# subnet 167
subnet 129.57.167.0 netmask 255.255.255.0 {
      option routers 129.57.167.99;
      deny unknown-clients;
}

# subnet 86
subnet 129.57.86.0 netmask 255.255.255.0 {
      option broadcast-address 129.57.86.255;
      option subnet-mask 255.255.255.0;
      option routers 129.57.86.1;
      deny unknown-clients;
      allow declines;
}

# important settings to recognize PXE boot from UEFI boot controllers
set vendorclass = option vendor-class-identifier;
option pxe-system-type code 93 = unsigned integer 16;
set pxetype = option pxe-system-type;

# DISKLESS Clients in here
group
{
    if substring(vendorclass, 0, 9)="PXEClient" {
        if pxetype=00:06 or pxetype=00:07 {
            filename   "efi/boot/grub2/x86_64-efi/core.efi";
        } else {
            filename "linux-install/pxelinux.0";
        }
    }

    next-server 129.57.167.4;

    host test333 {
        hardware ethernet 00:20:38:04:3a:8a;
        fixed-address 129.57.86.7;
    }
    
    host test444 {
        hardware ethernet 00:20:38:10:15:03;
        fixed-address 129.57.86.5;
    }

} # Diskless clients group


Enable and start service:

systemctl enable dhcpd
systemctl start dhcpd

Check service status, fix errors if any:

systemctl status dhcpd

Configure local DHCP server on RHEL7

yum install dhcp

Config file /etc/dhcp/dhcpd.conf should looks like this:

#
# DHCP Server Configuration file.
#   see /usr/share/doc/dhcp*/dhcpd.conf.example
#   see dhcpd.conf(5) man page
#

subnet 192.168.10.0 netmask 255.255.255.0 {
        option domain-name "clontest.com jlab.org";
        option domain-name-servers 192.168.10.1;
        option routers 192.168.10.1;
        use-host-decl-names true;
	pool {
	     range 192.168.10.2 192.168.10.20;
	     deny dynamic bootp clients;
	     allow unknown clients;
	     }
}

set vendorclass = option vendor-class-identifier;
option pxe-system-type code 93 = unsigned integer 16;
set pxetype = option pxe-system-type;

# DISKLESS Clients in here
group
{
	if substring(vendorclass, 0, 9)="PXEClient" {
	   if pxetype=00:06 or pxetype=00:07 {
	      filename   "efi/boot/grub2/x86_64-efi/core.efi";
	   } else {
	      filename "linux-install/pxelinux.0";
	   }
	}
  	next-server 192.168.10.1;

	host test5 {
	 hardware ethernet 00:20:38:10:14:f7;
	 fixed-address 192.168.10.5;
	}

	host test6 {
	 hardware ethernet 00:20:38:0A:07:D7;
	 fixed-address 192.168.10.6;
	}

	host test7 {
	 hardware ethernet 00:20:38:0F:2C:0D;
	 fixed-address 192.168.10.7;
	}

} # Diskless clients group

Enable and start service:

systemctl enable dhcpd
systemctl start dhcpd

Check service status, fix errors if any:

systemctl status dhcpd