Note:

Assign an IP Address to a Second Interface on an Oracle Linux Instance

Introduction

This tutorial provides step-by-step instructions on how to assign an IP address to a secondary network interface on an Oracle Linux instance. Whether you are expanding your network configuration or setting up a specific routing policy, adding and configuring a second interface is a critical skill.

You will learn how to:

By the end of this tutorial, you will be able to extend the networking capabilities of your Oracle Linux instance, enable it to interact seamlessly across multiple subnets or networks.

Objectives

In this tutorial, we will learn how to assign an IP address to a second network interface on an Oracle Linux instance.

Prerequisites

Task 1: Create an OCI Compute Instance

In this task, we will create a new instance in Oracle Cloud Infrastructure (OCI).

Task 2: Add Second VNIC to the Instance

Task 3: Configure IP Address on Second VNIC

The configuration of the IP address on the second VNIC can be done with multiple methods.

Note: For a comprehensive and practical learning experience, start with Method 1 or Method 2, as these leverage OCI native tools and provide a straightforward setup. As you gain familiarity, explore Method 3 for scripting and automation, and finally, try Method 4 for advanced manual configurations.

Method 1: Use OCI CLI (oci-utils package) to Assign an IP Address to the Second Interface using the oci-network-config Command

In this method, create a new instance named sriov-test-04 and assign an IP address to the second interface using the oci-network-config command.

Prerequisites: Provisioned a new instance and added a second VNIC.

Method 2: Use OCI CLI (oci-utils package) to Assign an IP Address to the Second Interface using the ocid daemon

In this method, create a new instance named sriov-test-01 and assign an IP address to the second interface using ocid daemon.

Prerequisites: Provisioned a new instance and added a second VNIC.

Method 3: Use the OCI_Multi_VNIC_Setup Script

In this method, create a new instance named sriov-test-02 and use the OCI_Multi_VNIC_Setup script to configure the IP address for the second VNIC.

Prerequisites: Provisioned a new instance and added a second VNIC.

Method 4: Create the Interface Config File Manually

Create a new instance named sriov-test-03 and configure the IP address for the second VNIC by a definition for the new VNIC in the  /etc/sysconfig/network-scripts/ directory.

Note: In this method, we will configure almost all the steps, that was automatically done by the script in Method 3.

Prerequisites: Provisioned a new instance and added a second VNIC.

Next Steps

Selecting the right method to configure a second interface on an OCI Linux instance depends on your requirements, technical expertise, and desired level of control. If you are looking for a straightforward and efficient setup, Methods 1 and Method 2, which use the oci-utils package and Oracle-native tools, are highly recommended. These methods are ideal for users who want to leverage OCI’s built-in functionality without diving into manual configuration or external scripts.

And, where automation and scalability are critical, Method 3, utilizing the OCI_Multi_VNIC_Setup script, provides a flexible solution. It is especially useful when managing multiple interfaces across different instances, offering time savings and consistency in configuration.

Meanwhile, Method 4, the manual configuration approach, provides the highest level of customization. This method is best suited for advanced users or specific environments where automation tools are either unavailable or not preferred. It also serves as an excellent way to understand the inner workings of networking on Oracle Linux instances.

By understanding these methods, you gain the flexibility to configure secondary interfaces in a variety of scenarios, from basic setup to complex multi-cloud architectures. With the right approach, you can ensure reliable and efficient network configurations tailored to your OCI workloads.

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.