Skip to content

How to Deploy a n2x-node in GCP

This article offers a step-by-step guide on setting up a n2x-node in GCP, including creating all the necessary infrastructure within the cloud service provider.

Prerequisites

To complete this tutorial, you must meet the following requirements:

Architecture

This section provides a basic architectural blueprint to guide you through deploying a n2x-node within the Google Cloud Platform (GCP). This modular design offers versatility and can be reused for various deployment goals, including achieving High Availability (HA) for your n2x.io nodes within your network.

GCP Architecture
GCP Architecture

Step-by-step Guide

Step 1 - Creating and Configuring the GCP VPC

  1. Create the VPC using the values as shown in the following table. For more information, see VPC Networks.

    VPC Settings

    Name MTU Subnets Mode IPv6 Range
    edge-vpc 1460 Custom Disabled

    Create VPC

  2. Create a custom subnet in the VPCs as described in the following table. For more information, see Subnets.

    Subnet Settings

    Name Description Region IPv4 range
    edge-pub-net Edge Public Subnet us-east1 10.0.1.0/28

    Create Subnet

  3. Now let's create the firewall rules required by n2x.io. Select the edge-vpc we have just created, go to the Firewalls tab and select Add Firewall Rule. For more information, see Firewalls

    Create firewall rules as described on the table below.

    Name Network Priority Direction of traffic Action on match Target tags Protocol: Port Range Source Target
    n2x-data-plane-inbound edge-vpc 1000 Ingress Allow n2x-node TCP:57775 / UDP:57775 0.0.0.0/0 0.0.0.0/0
    ssh-vm-management-inbound edge-vpc 1001 Ingress Allow n2x-node TCP:22 0.0.0.0/0 0.0.0.0/0
    n2x-control-plane-https-outbound edge-vpc 2000 Egress Allow n2x-node TCP:443 0.0.0.0/0 0.0.0.0/0
    n2x-control-plane-mqtt-outbound edge-vpc 2001 Egress Allow n2x-node TCP:1883 0.0.0.0/0 0.0.0.0/0
    n2x-data-plane-outbound edge-vpc 2002 Egress Allow n2x-node TCP:57775 / UDP:57775 0.0.0.0/0 0.0.0.0/0

    Info

    For direct communication between n2x.io nodes, open inbound connections to ports 57775 TCP/UDP. (See direct connection for details).

    Note

    Open inbound connectivity to ports SSH or RDP (or both) for remote VM management, as needed.

    Let's create the first rule as an example:

    Create Sample Firewall Rule

    Create Sample Firewall Rule

    Repeat the steps above for each rule in the table. Once completed, the table will look like this:

    Firewall Rule List

Step 2 - Launching a VM instance

  1. Launch a VM instance to support the n2x-node selecting the region where we have created the VPC previously:

    Create VM Instance

    Open Advanced options, on Networking add the n2x-node on Network tag field:

    Add Network Tag

    Select the edge-vpc network and edge-pub-net subnet under Network interfaces section, then click DONE:

    VPC subnet

    Finally, click Create to start creating the VM instance.

Note

Please note that this tutorial uses a Linux OS with an Ubuntu 22.04 (Jammy Jellyfish) but you can choose any OS supported by n2x.io and GCP Compute Engine.

Step 3 - Connecting VM to our n2x.io Network Topology

To connect your VM to the n2x.io network topology, you'll need to:

  1. Add a new connected node to your subnet.
  2. Install the n2x-node agent on the EC2 instance.

Step 4 - Verification

Let's confirm that everything is operational:

  1. Check the n2x-node service status on n2x-node-01 using:

    systemctl status n2x-node
    

    Service validation

  2. Verify that the n2x0 interface on n2x-node-01 is active and has an IP address assigned by using the following command:

    ip addr show dev n2x0
    

    Interface validation

  3. (Optional) To verify connectivity within the n2x.io subnet, you can perform a simple test if another node is present. In this example, we'll use test-node-01 which has the IP address 10.254.1.209.

    ping -c 5 10.254.1.209
    

    Connectivity validation

Conclusion

We've provided a comprehensive guide for launching a n2x-node in GCP. Feel free to adapt this foundation to meet your specific needs and implement more complex scenarios.