Adding two or more VNICs on Oracle Cloud
Simply attaching a VNIC does not make the OS pick it up right away. Just run through the commands and files below.
sudo mkdir /opt/secondary_vnic
cd /opt/secondary_vnic
curl https://ql.gl/assets/oci_multi_vnic.txt -o /tmp/xxxxx
sudo mv /tmp/xxxxx ./secondary_vnic_all_configure.sh
sudo chmod u+x secondary_vnic_all_configure.sh
sudo vi /etc/systemd/system/secondary_vnic_all_configure.service
/etc/systemd/system/secondary_vnic_all_configure.service File
[Unit]
Description=Add the secondary VNIC at boot
After=basic.target
[Service]
Type=oneshot
ExecStart=/opt/secondary_vnic/secondary_vnic_all_configure.sh -c
[Install]
WantedBy=default.target
sudo chmod 664 /etc/systemd/system/secondary_vnic_all_configure.service
sudo systemctl enable /etc/systemd/system/secondary_vnic_all_configure.service
Reboot and the VNIC is picked up automatically.