Configure a Basic DNS Server on SmartOS using Bind9
![]() |
Photo by Kelvin Ang on Unsplash |
SmartOS is a Unix operating system that is focusing on virtualization. It’s based on the Illumos kernel (i.e. Open Solaris) It consists of an immutable OS that can be loaded into the memory via a USB key. Administrators can leverage the Solaris technology such as ZFS, zone, DTrace and Crossbow. It can also create VMs using KVM and bhyve technologies.
I had a very hard time finding relevant information on configuring DNS servers on SmartOS. After a few hours of searching and head banging, I’ve successfully configured a basic DNS server using Bind9. Here are the Steps.
Installing Bind9
The installation process is very simple. SmartOS adopted NetBSD’s package manager. So the command is
pkgin install bind-9.16.7
This will pull the relevant packages and install bind.
Enable Bind9
svcadmin enable pkgsrc/bind
Create a Basic Configuration File
I use vim. You can use any editor of your choice to create the configuration file.
vim /opt/local/etc/named.conf
This is a very basic configuration for named.conf
options {
forwarders {
8.8.8.8;
8.8.4.4;
};
};
zone "example.com" {
type master;
file "/opt/local/etc/namedb/dynamic/db.example.com";
};
Create the zone file
$TTL 604800
@ IN SOA ns1.example.com. admin.example.com. (
2018101901; Serial
3H; Refresh
15M; Retry
2W; Expiry
1D ); Minimum
; name servers - NS records
IN NS ns1.example.com.
; name servers - A records
ns1.homelab.vm. IN A 192.168.1.100
Edit the configuration file path in svcadmin.
This is a very important step. Yet I only found it in an old Solaris book “Open Solaris Bible”.
svccfg -s pkgsrc/bind:default
svc:/pkgsrc/bind:default> setprop options/configuration_file=/opt/local/etc/named.conf
svc:/pkgsrc/bind:default> exit
svcadm refresh pkgsrc/bind
svcadm restart pkgsrc/bind
Test Your Setting
Use dig to test your setting. Log onto the DNS server and run
dig @127.0.0.1 ns1.example.com
Comments
Post a Comment