OCI Utilities
Instances using Oracle Linux platform images include a set of utilities (oci-utils
) that allow the instance to access information about infrastructure resources. These utilities consist of a service component and command line tools that help automatically discover or provision resources.
Installing the OCI Utilities
Instances launched with Oracle Linux 7 or later automatically include the OCI utilities
(oci-utils
) package installed. The utilities are not currently
available on other distributions.
To use the utilities, you must ensure the following prerequisites are met:
- Ensure that the
oci_included
repository is enabled. This repository is enabled by default in Oracle Linux platform images. This repository contains all package dependencies, including the required Oracle Cloud Infrastructure SDK and Python packages. All required packages are installed with theoci-utils
package. - Ensure that the OCI utilities have sufficient permissions to access Oracle Cloud Infrastructure by using one of the following methods:
- Run the
oci setup config
configuration command as root to create SDK configuration files for the host. For more information, see SDK and CLI Configuration File. - Use instance principals by adding the instance to a dynamic group that was granted access to Oracle Cloud Infrastructure services. For more information, see Managing Dynamic Groups.
- Configure
oci-utils
to allow root to use a non-privileged user's Oracle Cloud Infrastructure configuration files. For more information, see the configuration file located in the/etc/oci-utils.conf.d
directory of the instance.
- Run the
For a video on how to install and set up the OCI utilities, see Enabling OCI Utilities in Oracle Linux on Oracle Cloud Infrastructure Instances in the Oracle Linux Training Station.
Updating the OCI Utilities
To update to the latest version of oci-utils
:
sudo yum update oci-utils
Using the ocid Daemon
The ocid
daemon is the service component of the
oci-utils
. It monitors for changes in the VNIC and
iSCSI configuration of the instance and attempts to automatically attach or detach
devices as they appear or disappear - for example, when they are created or deleted
using the Oracle Cloud Infrastructure Console, CLI, or the API.
To start the ocid
daemon using systemd
and set the
ocid
service to start automatically during system boot:
sudo systemctl enable --now ocid.service
To confirm that the service is active (running):
sudo service ocid status
For example:
$ sudo service ocid status
Redirecting to /bin/systemctl status ocid.service
ocid.service - Oracle Cloud Infrastructure utilities daemon
Loaded: loaded (/etc/systemd/system/ocid.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2021-02-04 18:01:25 GMT; 1min 42s ago
Main PID: 16630 (python3)
CGroup: /system.slice/ocid.service
└─16630 /usr/bin/python3 /usr/lib/python3.6/site-packages/oci_util...
Feb 04 18:01:23 mor-demoinst-10 systemd[1]: Starting Oracle Cloud Infrastruc....
Feb 04 18:01:24 mor-demoinst-10 sudo[16705]: root : TTY=unknown ; PWD=/ ...w
Feb 04 18:01:25 mor-demoinst-10 systemd[1]: Started Oracle Cloud Infrastruct....
Hint: Some lines were ellipsized, use -l to show in full.
OCI Utilities Reference
Learn more details about each utility including a description, options, and usage examples.
oci-growfs
Description
Expands the root file system of the instance to its configured size. This command must be run as root.
Currently, only XFS and ext4 file systems are supported.
By default, a boot volume for a compute instance extends only to 50 GB, which is the
default minimum size. If a compute instance is created with a boot volume that is
greater than or equal to 50 GB, the instance does not automatically use the entire
volume. Use the oci-growfs
utility to expand the root partition to
fully utilize the allocated boot volume size. When the partition already extends to
the entire volume, no changes are made to the system when using the utility.
For Logical Volume Manager (LVM) based root file systems, the
oci-growfs
utility supports only a logical volume that is
created on a logical group built with a single physical volume.
Usage
/usr/libexec/oci-growfs [-y] [-n] [-h | --help]
Options
-y
Answer "yes" to all prompts.
-n
Answer "no" to all prompts.
-h | --help
Display a summary of the command line options.
Example
$ sudo /usr/libexec/oci-growfs
Volume Group: ocivolume
Volume Path: /dev/ocivolume/root
Mountpoint Data
---------------
mountpoint: /
source: /dev/mapper/ocivolume-root
filesystem type: xfs
source size: 35.5G
type: lvm
size: 35.5G
physical devices: ['/dev/sda3']
physical volumes: ['/dev/sda', '/dev/sda']
partition number: ['3']
volume group name: ocivolume
volume group path: /dev/ocivolume/root
Partition dry run expansion "/dev/sda3" succeeded.
CHANGE: partition=3 start=2304000 old: size=95371264 end=97675264 new: size=207411167 end=209715167
Expanding partition /dev/sda3: Confirm? [y/N] y
Partition expand expansion "/dev/sda3" succeeded.
update-partition set to true
resizing 3 on /dev/sda using resize_sfdisk_gpt
209715200 sectors of 512. total size=107374182400 bytes
## sfdisk --unit=S --dump /dev/sda
label: gpt
label-id: E7907221-9145-4607-90D5-83568142CE88
device: /dev/sda
unit: sectors
first-lba: 34
last-lba: 209715166
/dev/sda1 : start= 2048, size= 204800, type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B, uuid=8A87874A-82EF-4DB2-9BEF-478D6FE6D7F1, name="EFI System Partition"
/dev/sda2 : start= 206848, size= 2097152, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=494939AC-2729-41E2-8B59-5B43895F24B7
/dev/sda3 : start= 2304000, size= 95371264, type=E6D6D379-F507-44C2-A23C-238F2A3DF928, uuid=21089B62-6F80-4DF6-A8D1-3E1BD8E6D69B
padding 33 sectors for gpt secondary header
max_end=209715167 tot=209715200 pt_end=97675264 pt_start=2304000 pt_size=95371264
resize of /dev/sda returned 0.
CHANGED: partition=3 start=2304000 old: size=95371264 end=97675264 new: size=207411167 end=209715167
Extending /dev/sda3 succeeded.
Device /dev/sda3 extended successfully.
Logical volume /dev/ocivolume/root extended successfully.
oci-iscsi-config
Description
Lists and configures iSCSI devices attached to a compute instance. When run without any command line options, oci-iscsi-config
lists devices that need attention.
For a training video that demonstrates how to use the oci-iscsi-config
utility, see Using OCI Utilities for Managing iSCSI Storage for Oracle Cloud Infrastructure Instances in the Oracle Linux Training Station.
Avoid entering confidential information when assigning descriptions, tags, or friendly names to your cloud resources through the Oracle Cloud Infrastructure Console, API, or CLI.
Usage
- oci-iscsi-config
oci-iscsi-config [-h | --help]
- oci-iscsi-config sync
oci-iscsi-config sync [-a | --apply] [-y | --yes] [-h | --help]
- oci-iscsi-config show
oci-iscsi-config show [-C | --compartments compartment_name] [-A | --all] [--output-mode mode] [--details] [--no-truncate] [-h | --help]
- oci-iscsi-config create
oci-iscsi-config create [-S | --size size] [-v | --volume-name volume_name] [--attach-volume] [-c | --chap] [-h | --help]
- oci-iscsi-config attach
oci-iscsi-config attach [-I | --iqns IQNS] [-u | --username username] [-p | --password password] [-c | --chap] [-h | --help]
- oci-iscsi-config detach
oci-iscsi-config detach [-I | --iqns IQNS] [-f | --force] [-h | --help]
- oci-iscsi-config destroy
oci-iscsi-config destroy [-O | --ocids OCIDS] [-y | --yes] [-h | --help]
Options
- oci-iscsi-config sync
sync
- oci-iscsi-config show
show
- oci-iscsi-config create
create
- oci-iscsi-config attach
attach
- oci-iscsi-config detach
detach
- oci-iscsi-config destroy
destroy
Examples
- Displaying iSCSI Configurations
-
The
oci-iscsi-config
utility works with theocid
daemon to monitor device creation and deletion through the Oracle Cloud Infrastructure Console, CLI, or the API and automatically discover those changes. You can use theoci-iscsi-config show
option to display a list of all devices attached to an instance.The following example shows the output of the
oci-iscsi-config show
option after adding a 50-GB block volume using the Console:$ oci-iscsi-config show Currently attached iSCSI devices: Volume name |Attached device| Size | -------------------------------------------------------- mor-demo-bv20 | sdb | 50G | Block volumes information: Name | Size | Attached to | OCID | ---------------------------------------------------------------------------------------------------------- mor-demo-bv30 | 50GB | - |ocid1.volume.oc1.exampleuniqueID|
The following example shows the output of
oci-iscsi-config show
with the--details
and--no-truncate
options:$ oci-iscsi-config show --details --no-truncate Currently attached iSCSI devices: Target | Volume name | Volume OCID | Persistent portal | Current portal |Session State|Attached device| Size | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- iqn.2015-12.com.oracleiaas:exampleuniqueID| mor-demo-bv20 |ocid1.volume.oc1.iad.exampleuniqueID| 172.16.10.4:3260 | 172.16.10.4:3260 | LOGGED_IN | sdb | 50G | Block volumes information: Name | Size | Attached to | OCID | IQN | Compartment |Availability domain| ------------------------------------------------------------------------------------------------------------------------------------------------------------ mor-demo-bv30 | 50GB | - |ocid1.volume.oc1.iad.exampleuniqueID| - | virtdoc.dev |DSdu:US-ASHBURN-AD-3|
By default, theoci-iscsi-config show
sub-command lists the output in a tabular presentation. You can change the output presentation by using the--output-mode mode
option. For example, the following example shows the output ofoci-iscsi-config show
using--output-mode text
option to display the output in a textual presentation.$ oci-iscsi-config show --output-mode text Currently attached iSCSI devices Volume name: mor-demo-bv20 Attached device: sdb Size: 50G Block volumes information Name: mor-demo-bv30 Size: 50GB Attached to: - OCID: ocid1.volume.oc1.iad..exampleuniqueID
- Creating and Attaching a Volume
-
The following example shows how to create and attach a volume:
$ sudo oci-iscsi-config create -S 70 --volume name=mor-demo-by70 --attach-volume Creating a new 70 GB volume Volume name=mor-demo-by70 created Attaching the volume to this instance Attaching iSCSI device iscsiadm attach Result: command executed successfully
- Detaching a Volume
-
The following example shows how to detach a volume:
$ sudo oci-iscsi-config detach -I iqn.2015-12.com.oracleiaas:exampleuniqueID Detaching volume mor-demo-bv70 (iqn.2015-12.com.oracleiaas:exampleuniqueID) Volume [iqn.2015-12.com.oracleiaas:oracleiaas:exampleuniqueID] is detached Updating detached volume cache file: ['iqn.2015-12.com.oracleiaas:oracleiaas:exampleuniqueID']
- Deleting a Volume
-
The following example shows how to delete a volume:
$ sudo oci-iscsi-config destroy -O ocid1.volume.oc1.exampleuniqueID WARNING: the volume(s) will be destroyed. This is irreversible. Continue? y Volume [ocid1.volume.oc1.iad.exampleuniqueID] is destroyed
oci-metadata
Description
Displays or sets metadata for a compute instance. When run without any command line options, oci-metadata
lists all available metadata.
For more information about instance metadata, see Getting Instance Metadata.
Usage
oci-metadata [-h | --human-readable] [-j | --json] [-g | --get key] [--export] [--trim] [--value-only] [-u key_value] [-i | --instance-id OCID] [--help]
Options
-h | --human-readable
-
Display human readable output (default).
-j | --json
-
Display output in JSON.
-g key | --get key
-
Retrieve data only for the specified key.
--export
-
Used with the
-g
or--get
option, display a shell command to export the key as an environment variable. --trim
-
Used with the
-g
or--get
option, trim the key path to the last component to make the output more concise; for example,instance/metadata/ssh_authorized_keys
tossh_authorized_keys
. If the key matches multiple keys, only the first matching key is displayed. --value-only
-
Used with the
-g
or--get
option, display only the values matching the get key. -u key_value
-
Update the value for the given key (or keys). For key_value, specify a string, a JSON value, or a pointer to a file with JSON content in the following format:
key=file:/path/to/file
-i | --instance-id OCID
-
Get or update the metadata of the instance with the given OCID. By default,
oci-metadata
works with the metadata from the instance that you logged in to. --help
-
Display a summary of the command line options.
Examples
- Getting all metadata for the instance
-
Running
oci-metadata
with no options returns all metadata for the instance:$ oci-metadata Instance details: Display Name: my-example-instance Region: phx - us-phoenix-1 (Phoenix, AZ, USA) Canonical Region Name: us-phoenix-1 Availability Domain: cumS:PHX-AD-1 Fault domain: FAULT-DOMAIN-3 OCID: ocid1.instance.oc1.phx.exampleuniqueID Compartment OCID: ocid.compartment.oc1..exampleuniqueID Instance shape: VM.Standard2.1 Image ID: ocid1.image.oc1.phx.exampleuniqueID Created at: 1569529065596 state: Running agentConfig: managementDisabled: False monitoringDisabled: False Instance Metadata: ssh_authorized_keys: example-key Networking details: VNIC OCID: ocid1.vnic.oc1.phx.exampleuniqueID VLAN Tag: 2392 Private IP address: 10.0.0.16 MAC address: 02:00:17:03:D8:FE Subnet CIDR block: 10.0.0.0/24 Virtual router IP address: 10.0.0.1
- Getting only specific metadata
-
The following example shows how to retrieve metadata for a specified key by using the
--get
parameter:# oci-metadata --get state Instance details: Instance state: Running
oci-network-config
Description
Configures network interfaces for a compute instance.
The oci-network-config
utility shows the current virtual network interface cards (VNICs) provisioned in Oracle Cloud Infrastructure and configured for this instance. When a secondary VNIC is provisioned in Oracle Cloud Infrastructure it must be explicitly configured on the instance using the oci-network-config
utility.
By default the oci-network-config
sub-command displays the currently provisioned VNICs and the current IP configuration for this instance. VNICs that are not yet configured are marked with ADD
and IP configurations that no longer have an associated VNIC are marked with DELETE
.
The oci-network-config configure
sub-command configures VNICs that do not have an IP configuration and deletes the IP configurations of VNICs that are not currently provisioned. This command synchronizes the instance IP configuration with the current Oracle Cloud Infrastructure provisioning.
The interfaces that are being configured can be placed inside separate network namespaces. This separation is necessary when VNICs are in subnets (different VCNs) with overlapping address blocks and the network applications are not bound directly to the interfaces. Network namespaces require applications to be launched in them explicitly (with the ip netns exec ns
command) to establish association with the interface. When namespaces are not used, policy-based routing is configured to provide a default route to the secondary VNIC´s virtual router (default gateway) when the VNIC´s address is the source address.
Bare metal secondary VNICs are configured using VLANs (where there is no corresponding physical interface). These VNICs appear as two additional interfaces when showing IP links, with names in MACVLAN_FORMAT
for the MAC VLAN and VLAN_FORMAT
for the IP VLAN.
The oci-network-config unconfigure
sub-command deletes all IP configuration for provisioned secondary VNICs (except the ones explicitly excluded).
The oci-network-config attach-vnic
sub-command creates and attaches the new VNIC to the instance. This command can be used to assign a public or private IP address to the new VNIC.
The oci-network-config detach-vnic
sub-command detaches a VNIC from the instance. This command can be used to remove the assigned IP address from an existing VNIC.
The oci-network-config add-secondary-addr
sub-command adds a secondary private IP address with the specified IPv4 or IPv6 address to an existing VNIC.
The oci-network-config remove-secondary-addr
sub-command removes a secondary private IP address with the specified IPv4 or IPv6 address from an existing VNIC.
For a training video that demonstrates how to use the oci-network-config
utility, see Network Interface Management Using OCI Utilities on Oracle Linux Instances in the Oracle Linux Training Station.
Usage
- oci-network-conf
oci-network-config [-q | --quiet] [-h | --help]
- oci-network-config show
oci-network-config show [--output-mode mode] [--details] [--ocid VNIC_OCID] [--name VNIC_name] [--ip-address primary_ip] [--no-truncate] [-h | --help]
- oci-network-config show-vnics
oci-network-config show-vnics [--output-mode mode] [--details] [--ocid VNIC_OCID] [--name VNIC_name] [--ip-address primary_ip] [--no-truncate] [-h | --help]
- oci-network-config show-vnics-all
oci-network-config show-vnics-all [--output-mode mode] [-h | --help]
- oci-network-config show-vcns
oci-network-config show-vcns [-I | --include item] [-X | --exclude item] [--output-mode mode] [--details] [--no-truncate] [-h | --help]
- oci-network-config show-subnets
oci-network-config show-subnets [--output-mode mode] [--details] [--ocid SUBNET_OCID] [--name SUBNET_name] [--ip-address primary_ip] [--no-truncate] [-h | --help]
- oci-network-config configure
oci-network-config configure [-n | --namespace format] [-r | --start-sshd] [-I | --include item] [-X | --exclude item] [-h | --help]
- oci-network-config unconfigure
oci-network-config unconfigure [-I | --include item] [-X | --exclude item] [-h | --help]
- oci-network-config attach-vnic
oci-network-config attach-vnic [-I | --ip-address ip_address] [-ipv4 | --ipv4] [-ipv6 | --ipv6] [-i | --nic-index index] [--subnet subnet] [-n | --name name] [--assign-public-ip] [-h | --help]
- oci-network-config detach-vnic
oci-network-config detach-vnic [-I | --ip-address ip_address] [--ocid OCID] [-h | --help]
- oci-network-config add-secondary-addr
oci-network-config add-secondary-addr [-ipv4 | --ipv4] [-ipv6 | --ipv6] [-I | --ip-address ip_address] [--ocid OCID] [-h | --help]
- oci-network-config remove-secondary-addr
oci-network-config remove-secondary-addr [-I | --ip-address ip_address] [-h | --help]
Options
- oci-network-config show
show
- oci-network-config show-vnics
show-vnics
- oci-network-config show-vnics-all
show-vnics-all
- oci-network-config show-vcns
show-vcns
- oci-network-config show-subnets
show-subnets
- oci-network-config configure
configure
- oci-network-config unconfigure
unconfigure
- oci-network-config attach-vnic
attach-vnic
- oci-network-config detach-vnic
detach-vnic
- oci-network-config add-secondary-addr
add-secondary-addr
- oci-network-config remove-secondary-addr
remove-secondary-addr
Examples
- Creating a VNIC
-
This example shows how to create a VNIC named ex-demo-inst-10 and attaches it to the instance:
$ sudo oci-network-config attach-vnic -n ex-demo-inst-10 creating VNIC: 10.102.119.140
Running
oci-network-config show
with the--details
option shows information for the new VNIC:$ sudo oci-network-config show --details Network configuration: State | Link |Status| Ip address | VNIC | MAC | Hostname | Subnet | Router IP |Namespace |Index|VLAN tag| VLAN | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - | ens3 | UP |10.102.118.251 | mor-demoinst-10 |02:00:17:02:C6:B2| mor-demoinst-10 | 10.102.112.0/20 (common.sub) | 10.102.112.1 | - | 2 | 3814 | - | ADD | ens5 | DOWN |10.102.119.140 | ex-demo-inst-10 |00:00:17:02:CC:CB|mor-demoinst-10-ex-dem...| 10.102.112.0/20 (common.sub) | 10.102.112.1 | - | 7 | 3387 | - |
Running
oci-network-config show-vnics
shows information about VNICs configured on the instance:$ sudo oci-network-config show-vnics VNIs Information: Name | Private IP | OCID | MAC | -------------------------------------------------------------------------------------------------------------------------------------------------------------- ex-demo-inst-10 |10.102.119.140| ocid1.vnic.oc1.iad.exampleuniqueID |00:00:17:02:CC:CB| mor-demoinst-10 |10.102.118.251| ocid1.vnic.oc1.iad.exampleuniqueID |02:00:17:02:C6:B2|
- Adding a secondary IPv6 address
-
The following example shows how to add a private secondary IPv6 address to an existing VNIC:
$ sudo oci-network-config add-secondary-addr --ipv6 -O ocid1.vnic.oc1.iad.exampleuniqueID Provisioning secondary private IPv6: 2603:c020:c003:3a10:b64c:8f35:7f9e:7e87 IP 2603:c020:c003:3a10:b64c:8f35:7f9e:7e87 has been assigned to vnic ocid1.vnic.oc1.iad.exampleuniqueID
- Deleting the IP configuration for provisioned secondary VNICs
-
The following examples shows how to delete all IP configuration for provisioned secondary VNICs:
$ sudo oci-network-config unconfigure Unconfigured
- Removing a secondary IPv6 address
-
The following example shows how to remove a private secondary IPv6 address from an existing VNIC:
$ sudo oci-network-config remove-secondary-addr -I 2603:c020:c003:3a10:b64c:8f35:7f9e:7e87 Deconfigure secondary private IP 2603:c020:c003:3a10:b64c:8f35:7f9e:7e87
- Detaching a VNIC
-
The following example shows how to detach the given VNIC:
$ sudo oci-network-config detach-vnic -O ocid1.vnic.oc1.iad.exampleuniqueID Detaching VNIC 10.2.10.121 [ocid1.vnic.oc1.iad.exampleuniqueID] VNIC [ocid1.vnic.oc1.iad.exampleuniqueID] is detached.
- Displaying VCN information
-
Running
oci-network-config show-vcns
with the--details
option shows detailed VCN information in table output format:$ sudo oci-network-config show-vcns --details Virtual Cloud Network Information: Name | IPv4 cidr block | IPv6 cidr block | OCID | IPv4 cidr blocks | DNS label | State | Lifecycle state | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- hostname_uk_ref | 10.253.0.0/16 | 2603:c020:c007:9f... | ocid1.vcn.oc1..example_OCID... | 10.253.0.0/16 | gtijske... | AVAILABLE | AVAILABLE | hostname_uk_01 | 10.0.0.0/16 | 2603:c020:c003:6c... | ocid1.vcn.oc1..example_OCID... | 10.0.0.0/16 | gtijske... | AVAILABLE | AVAILABLE | hostname_uk_02 | 10.2.0.0/16 | 2603:c020:c003:3a... | ocid1.vcn.oc1..example_OCID... | 10.2.0.0/16 | gtijske... | AVAILABLE | AVAILABLE |
- Displaying subnet information
-
Running
oci-network-config show-vcns
with the--details
and--output-mode json
options shows detailed subnet information in table output format:$ sudo oci-network-config show-subnets --details --output-mode json [ { "Name": "Public Subnet-hostname_uk_01", "ipv4 cidr block": "10.0.0.0/24", "ipv6 cidr block": "2603:c020:c003:6c00::/64", "OCID": "ocid1.subnet.oc1..example_OCID", "VCN name": "hostname_uk_01", "VCN ocid": "ocid1.vcn.oc1..example_OCID", "Public": true, "Public ingress": true, "DNS label": "sub06230933270", "Domain name": "sub06230933270.gtijskenuk01.oraclevcn.com", "Lifecycle state": "AVAILABLE" }, { "Name": "hostname_uk_ref_02", "ipv4 cidr block": "10.253.20.0/24", "ipv6 cidr block": "2603:c020:c007:9f20::/64", "OCID": "ocid1.subnet.oc1..example_OCID", "VCN name": "hostname_uk_ref", "VCN ocid": "ocid1.vcn.oc1..example_OCID", "Public": true, "Public ingress": true, "DNS label": "gtijskenukref02", "Domain name": "gtijskenukref02.gtijskenukref.oraclevcn.com", "Lifecycle state": "AVAILABLE" }, { "Name": "hostname_uk_ref_01", "ipv4 cidr block": "10.253.10.0/24", "ipv6 cidr block": "2603:c020:c007:9f10::/64", "OCID": "ocid1.subnet.oc1..example_OCID", "VCN name": "hostname_uk_ref", "VCN ocid": "ocid1.vcn.oc1..example_OCID", "Public": true, "Public ingress": true, "DNS label": "gtijskenukref01", "Domain name": "gtijskenukref01.gtijskenukref.oraclevcn.com", "Lifecycle state": "AVAILABLE" }, ]
- Displaying VNIC information
-
The following example shows how to display VNIC information:
# oci-network-config show-vnics Virtual Network Interface Information: Name | Private IP | MAC | Config | ---------------------------------------------------------------- vnic20220912090629 | 10.2.10... | 02:00:17:01:A9:0E | ADD | hostname_ipv6_01 | 10.2.20... | 02:00:17:01:30:D5 | - |
Running
oci-network-config
with theshow-vnics-all
option shows detailed information about VNICs configured on this instance, including OCID information, in table output format:# oci-network-config show-vnics-all Virtual Network Interface Information: Name | Private IP | MAC | Config | OCID | Primary | Subnet | Subnet cidr | State | NIC | Public IP | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- hostname_ipv6_01 | 10.2.20.254 | 02:00:17:01:30:D5 | - | ocid1.vnic.oc1.iad.exampleuniqueID | True | hostname_uk02_02 | 10.2.20.0/24 | AVAILABLE-ATTACHED | - | 140.238.76.113 | IP address details Private IP | OCID | ---------------------------------------------------------------------------------------------------------------------------------------- 10.2.20.254 | ocid1.privateip.oc1.iad.exampleuniqueID | vnic20220912090629 | 10.2.10.121 | 02:00:17:01:A9:0E | - | ocid1.vnic.oc1.iad.exampleuniqueID | - | hostname_uk02_01 | 10.2.10.0/24 | AVAILABLE-ATTACHED | - | - | IP address details Private IP | OCID | ---------------------------------------------------------------------------------------------------------------------------------------- 10.2.10.121 | ocid1.privateip.oc1.iad.exampleuniqueID | 2603:c020:c003:3a10:b64c:8f35:7f9e:7e87 | ocid1.ipv6.oc1.iad.exampleuniqueID |
Running
oci-network-config
with theshow-vnics-all
and--output-mode json
options shows detailed information about VNICs configured on this instance, including OCID information, in JSON output format:# oci-network-config show-vnics-all --output-mode json [ { "Private IP": "10.2.10.121", "OCID": "ocid1.privateip.oc1.iad.exampleuniqueID" }, { "Private IP": "2603:c020:c003:3a10:b64c:8f35:7f9e:7e87", "OCID": "ocid1.ipv6.oc1.iad.exampleuniqueID" } ] [ { "Private IP": "10.2.20.254", "OCID": "ocid1.privateip.oc1.iad.exampleuniqueID" } ] [ { "Name": "vnic20220912090629", "Private IP": "10.2.10.121", "MAC": "02:00:17:01:A9:0E", "Config": "-", "OCID": "ocid1.vnic.oc1.iad.exampleuniqueID", "Primary": "-", "Subnet": "hostname_uk02_01", "Subnet OCID": "ocid1.subnet.oc1.iad.exampleuniqueID", "Subnet cidr": "10.2.10.0/24", "State": "AVAILABLE-ATTACHED", "NIC": "-", "Public IP": "-" }, { "Name": "hostname_ipv6_01", "Private IP": "10.2.20.254", "MAC": "02:00:17:01:30:D5", "Config": "-", "OCID": "ocid1.vnic.oc1.iad.exampleuniqueID", "Primary": true, "Subnet": "hostname_uk02_02", "Subnet OCID": "ocid1.subnet.oc1.iad.exampleuniqueID", "Subnet cidr": "10.2.20.0/24", "State": "AVAILABLE-ATTACHED", "NIC": "-", "Public IP": "140.238.76.113" } ]
- Displaying current network configuration
-
Running
oci-network-config show
shows the current network configuration:$ sudo oci-network-config show Network configuration State | Link | Status | IP address | VNIC | MAC | ------------------------------------------------------------------------------ - | ens3 | UP | 10.2.20.254 | hostname_ipv6_01 | 02:00:17:01:30:D5 | ADD | ens4 | UP | 10.2.10.121 | vnic20220912090629 | 02:00:17:01:A9:0E | Operating System level network configuration: CONFIG ADDR SUBNET BITS VIRTROUTER NS IND IFACE VLTAG VLAN STATE MAC VNIC ID ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - 10.2.20.254 10.2.20.0 24 10.2.20.1 - 2 ens3 3181 - UP 02:00:17:01:30:D5 ocid1.vnic.oc1.uk-london-1.abwgiljsbgpykyfuerbpgtzav55uq7rpybtycfiz7jfjpoed6kr2zv6rfzeq ADD 10.2.10.121 10.2.10.0 24 10.2.10.1 - 3 ens4 1435 - UP 02:00:17:01:A9:0E ocid1.vnic.oc1.uk-london-1.abwgiljse55dm7amoc322htbjgzgcqdqtx3t6khy573ds7m6jkou2vduqtoq
oci-network-inspector
Description
Displays a detailed network report for a given compartment or network.
Usage
oci-network-inspector [-C | --compartment OCID] [-N | --vcn OCID] [-h | --help]
Options
-C | --compartment OCID
-
Show report for the specified compartment.
-N | --vcn OCID
-
Show report for the specified virtual cloud network (VCN).
-h | --help
-
Display a summary of the command line options.
Examples
- Displaying a detailed report for a specified VCN
-
Running the
oci-network-inspector
command and specifying an OCID with the-N
parameter returns a detailed network report for that VCN:$ oci-network-inspector -N ocid1.compartment.oc1..example_OCID Compartment: KVM_workspace (ocid1.compartment.oc1..example_OCID) vcn : uk_02 (ocid1.vcn.oc1..example_OCID) Security List: Default Security List for uk_02 Ingress: tcp 0.0.0.0/0:- ---:22 Ingress: icmp 0.0.0.0/0:- code-4:type-3 Ingress: icmp 10.2.0.0/16:- code-None:type-3 Ingress: tcp ::/0:- ---:22 Ingress: 58 ::/0:- ---:- Egress : all ---:- 0.0.0.0/0:- Egress : all ---:- ::/0:- Subnet : uk02_02 (ocid1.subnet.oc1..example_OCID) ipv4 cidr block : 10.2.20.0/24 ipv6 cidr block : 2603:c020:c003:3a20::/64 DNS domain name : gtijskenuk0202.gtijskenuk02.oraclevcn.com Security List: Default Security List for uk_02 Ingress: tcp 0.0.0.0/0:- ---:22 Ingress: icmp 0.0.0.0/0:- code-4:type-3 Ingress: icmp 10.2.0.0/16:- code-None:type-3 Ingress: tcp ::/0:- ---:22 Ingress: 58 ::/0:- ---:- Egress : all ---:- 0.0.0.0/0:- Egress : all ---:- ::/0:- Private IP : 10.2.20.42(primary) Host: gtijsken-amd-kvm-lon-flex3-vnicb752 Vnic : ocid1.vnic.oc1..example_OCID (AVAILABLE-ATTACHED) Vnic PublicIP : None Instance : amd_kvm_lon_flex3 Instance State : RUNNING Instance ocid : ocid1.instance.oc1..example_OCID Private IP : 10.2.20.102(primary) Host: gtijsken-amd-kvm-lon-flex4 Vnic : ocid1.vnic.vnic.oc1..example_OCID (AVAILABLE-ATTACHED) Vnic PublicIP : 132.145.70.219 Instance : amd_kvm_lon_flex4 Instance State : RUNNING Instance ocid : ocid1.instance.oc1..example_OCID Private IP : 10.2.20.104(primary) Host: gtijsken-amd-kvm-lon-flex4-vnic4df2 Vnic : ocid1.vnic.vnic.oc1..example_OCID (AVAILABLE-ATTACHED) Vnic PublicIP : None Instance : amd_kvm_lon_flex4 Instance State : RUNNING Instance ocid : ocid1.instance.oc1..example_OCID Private IP : 10.2.20.213(primary) Host: gtijsken-amd-kvm-lon-flex3-vnicc1f4 Vnic : ocid1.vnic.oc1..example_OCID (AVAILABLE-ATTACHED) Vnic PublicIP : None Instance : amd_kvm_lon_flex3 Instance State : RUNNING Instance ocid : ocid1.instance.oc1..example_OCID Private IP : 10.2.20.254(primary) Host: gtijsken-ipv6-01 Vnic : ocid1.vnic.oc1..example_OCID (AVAILABLE-ATTACHED) Vnic PublicIP : 140.238.76.113 Instance : ipv6_01 Instance State : RUNNING Instance ocid : ocid1.instance.oc1..example_OCID Subnet : uk02_01 (ocid1.subnet.oc1..example_OCID ipv4 cidr block : 10.2.10.0/24 ipv6 cidr block : 2603:c020:c003:3a10::/64 DNS domain name : gtijskenuk0201.gtijskenuk02.oraclevcn.com Security List: Default Security List for uk_02 Ingress: tcp 0.0.0.0/0:- ---:22 Ingress: icmp 0.0.0.0/0:- code-4:type-3 Ingress: icmp 10.2.0.0/16:- code-None:type-3 Ingress: tcp ::/0:- ---:22 Ingress: 58 ::/0:- ---:- Egress : all ---:- 0.0.0.0/0:- Egress : all ---:- ::/0:-
- Displaying a detailed report for a specified compartment
-
Running the
oci-network-inspector
command and specifying an OCID with the-C
parameter returns a detailed network report for that compartment:$ oci-network-inspector -C ocid1.compartment.oc1..example_OCID Compartment: scottb_sandbox (ocid1.compartment.oc1..example_OCID) vcn: scottb_vcn Security List: Default Security List for scottb_vcn Ingress: tcp 0.0.0.0/0:- ---:22 Ingress: icmp 0.0.0.0/0:- code-4:type-3 Ingress: icmp 10.0.0.0/16:- code-None:type-3 Ingress: tcp 0.0.0.0/0:80 ---:80 Ingress: tcp 0.0.0.0/0:43 ---:43 Ingress: tcp 0.0.0.0/0:- ---:- Egress : all ---:- 0.0.0.0/0:- Subnet: Public Subnet cumS:PHX-AD-3 Avalibility domain: cumS:PHX-AD-3 Cidr_block: 10.0.2.0/24 Domain name: sub99999999999.scottbvcn.oraclevcn.com Security List: Default Security List for scottb_vcn Ingress: tcp 0.0.0.0/0:- ---:22 Ingress: icmp 0.0.0.0/0:- code-4:type-3 Ingress: icmp 10.0.0.0/16:- code-None:type-3 Ingress: tcp 0.0.0.0/0:80 ---:80 Ingress: tcp 0.0.0.0/0:43 ---:43 Ingress: tcp 0.0.0.0/0:- ---:- Egress : all ---:- 0.0.0.0/0:- Subnet: Public Subnet cumS:PHX-AD-2 Avalibility domain: cumS:PHX-AD-2 Cidr_block: 10.0.1.0/24 Domain name: sub99999999998.scottbvcn.oraclevcn.com Security List: Default Security List for scottb_vcn Ingress: tcp 0.0.0.0/0:- ---:22 Ingress: icmp 0.0.0.0/0:- code-4:type-3 Ingress: icmp 10.0.0.0/16:- code-None:type-3 Ingress: tcp 0.0.0.0/0:80 ---:80 Ingress: tcp 0.0.0.0/0:43 ---:43 Ingress: tcp 0.0.0.0/0:- ---:- Egress : all ---:- 0.0.0.0/0:- Subnet: Public Subnet cumS:PHX-AD-1 Avalibility domain: cumS:PHX-AD-1 Cidr_block: 10.0.0.0/24 Domain name: sub99999999997.scottbvcn.oraclevcn.com Security List: Default Security List for scottb_vcn Ingress: tcp 0.0.0.0/0:- ---:22 Ingress: icmp 0.0.0.0/0:- code-4:type-3 Ingress: icmp 10.0.0.0/16:- code-None:type-3 Ingress: tcp 0.0.0.0/0:80 ---:80 Ingress: tcp 0.0.0.0/0:43 ---:43 Ingress: tcp 0.0.0.0/0:- ---:- Egress : all ---:- 0.0.0.0/0:- Private IP: 10.0.0.2(primary) Host: instance-20180608-1230 Vnic: ocid1.vnic.oc1..example_OCID (AVAILABLE-ATTACHED) Vnic PublicIP: 203.0.113.2 Instance: instance-20180608-1230(STOPPED) Private IP: 10.0.0.3(primary) Host: scottb-instance-20180622-1222 Vnic: ocid1.vnic.oc1.oc1..example_OCID (AVAILABLE-ATTACHED) Vnic PublicIP: 203.0.113.3 Instance: scottb-instance-20180622-1222(RUNNING)
oci-notify
Description
Sends a message to a Notifications service topic. This command must be run as root.
A message is composed of a message header (title) and file. The Notifications service configuration for the topic determines where and how the messages are delivered. Topics are configured using the Oracle Cloud Infrastructure Console, API, or CLI.
For more information about the Notifications service, including how to create topics, see Notifications Overview.
Usage
- oci-notify config
oci-notify config notifications_topic_OCID [-h | --help]
- oci-notify message
oci-notify message [-t | --topic message_title] [-f | --file message_file] [-h | --help]
Options
- oci-notify config
-
Write the topic to the
/etc/oci-utils/oci.conf
file. The path to the configuration file can be overridden by usingOCI_CONFIG_DIR
environment variable. - oci-notify message
- Publish the contents of the specified file with the specified title to the configured topic.
Examples
- Configuring a topic on an instance
-
The following example shows how to write the OCID of a configured Notifications service topic to the
oci.conf
file. After configured, you can publish messages to the configured topic.$ sudo oci-notify config ocid1.onstopic.oc1..example_OCID
- Publishing a message to a topic
-
The following example shows how to send the contents of the
/var/log/messages
file with the title'logging messages'
to the configured topic:$ sudo oci-notify message --title 'logging messages' --file /var/log/messages
The following example shows how to send the contents of the
/proc/meminfo
file with the title'memory information'
to the configured topic:$ sudo oci-notify message --title 'memory information' --file /proc/meminfo
The following example shows how to send a text string to the configured topic:
$ sudo oci-notify message --title 'sending a text' --file 'Today is a beautiful day'
oci-public-ip
Description
Displays the public IP address of the current system in either human-readable or JSON format.
The oci-public-ip
utility uses the Oracle Cloud Infrastructure SDK to discover the IP address. If the IP address cannot be obtained through this method, the oci-public-ip
utility then tries the Session Traversal Utilities for NAT (STUN) protocol as a last resort to discover the IP address. For more information on STUN, see the STUN Wikepedia article.
Usage
oci-public-ip [-h | --human-readable] [-j | --json] [-g | --get] [-a | --all] [-s | --sourceip source_IP] [-S | --stun-server STUN_server] [-L | --list-servers] [--instance-id OCID] [--help]
Options
-h | --human-readable
-
Display human readable output (default).
-j | --json
-
Display output in JSON.
-g | get
-
Print the IP address only.
-a | all
-
Display all public IP addresses.
-s | --sourceip source_IP
-
Specify the source IP address to use.
-S | --stun-server STUN_server
-
Specify the STUN server to use.
-L | --list-servers
-
Print a list of known STUN servers and exit.
--instance-id OCID
-
Display the public IP address of the given instance instead of the current one. Requires the Oracle Cloud Infrastructure SDK for Python to be installed and configured.
--help
-
Display a summary of the command line options.
Examples
- Displaying current IP address
-
Running the
oci-public-ip
command with no options returns the IP address of the current instance:$ oci-public-ip Public IP address: 203.0.113.2
- Displaying the IP address of another instance
-
You can pass in the OCID of a running instance with the
--instance-id
option to return the IP address for that instance:$ oci-public-ip --instance-id ocid1.instance.oc1.phx.example_OCID Public IP address: 203.0.113.2
- Listing STUN servers
-
Use the
--list-servers
option to return a list of STUN servers:$ oci-public-ip --list-servers stun.stunprotocol.org stun.counterpath.net stun.voxgratia.org stun.callwithus.com stun.ekiga.net stun.ideasip.com stun.voipbuster.com stun.voiparound.com stun.voipstunt.com
OCI Utilities Summary
A summary of the OCI utilities components.
Name | Description |
---|---|
ocid
|
The service component of oci-utils , which runs as a daemon started by systemd . This service scans for changes in the iSCSI and VNIC device configurations and caches the OCI metadata and public IP address of the instance. |
oci-growfs
|
Expands the root file system of the instance to its configured size. |
oci-iscsi-config
|
Lists or configures iSCSI devices attached to a compute instance. If no command line options are specified, lists devices that need attention. |
oci-metadata
|
Displays metadata for the compute instance. If no command line options are specified, lists all available metadata. Metadata includes the instance OCID, display name, compartment, shape, region, availability domain, creation date, state, image, and any custom metadata that you provide, such as an SSH public key. |
oci-network-config
|
Lists or configures virtual network interface cards (VNICs) attached to the compute instance. When a secondary VNIC is provisioned in the cloud, it must be explicitly configured on the instance using this script or similar commands. |
oci-network-inspector
|
Displays a detailed report for a given compartment or network. |
oci-notify |
Sends a message to a Notification service topic. |
oci-public-ip
|
Displays the public IP address of the current system in either human-readable or JSON format. |