# Virtual Infrastructure Setup and VM Deployment

{% stepper %}
{% step %}

### **Create a Virtual Network**&#x20;

**Purpose & Summary:**

Create a private virtual network exclusive to your project that acts like a secure switch within the cloud, enabling VMs to communicate internally without exposure. \
**Details:** This network is the foundation for VM communication and network isolation. The network should be “Up” and assigned to your project. \
**Steps:** \
Go to Networking → Networks.

<figure><img src="https://1802641068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAChv0b03d6kwjavnnWlJ%2Fuploads%2FAbzVgwmPz8nxgPEEEyZO%2Fimage.png?alt=media&#x26;token=688a35a8-1c3c-4e86-8ded-189c1c2f436a" alt=""><figcaption></figcaption></figure>

Click on Virtual Networks

<figure><img src="https://1802641068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAChv0b03d6kwjavnnWlJ%2Fuploads%2FjDjZPmGxDkJhzzx6LYvm%2Fimage.png?alt=media&#x26;token=81cdf4ca-ce9c-46f9-b525-91766e86fd03" alt=""><figcaption></figcaption></figure>

Click Create Network.\\

Select your project (e.g., web-project) and then Name the network (e.g., private-net).\
![](https://1802641068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAChv0b03d6kwjavnnWlJ%2Fuploads%2FRhOzzFNGXn1cesPKhme9%2Fimage.png?alt=media\&token=3aeade36-b43f-453c-b23a-ee01ceca08ac)

After filling the details click on Create.<br>
{% endstep %}

{% step %}

### **Add a Subnet**

Under the network we just created, we now need to create a subnet.

<figure><img src="https://1802641068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAChv0b03d6kwjavnnWlJ%2Fuploads%2FKTqsEcnAvf1VYd2cDOvk%2Fimage.png?alt=media&#x26;token=3ce4bfe9-4082-451d-8b32-d033614927e2" alt=""><figcaption></figcaption></figure>

**Purpose & Summary:**\
Define a subnet within your virtual network that specifies the IP address range your VMs will use, e.g., 192.168.50.0/24. \
Configure DHCP to automatically assign IP addresses and specify DNS servers for name resolution.\
**Details:**\
The subnet determines the IP range and gateway for the network. You should avoid IP\
conflicts with your existing networks.\
**Steps:**\
When creating your network, proceed to add a subnet.\
Provide:\
Subnet Name (e.g., private-subnet)\
Network Address (CIDR), e.g., 192.168.50.0/24\
Gateway IP (usually 192.168.50.1)\
Enable or disable DHCP as per your setup (default enabled)\
Add DNS Nameservers (8.8.8.8, 1.1.1.1)

<figure><img src="https://1802641068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAChv0b03d6kwjavnnWlJ%2Fuploads%2FEFde2BXNY3tj7tRMN3ke%2Fimage.png?alt=media&#x26;token=9863c604-b807-4486-aa5c-f629927da359" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### **Create a Virtual Router**

**Purpose & Summary:**\
Set up a virtual router to enable routing between your private network and external networks (such as the internet), acting as a Layer 3 device managing traffic flow.\
**Details:**\
The router must be active (Admin State: Up) and assigned to your project.\
**Steps:**\
Navigate to Networking → Routers.

<figure><img src="https://1802641068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAChv0b03d6kwjavnnWlJ%2Fuploads%2FDgCADlWVG8W4Vlu8EGtw%2Fimage.png?alt=media&#x26;token=74d8e06a-2545-41e0-806a-0d83029f9931" alt=""><figcaption></figcaption></figure>

Click Create New, Select the Project, name the server (e.g., internet-router) and then click on Review and Create.

<figure><img src="https://1802641068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAChv0b03d6kwjavnnWlJ%2Fuploads%2FofJnurso0awx9JFk41gH%2Fimage.png?alt=media&#x26;token=c7376315-e544-403e-b8b9-c2580221f3be" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### **Attach Subnet to Router**

**Purpose & Summary:**\
Connect the subnet to the router by adding the subnet interface to allow VMs on that subnet to route traffic outside the private network.\
**Details:**\
This links your private subnet with external networks via the router.

**Steps:**\
Open your newly created router (internet-router).\
Go to the Interfaces tab.\
Click Add Interface.\
Select your subnet (e.g., private-subnet).\
Confirm the interface addition

<figure><img src="https://1802641068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAChv0b03d6kwjavnnWlJ%2Fuploads%2FPJqLtFvc7sJ3OUZd7kQt%2Fimage.png?alt=media&#x26;token=6aeb7300-4f1c-4538-8c11-74bbf6f7ee3b" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1802641068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAChv0b03d6kwjavnnWlJ%2Fuploads%2F8p8caz25L7Dv949sTFOj%2Fimage.png?alt=media&#x26;token=78589a9d-367b-46c5-a63a-697c977ec715" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### **Create a Security Group (Restrict by IP)**

**Purpose & Summary:**\
Configure a security group to control inbound and outbound traAic to your VM, acting like a virtual firewall. \
Restrict SSH access to your specific public IP for security.\
**Details:**\
Default security usually denies inbound access; explicitly allow needed ports and IP ranges.\
**Steps:**\
Go to Network → Security Groups.

<figure><img src="https://1802641068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAChv0b03d6kwjavnnWlJ%2Fuploads%2FdWKAWn56fPeONPYImJjz%2Fimage.png?alt=media&#x26;token=3fb73298-3d86-4c5c-967c-9e55515d8513" alt=""><figcaption></figcaption></figure>

Create a new group called (e.g., ssh-only).

<figure><img src="https://1802641068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAChv0b03d6kwjavnnWlJ%2Fuploads%2F3SRaXSriQz8ewlA46ZiQ%2Fimage.png?alt=media&#x26;token=aee8c2ca-a8e8-4cef-b28d-a8a2416bf820" alt=""><figcaption></figcaption></figure>

Upon Submission, click on the name of the particular Security Group and add an ingress rule:\
Protocol: TCP\
Optionally add a description\
Port Range: 22 (SSH)\
Remote IP Prefix: Your public IP with /32 mask (e.g., 203.0.113.25/32)\
Optionally, add rules for HTTP (80) and HTTPS (443) if hosting web apps.\
**Tip:**\
Find your public IP at whatismyipaddress.com.

<figure><img src="https://1802641068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAChv0b03d6kwjavnnWlJ%2Fuploads%2FsoH0Ut3UPPi134Wj78Hh%2Fimage.png?alt=media&#x26;token=35ab423d-8204-4458-be61-bb1a5be68bdf" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### **Launch a Virtual Machine (Instance)**

**Purpose & Summary:**\
Deploy a virtual machine in your environment with the OS, compute resources, network, and security settings defined.\
**Details:**\
Select an image (Linux/Windows), an VM plan for CPU/RAM sizing, and upload/select an SSH key or set a password for access. Attach the VM to the private network and security group.\
**Steps:**\
Navigate to Virtual Machines → Instances (VMs).\\

Click Create Instance.

<figure><img src="https://1802641068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAChv0b03d6kwjavnnWlJ%2Fuploads%2F3SdBr9u4JfrLpjORlEOA%2Fimage.png?alt=media&#x26;token=f67b9285-b5d0-4a5e-b51a-edfa8d336075" alt=""><figcaption></figcaption></figure>

Provide:\
Compute Offering (e.g., GP1.micro)\
OS Image (e.g., Ubuntu 22.04)

<figure><img src="https://1802641068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAChv0b03d6kwjavnnWlJ%2Fuploads%2FqM5cjCEd49BpP29H15rp%2Fimage.png?alt=media&#x26;token=5c87b965-3e02-499d-b68b-8eab39b1b323" alt=""><figcaption></figcaption></figure>

Disk Offering (e.g., Standard NVMe 10 GB)\
Network: Attach to your private network (private-net).\
Security Group: Select the group you created (e.g., ssh-only).\
Key Pair: Upload or select your SSH public key (ssh-rsa\
AAAAB3NzaC1...your-key...) or define a strong password.\
Startup Script: If you have start script while provisioning VM.\
Monitoring: Enable/Disable

<figure><img src="https://1802641068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAChv0b03d6kwjavnnWlJ%2Fuploads%2FS9VTBqDSSohC9ZNBQfmV%2Fimage.png?alt=media&#x26;token=fb829f67-6a3a-4a3c-9a0b-7d1418f3a747" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1802641068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAChv0b03d6kwjavnnWlJ%2Fuploads%2FbKC3bIsVbiBgqJkJAqUJ%2Fimage.png?alt=media&#x26;token=05bc960d-2441-4cc4-95ac-2efa20db38f7" alt=""><figcaption></figcaption></figure>

Server Name & Server Hostname (e.g., web-server)\
Review & Deploy the VM.

<figure><img src="https://1802641068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAChv0b03d6kwjavnnWlJ%2Fuploads%2FHeMFhg8bhFl5OOzQhync%2Fimage.png?alt=media&#x26;token=23ef17cf-d895-4095-bdd7-14257f6e29f6" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### **Allocate and Assign a Floating IP**

**Purpose & Summary:**\
Assign a floating (public) IP to your VM to enable internet access, mapping a public IP to the VM’s private address.\
**Details:**\
Floating IPs provide NAT (network address translation) so your VM can be accessed externally without exposing its internal IP.\
**Steps:**\
Go to Networking → Floating IPs.

<figure><img src="https://1802641068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAChv0b03d6kwjavnnWlJ%2Fuploads%2FFSoOx61BSl5nUnNjObU0%2Fimage.png?alt=media&#x26;token=12567cc4-7984-4a1a-84b1-2000f7b93fa3" alt=""><figcaption></figcaption></figure>

If you don't have any existing public IPs, Buy one.

<figure><img src="https://1802641068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAChv0b03d6kwjavnnWlJ%2Fuploads%2Fa4GwUGgymsrVx5YjobWT%2Fimage.png?alt=media&#x26;token=40d60d73-0341-4b8a-89c8-6639ce6ede7a" alt=""><figcaption></figcaption></figure>

Allocate a new floating IP.\
Associate it with your VM instance (e.g., web-server).
{% endstep %}

{% step %}

### **Final Notes**

After deploying, test connectivity by SSHing to the floating IP.\
Verify security group rules to ensure only intended ports/IPs are open.
{% endstep %}
{% endstepper %}
