デュアルスタックエンドポイントと IPv6のサポート

デュアルスタック・エンドポイントを使用して、IPv6を使用するネットワークからObject Storageにアクセスし、IPv4もサポートできます。

デュアルスタック・エンドポイントでは、IPv6とIPv4の両方がサポートされるため、同じホスト名をいずれかのアドレス・ファミリに解決できます。

デュアルスタック・エンドポイントでは、専用エンドポイント形式が使用されます。

エンドポイントの作成

デュアルスタック・エンドポイントでは、テナントの分離とセキュリティを向上させるために、専用エンドポイント形式を使用します。関連項目: オブジェクト・ストレージ専用エンドポイント

次の表に、デュアルスタック専用エンドポイントを構築する方法を示します。テナンシのネームスペースは、ホスト名および適用可能なリージョンに接頭辞として含めます。

API IPv4専用エンドポイント デュアルスタック・エンドポイント
V2 objectstorage.{region}.oraclecloud.com {MyNamespace}.objectstorage.{region}.ds.oci.customer-oci.com
Swift swiftobjectstorage.{region}.oraclecloud.com {MyNamespace}.swiftobjectstorage.{region}.ds.oci.customer-oci.com
S3 {MyNamespace}.compat.objectstorage.{region}.oraclecloud.com {MyNamespace}.compat.objectstorage.{region}.ds.oci.customer-oci.com
重要

OC1商用レルムでは、IPv6アドレスとIPv4アドレスの両方をサポートできるのは、ds.oci.customer-oci.com形式を使用する専用エンドポイントのみです。従来のoraclecloud.comエンドポイントでは、引き続きIPv4アドレスのみがサポートされます。
ノート

仮想ホスト・スタイルのURLおよびプライベート・エンドポイントは、デュアルスタック・エンドポイントおよびIPv6ではサポートされていません。IPv4でのみサポートされています。詳細は、次を参照してください:

APIでのデュアルスタック・エンドポイントの使用(REST)

REST APIは、エンドポイント名(URI)を使用してオブジェクト・ストレージ・エンドポイントに直接アクセスできます。

SDKでのデュアルスタック・エンドポイントの使用

SDKベースのクライアントでデュアルスタック・エンドポイントを有効化するには、環境変数を設定するか、クライアントでデュアルスタック動作を有効化します(サポートされている場合)。

OCI Python SDK (オブジェクト・ストレージ)

Pythonバージョン2.165.0以降:

  • 環境変数:セッションでOCI_DUAL_STACK_ENDPOINT_ENABLED=trueを設定します。
  • クライアント設定: client_level_dualstack_endpoints_enabled = Trueおよびclient_level_realm_specific_endpoint_template_enabled = Trueを設定して、オブジェクト・ストレージ・リクエストをリージョンのデュアルスタック・エンドポイントに送信します。

例:

Python

import os
import oci

config = oci.config.from_file()
compartment_id = config["tenancy"]
os.environ["OCI_DUAL_STACK_ENDPOINT_ENABLED"] = "True"
object_storage = oci.object_storage.ObjectStorageClient(config,
                                                        client_level_dualstack_endpoints_enabled=True,
                                                        client_level_realm_specific_endpoint_template_enabled=True)
print("endpoint: ", object_storage.base_client.endpoint)
namespace = object_storage.get_namespace().data
print("namespace: ", namespace)

OCI Java SDK(オブジェクト・ストレージ)

Javaバージョン3.80.1以降:

  • クライアント設定: enableDualStackEndpoints(true)およびuseRealmSpecificEndpointTemplate(true)を設定して、オブジェクト・ストレージ・リクエストをリージョンのデュアルスタック・エンドポイントに送信します。例:

Java

public class EnableDualStackEndpointsExample {
    public static void main(String[] args) throws Exception {
        String configurationFilePath = "~/.oci/config";
        String profile = "DEFAULT";
        // Configuring the AuthenticationDetailsProvider. It's assuming there is a default OCI
        // config file
        // "~/.oci/config", and a profile in that config with the name "DEFAULT". Make changes to
        // the following
        // line if needed and use ConfigFileReader.parse(configurationFilePath, profile);
        final ConfigFileReader.ConfigFile configFile = ConfigFileReader.parseDefault();
        final AuthenticationDetailsProvider provider =
                new ConfigFileAuthenticationDetailsProvider(configFile);
        ObjectStorage client = ObjectStorageClient.builder().build(provider);
        // this is set per client. Once set, the dual stack will be enabled for all the API
        // endpoints for this client
        client.enableDualStackEndpoints(true);
        client.useRealmSpecificEndpointTemplate(true);
        System.out.println(client.getEndpoint());
        GetNamespaceResponse namespaceResponse =
                client.getNamespace(GetNamespaceRequest.builder().build());
        String namespaceName = namespaceResponse.getValue();
        System.out.println("Using namespace: " + namespaceName);
        ListBucketsRequest.Builder listBucketsBuilder =
                ListBucketsRequest.builder()
                        .namespaceName(namespaceName)
                        .compartmentId(provider.getTenantId());

        String nextToken = null;
        do {
            listBucketsBuilder.page(nextToken);
            ListBucketsResponse listBucketsResponse =
                    client.listBuckets(listBucketsBuilder.build());
            for (BucketSummary bucket : listBucketsResponse.getItems()) {
                System.out.println("Found bucket: " + bucket.getName());
            }
            nextToken = listBucketsResponse.getOpcNextPage();
        } while (nextToken != null);
        client.close();
        IdentityClient identityClient = IdentityClient.builder().build(provider);
        GetAuthenticationPolicyResponse getAuthenticationPolicyResponse =
                identityClient.getAuthenticationPolicy(
                        GetAuthenticationPolicyRequest.builder()
                                // currently only the tenant (ie the root compartment) can have an
                                // authentication policy
                                .compartmentId(provider.getTenantId())
                                .build());
        System.out.printf(
                "The Authentication Policy is: %s\n",
                getAuthenticationPolicyResponse.getAuthenticationPolicy().toString());
        identityClient.close();
    }
}

