Network Address Translation (NAT)

Starting in version 5.4, CloudBolt provides the ability to write custom Orchestration Actions that can be used to represent NAT on IPs for servers that it manages.

CloudBolt ships with an example script to perform network address translation, which is called “Sample NAT IP Translation Action” and can be found in the Pre Server Refresh section of Orchestration Actions. It is disabled by default, so enable it to use this functionality. This script makes use of the NAT Info field on CloudBolt Networks. When using the built-in script, the NAT Info field on the appropriate CloudBolt Network should be set to a string following the pattern 192.168.25.x. Then, for any NIC that has that network associated with it, the first 3 octets of the discovered IP will be replaced with the first 3 octets of the NAT Info pattern. Note that the original IP will be stored in the private IP field of the NIC.

If your needs for NAT differ, you can customize the action as necessary. Depending on the logic, the pattern for what users enter in the NAT Info field may be different than what the built-in action uses. Since NAT Info is just a text field, you do not need to do anything different with it to allow that. When writing the script, be sure to save the original IP returned by the RH in the “private_ip” field of the VM dictionary, as is done in the sample script. Without this step, provisions that attempt to verify proper IP assignment will fail.

Actions in the Pre Server Refresh trigger point will be run whenever a server in CloudBolt is having its information refreshed based on data obtained from the Resource Handler. This includes during provisioning, upon pressing the Refresh Info button, and when running a Sync VMs on RH job. These actions can modify the dictionary of VM data returned by the RH so that the modified data will be used for the refresh instead.