VPC 환경에서 이용 가능합니다.
라우트 테이블에 라우트를 추가합니다.
구문
addRoute 구문은 다음과 같습니다.
./ncloud vpc addRoute \
--vpcNo <vpc-no> \
--routeTableNo <route-table-no> \
--routeList <route-list> \
[--regionCode <KR|KRS>] \
[--output <json|xml>]
옵션
addRoute 실행 시 지정할 수 있는 옵션을 설명합니다.
필수 옵션
addRoute의 필수 옵션입니다.
| 옵션 | 타입 | 필수 여부 | 설명 |
|---|---|---|---|
--vpcNo |
String | Required | VPC 번호
|
--routeTableNo |
String | Required | 라우트 테이블 번호 |
--routeList |
List | Required | 라우트 목록
|
공통 옵션
vpc 명령에서 공통으로 사용하는 옵션에 대한 정보는 VPC 옵션을 참조해 주십시오.
예시
라우트 추가 요청이 성공하면 각 라우트의 구성 정보가 반환됩니다.
명령
명령 예시는 다음과 같습니다.
./ncloud vpc addRoute \
--vpcNo 12345678 \
--routeTableNo 45678901 \
--routeList "destinationCidrBlock='192.168.4.0/24', targetTypeCode='NATGW', targetNo='56789012', targetName='test-natgw-01'" \
--regionCode KR \
--output json
출력
출력 예시는 다음과 같습니다.
{
"addRouteResponse": {
"totalRows": 3,
"routeList": [
{
"destinationCidrBlock": "0.0.0.0/0",
"targetName": "INTERNET GATEWAY",
"routeTableNo": "45678901",
"targetType": {
"code": "IGW",
"codeName": "Internet Gateway"
},
"targetNo": "",
"isDefault": false
},
{
"destinationCidrBlock": "192.168.0.0/16",
"targetName": "LOCAL",
"routeTableNo": "45678901",
"targetType": {
"code": "LOCAL",
"codeName": "Local"
},
"targetNo": "",
"isDefault": true
},
{
"destinationCidrBlock": "192.168.4.0/24",
"targetName": "test-natgw-01",
"routeTableNo": "45678901",
"targetType": {
"code": "NATGW",
"codeName": "NAT Gateway"
},
"targetNo": "56789012",
"isDefault": false
}
],
"requestId": "ac0b93b2-99bd-4b30-a7bc-a6c0f1377e00",
"returnCode": "0",
"returnMessage": "success"
}
}