Documentation Index

Fetch the complete documentation index at: https://cli.ncloud-docs.com/llms.txt

Use this file to discover all available pages before exploring further.

assignSecondaryIps

Prev Next

Available in VPC

Assign a secondary IP to a network interface.

Syntax

The assignSecondaryIps syntax is as follows:

./ncloud vserver assignSecondaryIps \
    --networkInterfaceNo <nic-no> \
    --secondaryIpList <secondary-ip-list> \
    --secondaryIpCount <secondary-ip-count> \
    [--allowReassign <true|false>] \
    [--regionCode <KR|SGN|JPN>] \
    [--output <json|xml>]

Options

This section describes the options available when running assignSecondaryIps.

Required options

The following options are required for assignSecondaryIps.

Options Type Required Description
--networkInterfaceNo String Required Network interface number
--secondaryIpList List Conditional Secondary IP list
  • You can enter multiple items separated by spaces. (e.g., --secondaryIpList 192.168.0.1 192.168.0.2)
  • Up to 5 IP address ranges in the subnet can be entered.
  • At least 1 must be entered including secondaryIpCount.
--secondaryIpCount Integer Conditional Number of auto-assigned secondary IPs
  • 0-5
  • Automatically assign private IPs sequentially.
  • Up to 5 can be entered including secondaryIpList.
  • At least 1 must be entered including secondaryIpList.

Optional options

These are the optional options for assignSecondaryIps. Options that are not specified will use their default values.

Options Type Required Description
--allowReassign Boolean Optional Whether to allow reassignment
  • true | false (default)
    • true: Reassign if the secondary IP is already in use.
    • false: An error occurs if the secondary IP is already in use.
  • Only apply to IPs specified with secondaryIpList.

Common options

For information about the options common to all vserver subcommands, see Server (VPC) options.

Examples

If the request to assign a secondary IP address to a network interface is successful, the network interface's configuration information and a list of assigned secondary IP addresses are returned.

Command

The command example is as follows:

./ncloud vserver assignSecondaryIps \
    --networkInterfaceNo 56789012 \
    --secondaryIpList 192.0.2.13 192.0.2.14 \
    --regionCode KR \
    --output json

Output

The output example is as follows:

{
  "assignSecondaryIpsResponse": {
    "totalRows": 1,
    "networkInterfaceList": [
      {
        "networkInterfaceNo": "56789012",
        "networkInterfaceName": "test-nic-01",
        "subnetNo": "23456789",
        "deleteOnTermination": false,
        "isDefault": false,
        "deviceName": "eth1",
        "networkInterfaceStatus": {
          "code": "SET",
          "codeName": "Configuring"
        },
        "instanceType": {
          "code": "VSVR",
          "codeName": "Server (VPC)"
        },
        "instanceNo": "34567890",
        "ip": "192.0.2.10",
        "macAddress": "F2:20:AF:00:00:01",
        "enableFlowLog": false,
        "accessControlGroupNoList": [
          "67890123"
        ],
        "networkInterfaceDescription": "Test network interface",
        "secondaryIpList": [
          "192.0.2.11",
          "192.0.2.13",
          "192.0.2.14"
        ]
      }
    ],
    "requestId": "17890123-4567-8901-1234-789012345678",
    "returnCode": "0",
    "returnMessage": "success"
  }
}