addRoute

Prev Next

VPC 환경에서 이용 가능합니다.

라우트 테이블에 라우트를 추가합니다.

요청

요청 형식을 설명합니다. 요청 형식은 다음과 같습니다.

메서드 URI
GET | POST /vpc/v2/addRoute
참고

가이드는 GET 방식 기준으로 안내합니다. POST 방식의 호출 테스트는 네이버 클라우드 플랫폼 콘솔의 API Gateway 서비스에서 Swagger를 통해서 가능합니다.

요청 헤더

VPC API에서 공통으로 사용하는 헤더에 대한 정보는 VPC 공통 헤더를 참조해 주십시오.

요청 쿼리 파라미터

요청 쿼리 파라미터에 대한 설명은 다음과 같습니다.

필드 타입 필수 여부 설명
regionCode String Optional 라우트를 추가하려는 라우트 테이블의 리전 코드
  • 조회 결과의 첫 번째 리전(기본값)
  • getRegionList 참조
vpcNo String Required 라우트 테이블의 VPC 번호
routeTableNo String Required 라우트 테이블 번호
routeList.N.destinationCidrBlock String Required 추가하려는 라우트의 목적지 IPv4 주소 범위
  • CIDR 표기법 사용
  • <예시> routeList.1.destinationCidrBlock=0.0.0.0/0&routeList.2.destinationCidrBlock=100.10.20.0/24
routeList.N.targetTypeCode String Required 추가하려는 라우트의 목적지 유형
  • NATGW | VPCPEERING | VGW
    • NATGW: NAT Gateway
    • VPCPEERING: VPC Peering
    • VGW: Virtual Private Gateway
    • <예시>routeList.1.targetTypeCode=NATGW&routeList.2.targetTypeCode=VPCPEERING
routeList.N.targetNo String Required 추가하려는 라우트의 목적지 식별 번호
  • 각 목적지 유형에 해당하는 자원 목록을 조회하는 API 참조
  • <예시>routeList.1.targetNo=1234&routeList.2.targetNo=2345
routeList.N.targetName String Required 추가하려는 라우트의 목적지 이름
  • 각 목적지 유형에 해당하는 자원 목록을 조회하는 API 참조
  • <예시>routeList.1.targetName=test-natgateway&routeList.2.targetName=test-peering
responseFormatType String Optional 응답 결과의 형식
  • xml (기본값) | json

요청 예시

요청 예시는 다음과 같습니다.

curl --location 'https://ncloud.apigw.gov-ntruss.com/vpc/v2/addRoute
?regionCode=KR    
&vpcNo=***04   
&routeTableNo=***38
&routeList.1.destinationCidrBlock=***.***.200.0/24
&routeList.1.targetTypeCode=NATGW
&routeList.1.targetNo=***9734
&routeList.1.targetName=test-***' \
--header 'x-ncp-apigw-timestamp: {Timestamp}' \
--header 'x-ncp-iam-access-key: {Access Key}' \
--header 'x-ncp-apigw-signature-v2: {API Gateway Signature}'

응답

응답 형식을 설명합니다.

응답 바디

응답 바디는 RouteList를 참조해 주십시오.

응답 상태 코드

VPC API에서 공통으로 사용하는 응답 상태 코드에 대한 정보는 VPC API 응답 상태 코드를 참조해 주십시오.

응답 예시

응답 예시는 다음과 같습니다.

<addRouteResponse>
  <requestId>2b97f2f0-39fc-40f0-9a8d-3eb6d40506e3</requestId>
  <returnCode>0</returnCode>
  <returnMessage>success</returnMessage>
  <totalRows>3</totalRows>
  <routeList>
    <route>
      <destinationCidrBlock>***.***.200.0/24</destinationCidrBlock>
      <targetName>test-***</targetName>
      <routeTableNo>***38</routeTableNo>
      <targetType>
        <code>NATGW</code>
        <codeName>NAT Gateway</codeName>
      </targetType>
      <targetNo>***9734</targetNo>
      <isDefault>false</isDefault>
    </route>
    <route>
      <destinationCidrBlock>***.***.0.0/16</destinationCidrBlock>
      <targetName>LOCAL</targetName>
      <routeTableNo>***38</routeTableNo>
      <targetType>
        <code>LOCAL</code>
        <codeName>Local</codeName>
      </targetType>
      <targetNo></targetNo>
      <isDefault>true</isDefault>
    </route>
    <route>
      <destinationCidrBlock>***.***.0.0/0</destinationCidrBlock>
      <targetName>INTERNET GATEWAY</targetName>
      <routeTableNo>***38</routeTableNo>
      <targetType>
        <code>IGW</code>
        <codeName>Internet Gateway</codeName>
      </targetType>
      <targetNo></targetNo>
      <isDefault>true</isDefault>
    </route>
  </routeList>
</addRouteResponse>