How to configure a second NIC on OCI¶
WHAT TO EXPECT
In this article, users will learn how to configure a second NIC in OCI so it can be used with xNIC or cloudSwXtch.
OCI Firewall rules and netplan¶
The default configuration for a VM created in OCI using the web console usually comes with only one NIC and with host firewall (iptables) rules that reject inbound traffic other than SSH.
Host firewall (iptables) on OCI¶
Do not flush or disable OCI's host firewall. The cloudSwXtch, xNIC and swXtchBridge installers open only the ports their component needs in it, keep them across reboots and leave the rest of OCI's rules in place; --host_owns firewall skips this. Listener ports you choose for your own adaptors or applications are not opened: allow them yourself. The OCI security list must still allow the same ports. For what each installer opens, see Cloud agnostic cloudSwXtch Install, Install xNIC on Linux and Install swXtchBridge.
Set DHCP in netplan for OCI 2nd NIC on Linux¶
If the VM needs a second NIC for data-plane, OCI will not automatically configure an IP for the adapter using DHCP.
In order to configure the IP for the second adapter, users can execute the following instructions.
Prior to executing any instructions, users need to know two parameters assigned by OCI to the secondary NIC:
- IP Address
- MAC Address
These values are available in the OCI console. To get them¶
- Go to the console
- Go to Instances
- Click on the desired instance
- Click the Networking tab
- Click the name of the secondary NIC in the Attached VNICs section
- Take note of the MAC Address and the Private IP address fields

Now, with that information, follow the instructions based on the OS of the VM.
Debian-based distros¶
-
Create a file called
02-datanic-static-config.yamlin the/etc/netplanfolder.network: version: 2 ethernets: ens4: match: macaddress: "<ADD macaddress of primary of 2nd VNIC>" dhcp4: false addresses: - <ADD Primary IP ADDRESS OF 2ND VNIC>/<XX>Where the
is the net mask (or network mask) of ctrl-plane CIDR (in single-subnet configuration). Example: -
Run the following command to apply the changes:
RHEL-based distros¶
-
Create a file called
ifcfg-ens4in the/etc/sysconfig/network-scriptsfolder:PLEASE NOTE
The file owner has to be root:root
-
Apply changes:
-
CentOS 7/RHEL7
-
CentOS 8/RHEL 8/9:
-
Windows¶
- Navigate to Control Panel→Network and Internet→Network and Sharing Center
- Select the 2nd NIC to open Properties.
- Select Internet Protocol Version 4 (TCP/IPv4)
- Enter the IP Address, Subnet Mask, and Default gateway data.
