> For the complete documentation index, see [llms.txt](https://docs.higiocloud.vn/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.higiocloud.vn/hi-gio-user-guide-vn/compute/4.-hi-gio-api/api-cau-hinh-lai-network-cua-vm.md).

# API cấu hình lại Network của VM

## <mark style="color:green;">**Tổng quan**</mark> <a href="#overview" id="overview"></a>

Trong tài liệu này, bạn sẽ tìm thấy thông tin chi tiết về cách chuẩn bị thông tin, lấy thông tin mạng của VM và cấu hình lại mạng của VM.

## <mark style="color:green;">Quy trình</mark>

{% stepper %}
{% step %}
**Bước 1**: Chuẩn bị thông tin

Đăng nhập vào IAM portal -> vCD portal: thu thập thông tin

**{{vcd\_url}}**

<figure><img src="https://content.gitbook.com/content/dOZ82gj0wvhbAUlxBHpj/blobs/qUqeNzK5ZXM0GK0pSVlh/image.png" alt=""><figcaption></figcaption></figure>

**{{vm-uuid}}:** chọn VM -> kiểm tra vm **uuid** trên URL<br>

<figure><img src="https://content.gitbook.com/content/dOZ82gj0wvhbAUlxBHpj/blobs/GO65o47E1rwOxTE75Jqx/image.png" alt=""><figcaption></figcaption></figure>

**{{network\_name}}**: Chọn Networking -> Networks -> Sao chép tên mạng<br>

<figure><img src="https://content.gitbook.com/content/dOZ82gj0wvhbAUlxBHpj/blobs/d5Ez7VxKY81vsF59Kyfi/image.png" alt=""><figcaption></figcaption></figure>

**{{Bearer Token}}:** Vui lòng tham khảo tài liệu “API token login”
{% endstep %}

{% step %}
**Bước 2:** **Lấy thông tin mạng của VM**

* GET https\://{{vcd\_url}}/api/vApp/{{vm-uuid}}/virtualHardwareSection/networkCards
* Authorization: {{Bearer Token}}
* Headers:

\- ‘Accept’: \*/\*;version=37.2

\- ‘Content-type’: application/vnd.vmware.vcloud.rasdItem+xml

<figure><img src="https://4089256359-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdOZ82gj0wvhbAUlxBHpj%2Fuploads%2F32wv9Z3ThVTRwBisQt3s%2Fimage.png?alt=media&amp;token=44e70e81-845c-4c84-8451-084567a6c2ec" alt=""><figcaption></figcaption></figure>

* SEND request.

Copy **Response Body**
{% endstep %}

{% step %}
**Bước 3: Cấu hình lại mạng của VM**

* PUT https//{{vcd\_url}}/api/vApp/{{vm-uuid}}/virtualHardwareSection/networkCards
* Authorization: {{Bearer Token }}
* Headers:

\- 'Accept’: \*/\*;version=37.2

\- ‘Content-type’: application/vnd.vmware.vcloud.rasdItemsList+xml; charset=ISO-8859-1

Body: *{{select raw -> copy and paste* *response body from Get VM’s networks information }}*

Ex:

```
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<RasdItemsList xmlns="http://www.vmware.com/vcloud/v1.5" xmlns:vmext="http://www.vmware.com/vcloud/extension/v1.5" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData"
…………………………………..
………………………………….
    <Link rel="edit" href="https://iaas-hcmc02.higiocloud.vn/api/vApp/vm-6cc0d2ef-6823-421a-bed5-8bb0f92a7bca/virtualHardwareSection/networkCards" type="application/vnd.vmware.vcloud.rasdItemsList+json"/>
    <Item>
        <rasd:Address>00:50:56:02:10:2c</rasd:Address>
        <rasd:AddressOnParent>0</rasd:AddressOnParent>
        <rasd:AllocationUnits xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
        <rasd:AutomaticAllocation>true</rasd:AutomaticAllocation>
        <rasd:AutomaticDeallocation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
        <rasd:ConfigurationName xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
        <rasd:Connection xmlns:ns10="http://www.vmware.com/vcloud/v1.5" ns10:ipAddressingMode="Manual" ns10:ipAddress="10.10.11.20" ns10:primaryNetworkConnection="true">10.10.11.0/24</rasd:Connection>
        <rasd:ConsumerVisibility xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
        …………………………………………………………………….
        <rasd:ResourceSubType>VMXNET3</rasd:ResourceSubType>
        <rasd:ResourceType>10</rasd:ResourceType>
        <rasd:VirtualQuantity xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
        <rasd:Weight xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
    </Item>
</RasdItemsList>
```

\=====================================================================

Tìm từ :

<mark style="color:red;">ns10:ipAddressingMode</mark> và chỉnh sửa giá trị trong “ ” (network mode: “DHCP”, “Pool”, “Manual”)

\+ DHCP: Vui lòng thiết lập DHCP pool trên mạng của bạn -> The IP Management

\+ Pool: Vui lòng thiết lập Static IP pools trên mạng của bạn-> IP Management

<mark style="color:red;">ns10:ipAddress</mark> và chỉnh sửa giá trị trong “ ” (“VM ipv4 address”) – **không cần nếu sử dụng DHCP hoặc Pool**

<mark style="color:red;">ns10:primaryNetworkConnection</mark> và chỉnh sửa giá trị trong “ ” (dán tên mạng <mark style="color:green;">{{netwok\_name}}</mark> )

* SEND request.
  {% endstep %}

{% step %}
**Bước 4:** **Xác minh**

* **Lấy thông tin mạng của VM**

GET https\://{{vcd\_url}}/api/vApp/{{vm-uuid}}/virtualHardwareSection/networkCards

* **Kiểm tra trên vCD portal:**

Login IAM -> vCD portal-> select VM-> NICs
{% endstep %}
{% endstepper %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.higiocloud.vn/hi-gio-user-guide-vn/compute/4.-hi-gio-api/api-cau-hinh-lai-network-cua-vm.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
