-- MikeGore - 2015-08-27

DNSMASQ"> Cluster DNSMASQ

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

Makefile

  • 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

install_dnsmasq

  • 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

dnsmasq.common.himrod

  • 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
                           iface=em3
                           subnet=192.168.1
                           1,c8:1f:66:dd:f0:cc,himrod
                           10,c8:1f:66:df:69:7c,himrod-storage
                           11,c8:1f:66:dd:d8:ee,himrod-big-1
                           12,c8:1f:66:dd:db:3b,himrod-big-2
                           13,c8:1f:66:dd:d7:62,himrod-big-3
                           14,c8:1f:66:dd:f1:44,himrod-big-4
                           101,c8:1f:66:dd:da:1a,himrod-1
                           ...
                           <verbatim>
                           * Example DNS query after dnsmasq is running: 
                              * *host himrod*
                                 * *himrod.localnet has address 192.168.1.1*
                              * *host himrod.cs*
                                 * *himrod.cs has address 129.97.152.5*
            
            
            
            ---++++ 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 192.168.1.0 .. 192.168.1.255
               *  *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=192.168.2.101,00:25:90:29:eb:ec,m160-1-local-comm,1440m
               *     ptr-record=101.2.168.192.in-addr.arpa.,"m160-1-local-comm"
               *     address=/m160-1-local-comm/192.168.2.101
               *     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>
            <nop>
            
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-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback