02 February 2013

Intro SmartOS Setup pt 1

For a while now, I've wanted to check out Joyent's SmartOS but until
recently, simply didn't have the time. This series of posts details my
initial setup and testing of SmartOS. (To jump straight to SmartOS within
VirtualBox (VBox), see part 3.) For better or worse, I really enjoy
sandbox environments which usually have limited, if any, external access
allowing me greater control over my test environments. With that in
mind, I've set up a self-contained test environment (no external access)
within VBox with 3 "infrastructure" VMs (IVMs) to somewhat present a
stable infrastructure to test SmartOS. Unfortunately, the physical host
on which I'm running VBox is using an AMD chipset, so I can still test
SmartOS handling of OS virtualization but not KVM level virtualization.

Starting things off, my 3 IVMs are:
        - muttley (FreeBSD 8.2 router)
                + simple configuration to handle routing between our
                  3 networks:
                        = vboxnet (192.168.56.0/24)
                        = intnet (10.0.7.0/24 ("admin" network))
                        = labworld (10.0.8.0/24 ("world" network))
        - serv1 (CentOS 6.2 services host)
                + initial services are name server (bind), web server
                  (httpd), and time server (ntpd)
                + sits on both "intnet" and "labworld"
        - cn40 (SmartOS compute node)
                + hosts our SmartOS created VMs
                        = VMs will only sit on "labworld"
                + sits on both "intnet" and "labworld"; only directly
                  accessible via "intnet"
Technically speaking, there is also a 4th host, the one running VBox.
The only bits that really matter for this host are:
        - hostname:  glados
        - actually does have real world access
        - VBox virtual NIC (vNIC):  vboxnet0 (host-only network)
        - IP address:  192.168.56.1
        - network routes for:
                + 10.0.7.0/24 gateway 192.168.56.37
                + 10.0.8.0/24 gateway 192.168.56.37
Since "glados" is my everyday workstation, rather than reconfigure
name resolution, I simply added entries to "/etc/hosts" for "muttley",
"serv1", "cn40" (and several other compute nodes), and several SmartOS
VMs (SOSVMs). Used throughout these posts are also 3 domains:
        - vbox.none
                + only contains DNS entries for "muttley" and "glados"
                + related network (192.168.56.0/24)
        - admin.none
                + contains DNS entries for all compute nodes and the
                  services host
                + related network (10.0.7.0/24)
        - world.none
                + contains DNS entires for all "world" facing hosts / SOSVMs
                + related network (10.0.8.0/24)
The above domains and their related network zones are maintained by
"serv1" (see part 2). For "muttley" and "serv1", I simply chose OSes
that I already had on hand and was familiar with, you can choose to use
whatever you'd like.

Getting to the IVM setups, the VBox configuration for "muttley" is:
        - 1 vcpu
        - 1024 MB memory
        - 8 GB virtual disk (dynamic / thin provisioned)
        - 3 configured network interfaces:
                + Adapter 1:  Internal network (intnet (10.0.7.37))
                + Adapter 2:  Host-only (vboxnet0 (192.168.56.37))
                + Adapter 3:  Internal network (labworld (10.0.8.37))
After installing "muttley" with a generic FreeBSD 8.2 install, very little
actually needs to be configured. In fact, here is the configuration in
its entirety:
        muttley [0] /bin/cat /etc/rc.conf
        hostname="muttley.vbox.none"
        ifconfig_em0="inet 10.0.7.37 netmask 255.255.255.0"
        ifconfig_em1="inet 192.168.56.37 netmask 255.255.255.0"
        ifconfig_em2="inet 10.0.8.37 netmask 255.255.255.0"
        defaultrouter="192.168.56.254"
        sshd_enable="yes"
        gateway_enable="yes"

        muttley [0] /usr/bin/grep -v ^# /etc/hosts
        ::1     localhost
        127.0.0.1       localhost
        192.168.56.1    glados.vbox.none glados
        192.168.56.37   muttley.vbox.none muttley
        muttley [0] cat /etc/resolv.conf
        domain vbox.none
        search vbox.none world.none admin.none
        nameserver 10.0.7.10
        muttley [0]
The key part to "/etc/rc.conf" is enabling IP forwarding via:
        gateway_enable="yes"
Also, the "defaultrouter" entry actually points to a non-existent host.
Of note, while not yet configured until part 2, I've configured all host
resolution to be done against "serv1" (10.0.7.10). At this point, the
router IVM for our sandbox is now configured and needs to be rebooted.
In part 2, I'll detail the configuration for "serv1", our services host.



see also:
    Intro SmartOS Setup pt 2
    Intro SmartOS Setup pt 3
    Intro SmartOS Setup pt 4