コンテンツにスキップ

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.

  1. Using the native VirtualBox terminal window of the running virtual machine, log in to the VM:
    • Type the username portavm and hit Enter,
    • Type the password provided to you and hit Enter again to log in.
  2. Run the following command to begin setting up a static IP address:
    Terminal window
    sudo ./scripts/setup_static_ip.sh
  3. You will be prompted to enter thesudo password.
  4. The script will perform a network scan to find available IP addresses on your network.
  5. 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 y and pressing Enter.
  6. Next, select the machine role (also known as its type) by entering the number corresponding to one of the following options and pressing Enter:
    1. main
    2. backup
    3. arbiter
  7. 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.
  8. 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.

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.

  1. 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
  2. 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 localhost
    127.0.1.1 MACHINENAME
    # Replace <these> with the actual IPs
    10.221.113.40 porta-db
    10.221.113.15 porta-db-2
    10.221.113.66 porta-db-3
    # The following lines are desirable for IPv6 capable hosts
    ::1 ip6-localhost ip6-loopback
    fe00::0 ip6-localnet
    ff00::0 ip6-mcastprefix
    ff02::1 ip6-allnodes
    ff02::2 ip6-allrouters
  3. Save your changes and exit the text editor.
    • In nano, you can do this by pressing CTRL + X, then Y to confirm saving, and ENTER to exit.
  4. Repeat these steps on each Porta VM in the replication group to ensure all machines can communicate with each other.