Manually Setting Up a Static IP for a Porta On Prem VM
To reliably access Porta from the same address, we need to set up a static IP for the VM.
- Using the native VirtualBox terminal window of the running virtual machine, log in to the VM:
- Type the username
portavmand hitEnter, - Type the password provided to you and hit
Enteragain to log in.
- Type the username
- Run the following command to begin setting up a static IP address:
Terminal window sudo ./scripts/setup_static_ip.sh - You will be prompted to enter the
sudopassword. - The script will perform a network scan to find available IP addresses on your network.
- Select an IP address for the virtual machine by typing the number corresponding to one of the listed available IPs and pressing
Enter.- If you choose to enter a custom IP address:
- Enter the full IP address (e.g.,
192.168.1.100)- If the entered IP appears to be in use, you’ll be asked to confirm. If you are sure the IP is safe to use, type
yand pressingEnter.
- If the entered IP appears to be in use, you’ll be asked to confirm. If you are sure the IP is safe to use, type
- Enter the full IP address (e.g.,
- If you choose to enter a custom IP address:
- Next, select the machine role (also known as its type) by entering the number corresponding to one of the following options and pressing
Enter:- main
- backup
- arbiter
- The script will then proceed to configure the VM with the selected static IP address and machine role.
- You will see a lot of output in the terminal, including password prompts, but you can ignore it.
- When IP configuration is complete, the script will print “Static IP setup completed successfully! VM is now accessible at IP:” and list the new static IP address.
Manually configuring the hosts file
Section titled “Manually configuring the hosts file”During set up, the script setup_vm.ps1 attempts to automatically configure the hosts file on each Porta VM to ensure proper communication between multiple machines in a replication group. However, this automatic setup will not work as intended if the assigned IP addresses are not sequential.
For example, if you have three Porta VMs with the following IP addresses:
- Main machine:
192.168.50.123 - Backup machine:
192.168.50.244 - Arbiter machine:
192.168.50.25
or:
- Main machine:
192.168.50.24 - Backup machine:
192.168.50.25 - Arbiter machine:
192.168.50.23
Then the automated configuration will be incorrect, and you’ll need to manually edit the hosts file on each VM.
- On each Porta VM, open the hosts file for editing using a text editor with superuser privileges. For example, you can use
nano:Terminal window sudo nano /etc/hosts - Add entries for each Porta database in the replication group, mapping their static IP addresses to their respective hostnames. For example:
Terminal window 127.0.0.1 localhost127.0.1.1 MACHINENAME# Replace <these> with the actual IPs10.221.113.40 porta-db10.221.113.15 porta-db-210.221.113.66 porta-db-3# The following lines are desirable for IPv6 capable hosts::1 ip6-localhost ip6-loopbackfe00::0 ip6-localnetff00::0 ip6-mcastprefixff02::1 ip6-allnodesff02::2 ip6-allrouters - Save your changes and exit the text editor.
- In
nano, you can do this by pressingCTRL + X, thenYto confirm saving, andENTERto exit.
- In
- Repeat these steps on each Porta VM in the replication group to ensure all machines can communicate with each other.