# How to configure a second NIC on OCI > [!NOTE] > **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](../../cloudswxtch/installing-cloudswxtch/cloud-agnostic-cloudswxtch-install.md), [Install xNIC on Linux](../../cloudswxtch/installing-xnic/install-xnic-on-linux/index.md) and [Install swXtchBridge](../../cloudswxtch/installing-swxtchbridge/install-swxtchbridge.md). ### **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 1. Go to the console 2. Go to Instances 3. Click on the desired instance 4. Click the Networking tab 5. Click the name of the secondary NIC in the Attached VNICs section 6. Take note of the MAC Address and the Private IP address fields ![OCI VNIC details page with the MAC address and the private IP address highlighted](../../assets/document360/c00f327581-how-to-oci-2nd-nic-data.png) **Now, with that information, follow the instructions based on the OS of the VM.** #### **Debian-based distros** 1. Create a file called `02-datanic-static-config.yaml` in the `/etc/netplan` folder. ```yaml network: version: 2 ethernets: ens4: match: macaddress: "" dhcp4: false addresses: - / ``` Where the is the net mask (or network mask) of ctrl-plane CIDR (in single-subnet configuration). Example: ```yaml network: version: 2 ethernets: ens4: match: macaddress: "02:00:17:31:7E:E8" dhcp4: false addresses: - 10.0.138.84/24 ``` 2. Run the following command to apply the changes: ```shell sudo netplan apply ``` #### **RHEL-based distros** 1. Create a file called `ifcfg-ens4` in the `/etc/sysconfig/network-scripts` folder: ```shell DEVICE=ens4 BOOTPROTO=none ONBOOT=yes PREFIX=24 IPADDR=10.0.192.196 MTU=9000 ``` > [!WARNING] > **PLEASE NOTE** > > The file owner has to be root:root 2. Apply changes: 1. CentOS 7/RHEL7 ```shell sudo systemctl restart network ``` 2. CentOS 8/RHEL 8/9: ```shell sudo systemctl restart NetworkManager ``` #### **Windows** 1. Navigate to Control Panel→Network and Internet→Network and Sharing Center 2. Select the 2nd NIC to open Properties. 3. Select Internet Protocol Version 4 (TCP/IPv4) 4. Enter the IP Address, Subnet Mask, and Default gateway data. ![Windows Network and Sharing Center, Ethernet status, Ethernet properties with Internet Protocol Version 4 highlighted, and the IPv4 properties with a static IP address, subnet mask and default gateway](../../assets/document360/def29190f4-oci-windows-2nd-nic-add-ip-mask-and-gateway.png)