DNSMasq as a DHCP Relay Target

DNS Masq is a great little DNS and DHCP combo server built into most DDWRT images, and available in most Linux distributions.

With it you can define custom DNS A records:

address=/owncloud/owncloud.somedomain.org/192.168.10.12
address=/unifi/unifi.somedomain.org/192.168.10.12

You can also define multiple DHCP scopes. This comes in handy if you want to configure the DNSMasq server as the DHCP Helper (or DHCP Relay) on your switch:

dhcp-range=devices,192.168.10.100,192.168.10.200,255.255.255.0,1m
dhcp-range=guest,192.168.20.100,192.168.20.200,255.255.255.0,1m

If you specify multiple ranges, you’ll also need to configure the default gateway for each of these networks:

dhcp-option=devices,3,192.168.10.1
dhcp-option=guest,3,192.168.20.1

You can also create DHCP reservations for specific hosts by MAC address:

dhcp-host=00:1e:c9:4a:d7:fe,owncloud,192.168.10.12,1h
dhcp-host=04:18:d6:52:77:88,AP,192.168.1.4,1h
dhcp-host=70:77:81:B6:03:71,Printer,192.168.20.58,5m

Resources:

Schema Validation Errors While Setting an XML Node Value

When attempting to set the node value in an InfoPath form with code, “schema validation” errors may appear.   This is primarily caused by attempting to set the value of a field with one of the following data types:

  • Whole Number (integer)
  • Decimal (double)
  • Date (date)
  • Time (time)
  • Date and Time (dateTime)

The workaround is to remove the “nil” attribute from the element:

public void DeleteNil(XPathNavigator node)
{
if (node.MoveToAttribute(“nil”, “http://www.w3.org/2001/XMLSchema-instance”))
      node.DeleteSelf();
}

Additional Resources:

Managing ZFS Snapshots

ZFS is a great file system, providing much flexibility, and simple administration.   It was originally developed for Sun operating systems, but has been ported to Linux, and support is now baked in to Ubuntu Server 15.10.

ZFS natively supports snapshots, but there is a tool for automagically creating, and aging snapshots: https://github.com/zfsnap/zfsnap.  (Man page: http://www.zfsnap.org/zfsnap_manpage.html)

Installation is fairly straight forward:

  • clone the Git repo
  • copy the files to /usr/local/src
  • create a link to the binaries path:
    ln -s /usr/local/src/zfsnap/sbin/zfsnap.sh /usr/local/sbin/zfsnap

After that, set up a crontab for automatic snapshot creation:

crontab -e
26 * * * * /usr/local/sbin/zfsnap snapshot -a 5d -r tank

And finally, set up crontab for automatic snapshot deletion:

 0  1 * * * /usr/local/sbin/zfsnap destroy -r tank 

Let’s Encrypt Setup

The “Let’s Encrypt” setup process is very painless – Just clone a Git repo, run a comand, and edit some apache config files.

  1. sudo apt-get install git
  2.  sudo git clone https://github.com/letsencrypt/letsencrypt /opt/letsencrypt
  3. cd /opt/letsencrypt
  4. ./letsencrypt-auto –apache -d ccrossan.com -d www.ccrossan.com
  5. edit the sites-enabled config files so that the appropriate virtual host uses the correct ssl certs.
  6. delete the newly generated ssl.conf file
  7. restart apache
  8. [Optional] Set up Cron for auto-renew
  9. sudo crontab -e
  10. 30 2 * * 1 /opt/letsencrypt/letsencrypt-auto renew >> /var/log/le-renew.log

 

These commands taken from the DigitalOcean Let’s Encrypt Setup Guide