Note:

Add OCI Load Balancer and OCI WAF to a Hub with Hub and Spoke VCN Routing Architecture

Introduction

This tutorial will guide you through the tasks necessary to deploy and configure an Oracle Cloud Infrastructure (OCI) Load Balancer with OCI Web Application Firewall (WAF) in OCI and how this will operate in a Hub and Spoke VCN routing environment.

image

The following image illustrates the traffic flows.

External to Spoke connectivity using the Load Balancer and WAF

image

Objectives

Prerequisites

Task 1: Review the Current Hub and Spoke Network Architecture

To continue this tutorial we should have:

In the Hub VCN, we have a Windows instance that we can use to connect to the spoke instances. Each spoke will have one instance that will be configured as a web server, these instances can be used as endpoints for the load balancer that we will deploy in this tutorial.

The following image illustrates the starting point.

image

Task 2: Configure Routing in the Hub and Spoke Network Architecture between the OCI WAF and OCI Load Balancer, the Hub Firewall and the Spoke Instances

The following image illustrates the current Hub and Spoke network architecture with all the security lists and routing tables.

image

Before we add the OCI Load balancer, we want to make sure that traffic coming from the OCI Load Balancer subnet is routed to the hub firewall so that the traffic can be inspected on the hub firewall before it sends the traffic to the spoke instances.

While we already have a default routing rule doing this, it is still best practice to add this rule in to call it out explicitly as we did with the other networks as well.

Task 3: Install a Web Server on the Backend Servers

Install a NGINX web server on all the instances in the spoke VCNs. For more information about how to install a NGINX web server on an Oracle Linux instance, see Task 6: Install a Web server on Instance.

image

Task 4: Create or Modify a Webpage on the Backend Servers

By default, each web server will be configured with a default webpage. To track where our OCI Load Balancer redirects the traffic to it is good practice to change something on the webpage so you know what server is hit.

We can do this by changing the content of the default NGINX index.html file.

sudo nano /usr/share/nginx/html/index.html

For Instance-A, change the header:

<h1>Welcome to nginx! This is INSTANCE-A</h1>

For Instance-B, change the header:

<h1>Welcome to nginx! This is INSTANCE-B</h1>

For Instance-C, change the header:

<h1>Welcome to nginx! This is INSTANCE-C</h1>

Make sure you save the index.html files after changing them.

Task 5: Install an OCI Load Balancer

Before we create the OCI Load Balancer, we first need to allow port 80 ingress on the Hub VCN security list. All the traffic including the traffic that is going from the load balancer in the public subnet of the Hub VCN is routed to the HUB firewall. The instances that the load balancer is going to use endpoints are listening on port TCP/80. For this reason, we also need to allow port TCP/80 ingress on the Hub VCN so that the private subnet in the Hub VCN where the traffic is routed also allows the communication towards the spoke VCNs.

Task 6: Install and Configure an OCI Web Application Firewall

Task 7: Test the OCI WAF, OCI Load Balancer Connectivity and WAF Security

Acknowledgments

More Learning Resources

Explore other labs on docs.oracle.com/learn or access more free learning content on the Oracle Learning YouTube channel. Additionally, visit education.oracle.com/learning-explorer to become an Oracle Learning Explorer.

For product documentation, visit Oracle Help Center.