Oracle Cloud Infrastructure Documentation

oci-public-ip

Description

Displays the public IP address of the current system in either human-readable or JSON format.

If the Oracle Cloud Infrastructure SDK is installed, the oci-public-ip utility uses the Oracle Cloud Infrastructure API to discover the IP address.

If the Oracle Cloud Infrastructure SDK is not installed, the oci-public-ip utility uses the STUN (Session Traversal Utilities for NAT) protocol to discover IP address. For more information on STUN, see the STUN Wikipedia article.

Usage

oci-public-ip [-h] [-j] [-g] [-s source_IP] [-S STUN_server]

[-L] [--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.

-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 Python SDK to be installed and configured.

--help

Displays 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: 128.0.0.1

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.abcdefg12345678
		Public IP address: 128.0.0.4

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