-- MikeGore - 2015-08-27


  • Setup dnsmasq - provides DHCP, DNS ad, TFTPBOOT services for the cluster


  • make is the only file run by and admin to update himrods dnsmasq settings
  • compiles mkhosts.c
  • runs install_dnsmasq
  • Note: make can be run at ANY time to make sure all files are up to date


  • Only called from make ( ie. Makefile ) to install and configure dnsmasq using files defined in the following sections
  • Stops nscd and dnsmasq
  • updates /etc/resolv.conf using resolv.template files
  • updates /etc/dnsmasq.hosts usings hsosts.template
  • creates /etc/hosts , /etc/resolv.conf and /etc/dnsmasq.hosts
    • Updates /etc/dnsmasq.conf to include /etc/dnsmasq.hosts
  • creates /etc/Networkmanager/dispatcher.d/00-dnsmaq trigger script to rewrite /etc/resolve.conf in case Network Manager is installed
    • This prevents other programs from messing up /etc/resolv.conf
  • starts nscd and dnsmasq

DNSMASQ Config files


  • himrod specific configuration for dnsmasq
  • Put all IP,MAC address and interface information for the cluster here * DNSMASQ
      • /cscf-adm/src/dnsmasq contains all configuration files used for
      • * Depends on /etc/network/interfaces to have all interfaces defined statically
        • DHCP and DNS
        • /cscf-adm/src/dnsmasq/dnsmasq.common.himrod
          • The scripts assume dnsmasq.common. so replace himrod with your server
          • Defines all nodes and interfaces with simplified IP and MAC address notation
          • provides DNS and reverse DNS for all local networks
          • Example:
                           # Private Network
                           * Example DNS query after dnsmasq is running: 
                              * *host himrod*
                                 * *himrod.localnet has address*
                              * *host himrod.cs*
                                 * *himrod.cs has address*
            ---++++ dnsmasq.common
               * just a symlink to *dnsmasq.common.himrod* created by make install process
            ---+++ DNSMASQ Template Files
               *  * These files are preprocessed and added to the top of the automatically generated */etc/dnsmasq.hosts* file
                  * *dnsmasq/dnsmasq.template.private*
                     * default DNSMASQ settings for ONE private network
                  * *dnsmasq/dnsmasq.template.private_two*
                     * default DNSMASQ settings for TWO private networks
                  * *dnsmasq/dnsmasq.template.private_three*
                     * default DNSMASQ settings for THREE private networks
                  * *dnsmasq/hosts.template* 
                     * defines fixed records we always want in the */etc/hosts* file
                  * *dnsmasq/resolv.template*
                     * defines fixed record we want added to the top of the */etc/resolv.conf* file
                     * Default external DNS servers - should be moved into [[https://cs.uwaterloo.ca/twiki/pub/CF/HimrodTools/common_host][common_host]]
            ---+++ DNSMASQ Compiled files
               * To recreate these files:
                  * *cd /cscf-adm/src/dnsmasq*
                  * *make*
            ---++++ /etc/hosts
               * Create from *mkhosts* and *install_dnsmasq* using *dnsmasq.common.himrod* and *hosts.template*
            ---++++ /etc/resolv.conf
               * Create from *mkhosts* and *install_dnsmasq* using *resolv.template*
            ---++++ /etc/dnsmasq.hosts
               * Create from *mkhosts* and *install_dnsmasq* using dnsmasq template files
            ---+++ dnsmasq.compiled.himrod
               * The top level include for dnsmasq created by the make install process
               * includes preporocessed *dnsmasq.template* files
               * includes *dnsmasq.common*
            ---+++ DNSMASQ mkhosts and mkhosts.c
               * preprocessor program that reads *dnsmasq.common.himrod*
                  * *dnsmasq.compiled.himrod* and *hosts.template*
                  * Writes */etc/dnsmasq.hosts* - a file included from the otherwise totally blank */etc/dnsmasq.conf* file
                  * Write */etc/hosts*
                  * Creates DHCP entries, *DNS* records - both forward and reverse lookups for local networks
            ---++++ mkhosts Ducumenation
               * What: mkhosts.c a preprocessor for dnsmasq configuration files
               *  The preprocessor handles creating reverse dns records and settings from
               *  a simpilfied syntax
               *  Syntax:
               *  *ttl=* time 
               *     *time* is a ttl as per the *dnsmasq* man pages
               *     Example: *ttl=1440m* - set the default ttl to 1440 minutes until the next ttl keyword
               *  * *subnet=* *subnet* specify the subnet
               *     *subnet* is a subnet specification - *LIMITATIONS* mkhosts uses hard coded /24 network - first 24 bits
               *     Example: *subnet=192.168.1* - this defines the subnet the same as ..
               *  *ip*,*mac*,*cname* [,*cname*]...
               *     *ip* is the last digit of the subnet only
               *     *mac* is the MAC address of the interface you want to assign the address to
               *     *cname* a common separated list of cnames
               *  Example: 101,00:25:90:29:eb:ec,m160-1-local-comm,m160-1
               *     * Creates  
               *     <verbatim>
               *     dhcp-host=,00:25:90:29:eb:ec,m160-1-local-comm,1440m
               *     ptr-record=,"m160-1-local-comm"
               *     address=/m160-1-local-comm/
               *     cname=m160-1,m160-1-local-comm
               *     </verbatim>
               *  *prefix=* We can redefine dhcp name prefix for reverse lookups
               *  *iface=* just puts a comment in the output file
               *  *tag=* defind tags to be appened to dhcp-host
               *  *pxelinux=* Define the pxelinux subnet - hosts under this section can get a private boot file
               *     Each mac address will simlink to the file pxelinux.cfg/nodes
               *  *include=* process an include file
               *  Example:
               *   ttl=1440m
               *   subnet=192.168.2
               *   1,00:25:90:0e:5b:a2,m160-local-comm,m160-comm,m160
               *   101,00:25:90:29:eb:ec,m160-1-local-comm,m160-1
               *   ...</verbatim>
Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r2 - 2015-08-27 - MikeGore
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2023 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback