비공개 IP를 사용하여 학습 작업에 연결하면 공개 IP를 사용할 때보다 네트워크 보안이 향상되고 네트워크 지연 시간이 줄어듭니다. 비공개 IP를 사용하려면 가상 프라이빗 클라우드(VPC)를 사용하여 모든 유형의 Vertex AI 커스텀 학습 작업과 네트워크를 피어링합니다.
이렇게 하면 학습 코드가Google Cloud 또는 온프레미스 네트워크 내의 비공개 IP 주소에 액세스할 수 있습니다.
이 가이드에서는 이미 .VPC 네트워크 피어링을 설정한 후에 Vertex AI CustomJob, HyperparameterTuningJob 또는 커스텀 TrainingPipeline과 네트워크를 피어링하도록 네트워크에서 커스텀 학습 작업을 실행하는 방법을 보여줍니다.
서비스 제작자를 위해 예약한 IP 범위는 Vertex AI 및 기타 서비스에서 사용할 수 있습니다. 이 테이블은 Vertex AI에서 거의 독점적으로 사용된다는 가정하에 /16에서 /18까지 예약된 범위로 실행할 수 있는 최대 동시 학습 작업 수를 보여줍니다. 동일한 범위를 사용하여 다른 서비스 제작자에 연결하는 경우 IP 소진을 방지하기 위해 더 큰 범위를 할당하세요.
학습 작업의 머신 구성
예약된 범위
최대 동시 작업 수
최대 8개의 노드
예: 첫 번째 작업자 풀의 기본 복제본 1개, 두 번째 작업자 풀의 복제본 6개, 세 번째 작업자 풀의 작업자 1개(매개변수 서버 역할을 함)
/16
63
/17
31
/18
15
최대 16개의 노드
예: 첫 번째 작업자 풀의 기본 복제본 1개, 두 번째 작업자 풀의 복제본 14개, 세 번째 작업자 풀의 작업자 1개(매개변수 서버 역할을 함)
/16
31
/17
15
/18
7
최대 32개의 노드
예: 첫 번째 작업자 풀의 기본 복제본 1개, 두 번째 작업자 풀의 복제본 30개, 세 번째 작업자 풀의 작업자 1개(매개변수 서버 역할을 함)
하이퍼파라미터 미세 조정으로 TrainingPipeline을 만드는 경우TrainingPipeline.trainingTaskInputs.trialJobSpec.network 필드를 지정합니다.
네트워크 이름을 지정하지 않으면 Vertex AI가 피어링 연결을 사용하지 않고 프로젝트에서 비공개 IP에 대한 액세스 없이 커스텀 학습을 실행합니다.
예시: gcloud CLI를 사용하여 CustomJob 만들기
다음 예시에서는 gcloud CLI를 사용해 사전 빌드된 컨테이너를 사용하는 CustomJob을 실행할 때 네트워크를 지정하는 방법을 보여줍니다. 다른 방식으로 커스텀 학습을 수행하는 경우 사용 중인 커스텀 학습 작업의 유형에 설명된 대로network 필드를 추가합니다.
네트워크를 지정할 config.yaml 파일을 만듭니다. 공유 VPC를 사용하는 경우 VPC 호스트 프로젝트 번호를 사용합니다.
다른 네트워크에서 커스텀 학습을 수행하는 동안에는 새 네트워크에서 커스텀 학습을 수행할 수 없습니다. 다른 네트워크로 전환하려면 먼저 제출된 모든 CustomJob, HyperparameterTuningJob, 커스텀 TrainingPipeline 리소스가 완료될 때까지 기다리거나 리소스를 취소해야 합니다.
학습 작업 액세스 테스트
이 섹션에서는 커스텀 학습 리소스가 네트워크의 비공개 IP에 액세스할 수 있는지 테스트하는 방법을 설명합니다.
VPC 네트워크에 Compute Engine 인스턴스를 만듭니다.
방화벽 규칙을 검사하여 Vertex AI 네트워크에서의 인그레스를 제한하지 않는지 확인합니다. 제한한다면 Vertex AI 네트워크가 Vertex AI(및 기타 서비스 제작자)를 위해 예약한 IP 범위에 액세스할 수 있도록 하는 규칙을 추가합니다.
Vertex AI CustomJob이 액세스할 엔드포인트를 만들려면 VM 인스턴스에 로컬 서버를 설정합니다.
Vertex AI에서 실행할 Python 학습 애플리케이션을 만듭니다.
모델 학습 코드 대신 이전 단계에서 설정한 엔드포인트에 액세스하는 코드를 만듭니다.
이전 예시에 따라 CustomJob을 만듭니다.
일반적인 문제
이 섹션에는 Vertex AI를 사용하여 VPC 네트워크 피어링을 구성할 때 발생하는 일반적인 문제가 나와 있습니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-07-16(UTC)"],[],[],null,["# Use a private IP for custom training\n\n| **Note:** Vertex AI Training doesn't support VPC Peering with H100-mega, H200 and B200 accelerators. A [network attachment with PSC-I](/vertex-ai/docs/training/psc-i-egress) can be used as an alternative for VPC Peering.\n\nUsing private IP to connect to your training jobs provides more\nnetwork security and lower network latency than using public IP. To use private\nIP, you use [Virtual Private Cloud (VPC)](/vpc/docs/vpc-peering) to peer your\nnetwork with any type of\n[Vertex AI custom training job](/vertex-ai/docs/training/custom-training-methods).\nThis allows your training code to access private IP addresses inside your\nGoogle Cloud or on-premises networks.\n\nThis guide shows how to run custom training jobs in your network after you have\nalready [set up VPC Network Peering](/vertex-ai/docs/general/vpc-peering) to peer your network\nwith a Vertex AI `CustomJob`, `HyperparameterTuningJob`, or custom\n`TrainingPipeline` resource.\n\nOverview\n--------\n\nBefore you submit a custom training job using private IP, you must [configure\nprivate services access to create peering connections between your network\nand Vertex AI](/vertex-ai/docs/general/vpc-peering). If you have already set this up,\nyou can use your existing peering connections.\n\nThis guide covers the following tasks:\n\n- Understanding which IP ranges to reserve for custom training.\n- Verify the status of your existing peering connections.\n- Perform Vertex AI custom training on your network.\n- Check for active training occurring on one network before training on another network.\n- Test that your training code can access private IPs in your network.\n\n### Reserve IP ranges for custom training\n\nWhen you reserve an IP range for service producers, the range can be used by\nVertex AI and other services. This table shows the maximum number\nof parallel training jobs that you can run with reserved ranges from /16 to /18,\nassuming the range is used almost exclusively by Vertex AI. If you\nconnect with other service producers using the same range, allocate a larger\nrange to accommodate them, in order to avoid IP exhaustion.\n\nLearn more about [configuring worker pools for distributed\ntraining](/vertex-ai/docs/training/distributed-training).\n\nCheck the status of existing peering connections\n------------------------------------------------\n\nIf you have existing peering connections you use with Vertex AI,\nyou can list them to check status: \n\n gcloud compute networks peerings list --network \u003cvar translate=\"no\"\u003eNETWORK_NAME\u003c/var\u003e\n\nYou should see that the state of your peering connections are `ACTIVE`.\nLearn more about [active peering connections](/vpc/docs/peer-two-networks#peering-becomes-active).\n\nPerform custom training\n-----------------------\n\nWhen you perform custom training, you must specify the name of the\nnetwork that you want Vertex AI to have access to.\n\nDepending on how you perform custom training, specify the network in one of the\nfollowing API fields:\n\n- **If you are creating a\n [`CustomJob`](/vertex-ai/docs/reference/rest/v1/projects.locations.customJobs),** specify the\n `CustomJob.jobSpec.network` field.\n\n If you are using the Google Cloud CLI, then you can use the `--config` flag on\n the [`gcloud ai custom-jobs create`\n command](/sdk/gcloud/reference/ai/custom-jobs/create) to specify the\n `network` field.\n\n Learn more about [creating a `CustomJob`](/vertex-ai/docs/training/create-custom-job).\n- **If you are creating a\n [`HyperparameterTuningJob`](/vertex-ai/docs/reference/rest/v1/projects.locations.hyperparameterTuningJobs),**\n specify the `HyperparameterTuningJob.trialJobSpec.network` field.\n\n If you are using the gcloud CLI, then you can use the `--config`\n flag on the [`gcloud ai hpt-tuning-jobs create`\n command](/sdk/gcloud/reference/ai/hp-tuning-jobs/create) to specify the\n `network` field.\n\n Learn more about\n [creating a\n `HyperparameterTuningJob`](/vertex-ai/docs/training/using-hyperparameter-tuning).\n- **If you are creating a\n [`TrainingPipeline`](/vertex-ai/docs/reference/rest/v1/projects.locations.trainingPipelines) without\n hyperparameter tuning,** specify the\n `TrainingPipeline.trainingTaskInputs.network` field.\n\n Learn more about [creating a custom\n `TrainingPipeline`](/vertex-ai/docs/training/create-training-pipeline).\n- **If you are creating a `TrainingPipeline` with hyperparameter tuning** ,\n specify the `TrainingPipeline.trainingTaskInputs.trialJobSpec.network` field.\n\nIf you don't specify a network name, then Vertex AI runs your\ncustom training without a peering connection, and without access to private IPs\nin your project.\n\n### Example: Creating a `CustomJob` with the gcloud CLI\n\nThe following example shows how to specify a network when you use the\ngcloud CLI to run a `CustomJob` that uses a prebuilt container. If\nyou are perform custom training in a different way, add the `network` field\n[as described for the type of custom training job you're using](#perform-custom-training).\n\n1. Create a `config.yaml` file to specify the network. If you're using\n Shared VPC, use your VPC host project number.\n\n Make sure the network name is formatted correctly: \n\n PROJECT_NUMBER=$(gcloud projects describe $PROJECT_ID --format=\"value(projectNumber)\")\n\n cat \u003c\u003cEOF \u003e config.yaml\n network: projects/\u003cvar translate=\"no\"\u003ePROJECT_NUMBER\u003c/var\u003e/global/networks/\u003cvar translate=\"no\"\u003eNETWORK_NAME\u003c/var\u003e\n EOF\n\n2. [Create a training application](/vertex-ai/docs/training/create-python-pre-built-container)\n to run on Vertex AI.\n\n3. Create the `CustomJob`, passing in your `config.yaml` file:\n\n gcloud ai custom-jobs create \\\n --region=\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e \\\n --display-name=\u003cvar translate=\"no\"\u003eJOB_NAME\u003c/var\u003e \\\n --python-package-uris=\u003cvar translate=\"no\"\u003ePYTHON_PACKAGE_URIS\u003c/var\u003e \\\n --worker-pool-spec=machine-type=\u003cvar translate=\"no\"\u003eMACHINE_TYPE\u003c/var\u003e,replica-count=\u003cvar translate=\"no\"\u003eREPLICA_COUNT\u003c/var\u003e,executor-image-uri=\u003cvar translate=\"no\"\u003ePYTHON_PACKAGE_EXECUTOR_IMAGE_URI\u003c/var\u003e,python-module=\u003cvar translate=\"no\"\u003ePYTHON_MODULE\u003c/var\u003e \\\n --config=config.yaml\n\nTo learn how to replace the placeholders in this command, read [Creating custom\ntraining jobs](/vertex-ai/docs/training/create-custom-job).\n\n### Run jobs on different networks\n\nYou can't perform custom training on a new network while you are still\nperforming custom training on another network. Before you switch to a different\nnetwork, you must wait for all submitted `CustomJob`, `HyperparameterTuningJob`,\nand custom `TrainingPipeline` resources to finish, or you must cancel them.\n\nTest training job access\n------------------------\n\nThis section explains how to test that a custom training resource can access\nprivate IPs in your network.\n\n1. Create a Compute Engine instance in your VPC network.\n2. [Check your firewall rules](/vpc/docs/using-firewalls#listing-rules-vm) to make sure that they don't restrict ingress from the Vertex AI network. If so, add a rule to ensure the Vertex AI network can access the IP range you reserved for Vertex AI (and other service producers).\n3. Set up a local server on the VM instance in order to create an endpoint for a Vertex AI `CustomJob` to access.\n4. Create a Python training application to run on Vertex AI. Instead of model training code, create code that accesses the endpoint you set up in the previous step.\n5. Follow the previous example to create a `CustomJob`.\n\nCommon problems\n---------------\n\nThis section lists some common issues for configuring VPC Network Peering with\nVertex AI.\n\n- When you configure Vertex AI to use your network, specify the\n full network name:\n\n \"projects/\u003cvar translate=\"no\"\u003eYOUR_PROJECT_NUMBER\u003c/var\u003e/global/networks/\u003cvar translate=\"no\"\u003eYOUR_NETWORK_NAME\u003c/var\u003e\"\n- Make sure you are not performing custom training on a network before\n performing custom training on a different network.\n\n- Make sure that you've allocated a sufficient IP range for all service\n producers your network connects to, including Vertex AI.\n\nFor additional troubleshooting information, refer to the\n[VPC Network Peering troubleshooting guide](/vpc/docs/using-vpc-peering#troubleshooting).\n\nWhat's next\n-----------\n\n- Learn more about [VPC Network Peering](/vpc/docs/vpc-peering).\n- See [reference architectures and best practices](/solutions/best-practices-vpc-design#shared-service) for VPC design."]]