OCI Go SDK(オブジェクト・ストレージ)

バージョン: v65.123.0以降:

  • 環境変数:セッションでOCI_DUAL_STACK_ENDPOINT_ENABLED=trueおよびOCI_REALM_SPECIFIC_SERVICE_ENDPOINT_TEMPLATE_ENABLED=trueを設定します。
  • クライアント設定: EnableDualStackEndpoints(true)およびRealmSpecificServiceEndpointTemplateEnabled: common.Bool(true)をコールして、リージョンのデュアルスタック・エンドポイントにオブジェクト・ストレージ・リクエストを転送します。例:

実行

// This example shows how to set the environment variable OCI_DUAL_STACK_ENDPOINT_ENABLED
	// to enable dual stack endpoints.
	os.Setenv("OCI_DUAL_STACK_ENDPOINT_ENABLED", "true")
// Dual stack endpoints can be enabled at the client level as shown, or through the
	// environment variable OCI_DUAL_STACK_ENDPOINT_ENABLED
	c.EnableDualStackEndpoints(true)
// This example shows how to use realm specific endpoint to get object.
	// You can select either this environment variable or the customClientConfiguration to enable realm specific endpoint.
	os.Setenv("OCI_REALM_SPECIFIC_SERVICE_ENDPOINT_TEMPLATE_ENABLED", "true")
// An alternative way to enable realm specific endpoint is to use the following code.
	c.SetCustomClientConfiguration(common.CustomClientConfiguration{
		RealmSpecificServiceEndpointTemplateEnabled: common.Bool(true),
	})

CLIでのデュアルスタックエンドポイントの使用

次のいずれかの方法で、Object StorageのCLIリクエストをデュアルスタック・エンドポイントに転送できます。

  • セッション全体:次の設定をtrueに設定します。これらの設定は、セッションでCLIコマンドによって行われたオブジェクト・ストレージ・リクエストを、指定されたリージョンのデュアルスタック・エンドポイントに送信します。
    • OCI_DUAL_STACK_ENDPOINT_ENABLED=true
    • OCI_REALM_SPECIFIC_SERVICE_ENDPOINT_TEMPLATE_ENABLED=true
  • コマンドごと:

    オブジェクト・ストレージ・コマンドに--enable-dual-stackおよび--realm-specific-endpointを含めます。例:

    oci os ns get --enable-dual-stack --realm-specific-endpoint
  • エンドポイント・オーバーライド: --endpoint <dual-stack-url>を使用して、デュアルスタック・エンドポイントを直接指定します。

IPアドレスの互換性のテスト

Linux/UNIX/macOS

デュアルスタック・ヘルス・チェック・パスでcurl -v -6を使用すると、IPv6を介してデュアルスタック・エンドポイントにアクセスできるかどうかをテストできます。例:

curl -v -6 https://MyNamespace.objectstorage.us-ashburn-1.ds.oci.customer-oci.com/v2:healthcheck
表示される内容:
  • IPv6にアクセスするように構成されている場合、接続されたIPアドレスは IPv6アドレスとして表示されます。
  • IPv6にアクセスするように構成されていない場合、Trying IPv6 Address...の後に出力を停止できますが、それ以上の情報は含まれません。

Windows 7 / Windows 10

pingを使用して、IPv6またはIPv4を介してデュアルスタック・エンドポイントにアクセスできるかどうかをテストできます。例:

ping MyNamespace.objectstorage.us-ashburn-1.ds.oci.customer-oci.com
表示される内容:
  • IPv6にアクセスするように構成されている場合、接続されたIPアドレスは IPv6アドレスとして表示されます。
  • IPv6にアクセスするように構成されていない場合、Trying IPv6 Address...の後に出力を停止できますが、それ以上の情報は含まれません。