Self service nics for Virtual Instances

Peter -

You can create, delete, or list virtual networks on a virtual machine.

Sometimes you want to do add and deletes of vnics by yourself instead of submitting a support ticket. This article tells you how.

You will need to locally install the Node CloudAPI tools: https://docs.joyent.com/public-cloud/api-access/cloudapi

Once you have that working, you can do the following using the sdc-nics CloudAPI tool:

sdc-nics

SmartDC machine NIC operations

 

Usage:

    sdc-nics [OPTIONS] COMMAND [ARGS...]

    sdc-nics help COMMAND

 

Options:

    -h, -?, --help         Print help and exit.

    --version              Print version and exit.

    -d, --debug            equivalent to --verbose

    -a ARG, --account=ARG  account name. Environment: SDC_ACCOUNT=ARG

    -A ARG, --user=ARG     account sub-user login. Environment: SDC_USER=ARG

    -u ARG, --url=ARG      url for SmartDataCenter API. Environment: SDC_URL=ARG

    -v, --verbose          display additional internal details during request

    -k ARG, --keyId=ARG    your ssh key fingerprint. Environment: SDC_KEY_ID=ARG

    --role=ARG             non-default roles to make request with

 

Commands:

    help (?)        Help on a specific sub-command.

    list            List your machine's NICs.

    get             Get a machine's NIC by MAC.

    create          Create a new NIC on one of your machines, and reboot the machine.

    delete          Removes a NIC from a machine, and reboots machine.

Options:

-h, -?, --help Show this help.

First, find the networks available to you for your data center. Note, these are for the us-east-1 datacenter. You will need to set the SDC_URL to the datacenter you need.

sdc-listnetworks
[
{
"id": "5983940e-58a5-4543-b732-c689b1fe4c08",
"name": "Joyent-SDC-Private",
"public": false
},
{
"id": "9ec60129-9034-47b4-b111-3026f9b1a10f",
"name": "Joyent-SDC-Public",
"public": true
},
{
"id": "09a4c63e-6c78-4ae6-9440-ecdde2da9934",
"name": "default",
"public": false
}
]

sdc-nics create 5983940e-58a5-4543-b732-c689b1fe4c08 0000000-7ded-45cc-8474-451fa59b9234
{
"mac": "90:b8:d0:19:95:4f",
"ip": "0.0.0.0",
"primary": false,
"gateway": "10.112.0.1",
"netmask": "255.255.248.0",
"state": "provisioning"
}

It will not show up in the customerUI but if you login the instance, you will see the new nic with the ifconfig command.

Give it a try.

 

NOTE: Adding additional nics is supported for nics on private VLANs in general or public VLANs allocated specifically to your account. Adding nics on general Joyent public networks is not supported. 

Have more questions? Submit a request

0 Comments

Article is closed for comments.