LAB 29 ‐ Create & Configure Network Manually - gautam-amitesh/OCI GitHub Wiki
Earlier, I created a VCN using the VCN Wizard, which set up networking in OCI with default settings. These settings included a VCN, Subnets, Security Lists, Route Table, and Gateway. Now, I want to create the network manually. I prefer a clean start after terminating the current network setup, which is only possible if all child resources and VNIC dependencies attached to it are detached or destroyed.
VCN Deletion
-
Navigation
Navigation menu > Networking > Virtual Cloud Networks -
Click
Actionsand then clickDelete -
Check
Search compartments for resources associated with this VCN.and then if you want to scan specific compartments then checkSpecific compartmentsor if you want to scan all compartments then checkAll Compartments. I have already terminated associated instances so I will only select network compartment. ClickScan. -
Once scan is completed ensure that you have all required permission to delete resources and click
Delete All -
Once deleting is completed you will not see that VCN
VCN Creation
-
Click
Create VCN -
Provide
Nameand selectCompartment -
Type
IPv4 CIDR Blocksthen clickAdd to list -
Click
Create VCN
Create Public Subnet
-
Navigate to Subnets and click
Create Subnet -
Provide
Nameand selectCompartment -
Leave
Subnet TypetoRegional(Recommended) -
Provide
IPv4 CIDR Block -
OCI provides
Default Route Tablelater on we will change it -
I am creating public subnet so I will select
Public Subnet -
OCI provides
Default Security Listbut once I will create custom security list then I will attach it to this subnet -
Click
Create Subnet
Create Private Subnet
-
Click
Create Subnet -
Provide
Nameand selectCompartment -
Leave
Subnet TypetoRegional(Recommended) -
Provide
IPv4 CIDR Block -
OCI provides
Default Route Tablelater on we will change it -
I am creating private subnet so I will select
Private Subnet -
OCI provides
Default Security Listbut once I will create custom security list then I will attach it to this subnet -
Click
Create Subnet
Create Security List
For Public Subnet
-
Navigation
-
Click
Create Security List -
Provide
Nameand selectCompartment -
I prefer to add rules while creating SL so click
Another Ingress Rulefor ingress rule and clickAnother Egress Rulefor egress rule and add as many rules you need, I am allowing outgoing connection using all protocol to0.0.0.0/0for installing telnet but after installation I will remove this egress rule and onlytcpprotocol will be left allowed. -
Click
Create Security List
For Private Subnet
-
Click
Create Security List -
Provide
Nameand selectCompartment -
I prefer to add rules while creating SL so click
Another Ingress Rulefor ingress rule and clickAnother Egress Rulefor egress rule and add as many rules you need I don't need egress rule for my private subnet so I will only create ingress rule -
Click
Create Security List
Add Security Lists
To Public Subnet
-
Navigation
Navigation menu > Networking > Virtual Cloud Networks > VCN (specific vcn) > Subnets > public_subnet > Security > Add Security List -
Select
Compartment** then select**Security Listand finally clickAdd Security List -
Removedefault security list and when confirmation dialogue box appears clickRemoveagain
To Private Subnet
-
Navigation
Navigation menu > Networking > Virtual Cloud Networks > VCN (specific vcn) > Subnets > private_subnet > Security > Add Security List -
Select
Compartment** then select**Security Listand finally clickAdd Security List -
Removedefault security list and when confirmation dialogue box appears clickRemoveagain
Gateway
Gateway is an intermediary network node that connects two distinct networks operating on different protocols or subnets by acting as the entry and exit point for traffic between them. In OCI, it is created at the VCN level, but it sits on the boundary of the VCN, not inside the VCN or subnet. Think of a gateway as an advanced post office with an IP address that can open an envelope (packet), read where it is trying to go, inspect it, rewrite information if needed, and decide where to send it next.
Node is any active physical or virtual device with a distinct network address that is connected to a network and can generate, receive, store, or transmit data. There are two type of Node, First one is Endpoint (Host Nodes) like, Laptops, Smartphones, Printers, and Database Servers. Second one is Intermediary Nodes like, Routers and Gateways that handle data forwarding.
Distinct Networks are independent communication domains that cannot exchange data directly at the local link level without intermediary translation.
Create Internet Gateway
Internet Gateway: As the name suggests, this is the door of a VCN which allows instances to communicate with the internet.
-
Navigation
Navigation menu > Networking > Virtual Cloud Networks > VCN (hub_vcn-manual) > Gateways > Internet Gateways > Create Internet Gateway -
Give it a
Nameand selectCompartment -
I have not created route table yet but if you want to associate a route table click
Advanced optionsthen selectCompartmentandRoute Tableand finally clickCreate Internet Gateway.
Routing
Route is a single instructional path (one simple rule or direction) that tells a device how to reach a specific destination network. A Route Table is the in-memory (device's volatile memory) database where all these individual route instructions live. In OCI, a Route Table is created inside the VCN as a resource, but it is enforced by associating it with subnets (or individual VNIC/gateways).
The Gateway is the VCN's exterior door and the Route Table is the subnet-level directory that tells packets whether they are allowed to take the route leading to that door.
Working
Instance (private & public IP) >> Security List (Egress) >> Subnet Route Table >> Internet Gateway (private IP => public IP) >> Remote Server
Remote Server >> Internet Gateway >> Security List (Ingress) >> Instance
Create Route Table
-
Navigation
Navigation menu > Networking > Virtual Cloud Networks > VCN (hub_vcn-manual) > Routing > Create Route Table -
Give it a
Nameand selectCompartment -
Click
Another Route Ruleand selectTarget Type -
Provide
Destination CIDR Blockas0.0.0.0/0, selectCompartment, and selectTarget Internet Gateway -
Finally click
Create
Add Route Rules
-
Navigation
Navigation menu > Networking > Virtual Cloud Networks > VCN (hub_vcn-manual) > Subnets > public_subnet > Actions > Edit -
Select
Route Tablefrom the dropdown and clickSave changes -
Verify the change
Create Private & Public Instance
-
Log in
bastion_server -
Test ping to
amazon_server -
Install
telnetinbastion_serverand testTCPconnectivity on Port22ofamazon_server -
Let's create private key and try to log in
amazon_serverfrombastion_server