-
Notifications
You must be signed in to change notification settings - Fork 0
DNSmasq
TODO on this page: Run through the testing. Add better explinations for options
When there are many nodes in the cluster, installing, and managing the network infrastructure is way too much overhead for anyone to manage. Installing DNSmasq works really well for managing a TFTP boot process for automatic installations and also takes care of managing the details of IPs and name resolutions. It is very convienent, simple, and I have found that it scales well at least up to over 400 compute nodes.
sudo yum install dnsmasq syslinux-tftpboot
The DNSMasq configuration file is usually stored in /etc/dnsmasq.conf. It is worth the read as it is documented rather well. Once you know what options you need you can trim the file down. This is the configuration file that this guide recommends.
$ sudo vi /etc/dnsmasq.conf
domain-needed
bogus-priv
local=/localnet/
local=/cluster.domain/
interface=eth1
except-interface=eth0
listen-address=10.10.10.10
bind-interfaces
domain=cluster.domain
dhcp-range=10.10.10.50,10.10.10.70,12h
dhcp-host=00:01:02:03:04:AA,node01.cluster.domain,10.10.10.101
dhcp-host=00:01:02:03:04:AB,node02.cluster.domain,10.10.10.102
dhcp-host=00:01:02:03:04:AC,node03.cluster.domain,10.10.10.103
dhcp-host=00:01:02:03:04:AD,node04.cluster.domain,10.10.10.104
pxe-prompt="Press F8 for menu.", 10
pxe-service=x86PC, "Boot from local disk", 0
pxe-service=x86PC, "Install compute node", pxelinux
enable-tftp
tftp-root=/tftpboot
cname=puppet,frontend01
$ sudo mkdir -p /tftpboot/pxelinux.cfg
$ sudo mkdir -p /tftpboot/boot/sl/64/x86_64
or $ sudo mkdir -p /tftpboot/boot/sl/64/i386
Now to pull the needed files for pxebooting. These files can also be found on the installation disk, but I find it easier to pull from the repository. If you have a local repository, please use it instead.
$ sudo wget http://ftp1.scientificlinux.org/linux/scientific/6.4/x86_64/os/isolinux/vmlinuz -O /tftpboot/boot/sl/64/x86_64/vmlinuz
$ sudo wget http://ftp1.scientificlinux.org/linux/scientific/6.4/x86_64/os/isolinux/initrd.img -O /tftpboot/boot/sl/64/x86_64/initrd.img
or
$ sudo wget http://ftp1.scientificlinux.org/linux/scientific/6.4/i386/os/isolinux/vmlinuz -O /tftpboot/boot/sl/64/i386/vmlinuz
$ sudo wget http://ftp1.scientificlinux.org/linux/scientific/6.4/i386/os/isolinux/initrd.img -O /tftpboot/boot/sl/64/i386/initrd.img
Create TFTP menu. Take note of the URL and match it with your own environment. We will create the cfg files shortly.
$ sudo vim /tftpboot/pxelinux.cfg/default
UI vesamenu.c32
TIMEOUT 100
LABEL sl64_node_64
MENU DEFAULT
MENU LABEL ^1) Install 64bit compute node with SL 6.4
KERNEL boot/sl/64/x86_64/vmlinuz
APPEND initrd=boot/sl/64/x86_64/initrd.img ks=http://http.cluster.domain/ks/sl64_node.cfg
LABEL sl64_node_32
MENU LABEL ^2) Install 32bit compute node with SL 6.4
KERNEL boot/sl/64/i386/vmlinuz
APPEND initrd=boot/sl/64/i386/initrd.img ks=http://http.cluster.domain/ks/sl64_node.cfg
LABEL localboot
MENU LABEL ^3) Boot from local disk
localboot
Add the port to the site.pp config file within the frontend node rules:
$ sudo vim /etc/puppet/manifests/site.pp
__# Open the TCP port for the DNS server
__firewall { '53 DNS TCP':
______port => 53,
______proto => tcp,
______action => accept,
__}
__# Open the UDP port for the DNS server
__firewall { '53 DNS UDP':
______port => 53,
______proto => udp,
______action => accept,
__}
__# Open the ports for the DHCP and TFTP server
__firewall { '67 and 68 and 69 DHCP and TFTP server UDP':
______port => ['67','68','69',],
______proto => udp,
______action => accept,
__}
Open the TFTP/DHCP/DNS port in the firewall
$ system-config-firewall-tui
- Select Customize
- DNS and TFTP
- Select Close to go back to the main menu
- Select OK to finish
- Select Yes to reload the tables.
Depending on which version of Linux you use, TFTP files are either placed in /tftpboot or /var/lib/tftp. Red Hat packages syslinux (and other related TFTP packages) to use /tftpboot but the Red Hat provided SELinux rules use /var/lib/tftp. This can be incredibly frustrating at times. To fix this, add the following rules to SELinux and force a relable.
$ sudo semanage fcontext -a -t tftpdir_rw_t "/tftpboot"
$ sudo semanage fcontext -a -t tftpdir_rw_t "/tftpboot(/.*)?"
$ sudo restorecon -RFvv /tftpboot
$ sudo service dnsmasq start
$ sudo chkconfig dnsmasq on