Changing the information of a virtual router (attaching to a subnet)

This section explains how to connect a virtual router to a subnet on K5 by updating its settings.



  1. Set the environment variables below as follows:
    $ ROUTER_ID=<targetVirtualRouterId>
    $ SUBNET_ID=<subnetIdToBeConnected>
  2. Execute the following API:
    $ curl -Ss $NETWORK/v2.0/routers/$ROUTER_ID/add_router_interface -X PUT \
    -H "X-Auth-Token: $OS_AUTH_TOKEN" -H "Content-Type: application/json" \
    -d '{"subnet_id": "'$SUBNET_ID'"  }' | jq .

    The following response is output:

    {
      "subnet_id": "<specifiedSubnetId>",
      "tenant_id": "<projId>",
      "port_id": "<portId>",
      "id": "<virtualRouterId>",
      "availability_zone": "<availabilityZone>"
    }
    

    For the availability zones, AZ1 is expressed as "jp-east-1a", and AZ2 is expressed as "jp-east-1b".