Setting up a Linux Instance on GCP

Contents

Prerequisites

As this description shows the basic setup of a Linux instance on the GCP, it does not list specific prerequisites. However, depending on the use case, the following prerequisites should be considered:

  • To set up a Linux instance on the GCP, you need a Google Cloud account.
  • If this instance is to be used as a Charon host system, refer to the user's guide of your Charon product to determine the exact hardware and software prerequisites that must be taken into account for the Linux instance. The image you use for your instance and the machine type you chose determine which hardware and software your cloud instance has.
  • If this instance is to be used as a Charon host system, a product license is required to run emulated systems. Contact your Stromasys representative or Stromasys VAR for details.
  • Certain legacy operating systems that can run in emulated systems provided by Charon emulator products require a license of the original vendor of the operating system. The user is responsible for any licensing obligations related to the legacy operating system and has to provide the appropriate licenses.

GCP Login and New Instance Launch

Logging in to GCP

To log in perform the following steps:

  • Go to https://console.cloud.google.com. You will see the login screen.
  • Enter your login credentials.
  • Upon successful login, a Google cloud dashboard screen will be displayed similar to the example below:

Preparation

Select or Create Project

A project organizes all your Google Cloud resources. To organize all resources for a certain application purpose, you can group them in their own project. So before you start creating resources, select or create the appropriate project.

To select or create a project, select the project list from the top of the Google cloud console window, as shown below:

Either select the correct project or create a new one by clicking on the New Project button.


Create VPCs and Subnets for Instance

Important rules for Google cloud instances with respect to network interfaces:

  • Interfaces can only be added during instance creation.
  • Each network interface configured in a single instance must be attached to a different VPC network.
  • The additional VPC networks that the multiple interfaces will attach to must exist before an instance is created. See Using VPC Networks for instructions on creating additional VPC networks.
  • You cannot delete a network interface without deleting the instance.
  • IP forwarding can only be enabled when the instance is created.
  • The VPC network has a maximum transmission unit (MTU) of 1460 bytes for Linux images and Windows Server images. Operating system images provided by Compute Engine are already configured with the appropriate MTU. For custom images, set the MTU to 1460 for custom Linux images and Windows Server images to avoid the increased latency and packet overhead caused by fragmentation.

Therefore the required VPCs and subnets must exist before the instance is created.

To create additional VPCs (if required), perform the following steps.


Step 1: Open the VPC network section by clicking on the Navigation menu, then selecting VPC network, and clicking on VPC networks - as illustrated below.

This will open the VPC overview page with the already existing VPCs. If all required VPCs and subnets already exist, continue with creating the new VM instance. Otherwise, continue with step 2.


Step 2: If you need to create a new VPC, click on CREATE VPC NETWORK at the top of the VPC overview list.

This opens the VPC configuration window.


Step 3: Create VPC and subnets.

In the VPC configuration window, enter

  • the VPC name, and
  • the subnet name, region and address.

Click on Create at the bottom of the window to create the VPC.

The new VPC should appear in the VPC overview list. Selecting the VPC in the overview list will open the detail information window. Example:


Step 4: Create firewall rules for the VPC.

With the detail information open, click on Firewall. This will allow you to define the required firewall rules for the VPC.

An example of a small set of firewall rules that allow incoming SSH and ICMP is shown below:


Creating a New VM Instance

Step 1: Go to the VM instance overview page.

Open the Navigation menu, click on Compute Engine and then on VM Instances as illustrated below:

This will open the list of already existing VM instances.


Step 2: Click on Create Instance at the top of the overview list.

This will open the VM creation window as shown below.


Step 3: Configure the basic information of your new VM instance.

In the main configuration window set the following information at a minimum:

  • Name of the instance (permanent setting)
  • Correct Machine family and Machine type to match the Charon-SSP host and guest requirements
  • Boot disk type and size, and the image to use as the operating system. To change the image, press the Change button and select the correct image (a supported Linux version or - if appropriate - a prepackaged Charon-SSP VE marketplace image).

The following image illustrates the basic settings:


Step 4: Add you SSH key for remote access to the cloud instance.

Open the advanced settings at the bottom of the VM creation window by clicking on Management, security, disks,... at the bottom of the page:


The advanced settings allow you to create and add disks and network interfaces during the creation of a VM.

Please note: network interfaces can only be added during the creation of a VM instance.

The advanced settings also allow you to add your public SSH key for accessing the VM once started. To do this,

  • select the tab Security in the advanced settings section,
  • paste your public key into the field provided.

You can collapse the section again by clicking on Less.


Step 5: Optionally, configure additional NICs and/or IP forwarding

To add an additional network interface, perform the following steps:

  • Open the advanced settings at the bottom of the VM creation window by clicking on Management, security, disks,... at the bottom of the page.
  • Select Networking from the advanced settings section.
  • Click on Add network interface.
  • Select the correct subnet.
  • Set the information about internal and external IP address (static or ephemeral) as required.

After adding all the required information, click on Done.

To enable IP forwarding, perform the following steps:

  • Open the advanced settings at the bottom of the VM creation window by clicking on Management, security, disks,... at the bottom of the page.
  • Select Networking from the advanced settings section.
  • Select the edit option for the default NIC.
  • Enable IP forwarding
  • Click on Done.

Step 6: Create the VM.

Once you filled in all the required data, create the VM by pressing the Create button at the bottom of the page:

This will create the VM, start it and show it in the VM instances list.


Step 7: Verify the settings of the newly created cloud instance.

After successful creation, the new instance will be shown in the VM instances list:

By clicking on it, you will see the details of the cloud instance, as shown in the example below:


Initial Access to the Instance

Once you have access to the instance, you can create the access you require for your applications. This section just shows the basic steps for initial access to the instance.

SSH Interactive Access

To connect to the instance interactively, you must connect as the management user of your instance. Use the following command:

$ ssh -o ServerAliveInterval=30 -i <path-to-your-private-key> <management-user-name>@<cloudhost-IP-address>

The parameter ServerAliveInterval will protect the connection from timing out.

Please note:

  • Depending on the type of connection, you will have to use either the public IP address of the cloud system or its address in a customer-specific VPN.
  • The management user account normally allows sudo access to privileged commands (use sudo -i).

File Transfer with SFTP

SFTP enables file transfers to and from the cloud instance. Use the management user of your instance. The security rules must allow SSH access to allow SFTP access to the cloud instance.

Please note: Depending on the type of connection, you will have to use either the public IP address of the cloud system or its address in a customer-specific VPN.

To connect to the instance, use the following command:

$ sftp -i <path-to-your-private-key> <management-user>@<cloudhost-IP-address>





© Stromasys, 1999-2024  - All the information is provided on the best effort basis, and might be changed anytime without notice. Information provided does not mean Stromasys commitment to any features described.