Network address translation
2 minute read
Do this with a custom orchestration action. CMP ships with an example, Sample NAT IP Translation Action, at the Pre Server Refresh trigger point.
Enable the sample action
- Go to Admin > Orchestration Actions.
- In the tree on the left, expand Synchronize VMs from Resource Handlers and select Pre Server Refresh.
- Set Sample NAT IP Translation Action to Enabled.
How the sample action works
The sample action uses the NAT Info field on CMP networks. Set NAT Info on the appropriate network to a string following the pattern 192.168.25.x. For any NIC associated with that network, the first three octets of the discovered IP address are replaced with the first three octets of the NAT Info pattern, and the original IP address is stored in the NIC’s private IP field.
If your NAT requirements differ, customize the action. Depending on your logic, the pattern that users enter in NAT Info can differ from the one the built-in action expects; because NAT Info is a plain text field, it accepts whatever pattern you choose.
When writing your own action, save the original IP address returned by the resource handler in the VM dictionary’s private_ip field, as the sample does. Without this step, provisioning a server with a static IP ends with a warning that its IP does not match.
When the Pre Server Refresh trigger point runs
Actions at the Pre Server Refresh trigger point run whenever a server’s information is refreshed from data obtained from the resource handler. This includes during provisioning, when you select Refresh Info, and when a Synchronize VMs from Resource Handlers job runs. These actions can modify the VM data dictionary returned by the resource handler, so that the modified data is used for the refresh.