DEV Community

Joseph D. Marhee
Joseph D. Marhee

Posted on • Originally published at Medium on

SmartOS Zone Networking on Packet

Running SmartOS on Packet is a well-documented, supported option for production-grade deployments of SmartOS, with full support for best practices and patterns for network, compute, and storage configurations:

https://support.packet.com/kb/articles/smartos

Part of this means that, for your services running in zones (of multiple brands — joyent, kvm, bhyve), Packet’s network automation is suitable for use with your Packet-managed SmartOS compute nodes.

Note : A best practice for compute-node setup is that your management/admin interface (the one you configured during setup) is that it not be Internet-facing, however, if you did configure it to be reachable over the Internet, you will not need to configure the host any further unless you plan to provide Packet private network addresses to your zones.

https://wiki.smartos.org/managing-nics/

Otherwise, no further changes will be required to assign addresses from the same network your admin interface shares in Packet’s facilities.

When provisioning your host, you’ll want to also provision a larger subnet (the default provisioning request requests a /31 for a single host), something like a /29 will suffice, ensure that you request this for both public and private networking, if you intend to attach public addresses to some and not others, and if you intend for zones on different hosts to be accessible to each other over the private network:

You’ll find this under the “Configure” menu when you go to create the server.

Keep in mind that, if you do create the admin interface using the public IPv4 address, that, rather than binding the entire subnet, you will just need the first address, using a netmask of 255.255.255.248 for it, and subsequent addresses used by zones needing an IPv4 address, of either your public or private subnet.

Then, with the subnet provisioned, you’ll need to allocate some segment of this subnet to attach to your SmartOS host, so back on your server page’s Network tab, you’ll select an address from your management range:

You’ll use the same approach for the Public and Private IPv4 addresses.

and whatever range (in our case, a single address and a gateway) selected will be attached to that host.

With our address defined, we can then populate our zone definition, and we’ll start by importing a basic joyent brand image:

imgadm import 643de2c0-672e-11e7-9a3f-ff62fd3708f8
Enter fullscreen mode Exit fullscreen mode

and put it into a file we’ll called base.json :

{
 "brand": "joyent",
 "image\_uuid": "643de2c0-672e-11e7-9a3f-ff62fd3708f8",
 "alias": "public-ipv4-test",
 "hostname": "public-ipv4-test",
 "max\_physical\_memory": 512,
 "quota": 20,
 "resolvers": ["8.8.8.8", "8.8.4.4"],
 "nics": [
  {
   "nic\_tag": "admin",
    "ip": "1.2.3.51",
    "netmask": "255.255.255.248",
    "gateway": "1.2.3.49"
  }
 ]
}
Enter fullscreen mode Exit fullscreen mode

This creates a simple joyent brand zone, but this networking scheme will suffice for all available brands, and where, for example, your host will be 1.2.3.50 , your first zone can use the next address in the range (as I did above), 1.2.3.51 , etc.

You can proceed to create the zone:

vmadm create -f /opt/base.json
Enter fullscreen mode Exit fullscreen mode

and you’ll get a response with a UUID like:

Successfully created VM e82392bd-93e2-e499-9710-bbbf07cf898c
Enter fullscreen mode Exit fullscreen mode

and verify connectivity with the zlogin utility:

zlogin e82392bd-93e2-e499-9710-bbbf07cf898c ping packet.com
Enter fullscreen mode Exit fullscreen mode

If this configured the zone successfully, you’ll get a response like:

packet.com is alive
Enter fullscreen mode Exit fullscreen mode

confirming that the network is configured properly.

Top comments (0)