오픈스택 queens 아이피 추가.

| 2020년 1월 30일 | 0 Comments

오픈스택 queens 버전에서 포트를 생성하여 아이피를 추가하여 보겠습니다.

Ubuntu 18.04 OS에서 테스트 했으며 오픈스택 버전이 queens 이하 버전에서는 명령어가 다를수 있습니다.

  • 포트 생성

    root@controller:~# openstack port create –network jyh –description “test add private ip.” –fixed-ip subnet=jyh –enable private_port
    +———————–+—————————————————————————–+
    | Field | Value |
    +———————–+—————————————————————————–+
    | admin_state_up | UP |
    | allowed_address_pairs | |
    | binding_host_id | None |
    | binding_profile | None |
    | binding_vif_details | None |
    | binding_vif_type | None |
    | binding_vnic_type | normal |
    | created_at | 2018-07-16T01:22:56Z |
    | data_plane_status | None |
    | description | test add private ip. |
    | device_id | |
    | device_owner | |
    | dns_assignment | None |
    | dns_name | None |
    | extra_dhcp_opts | |
    | fixed_ips | ip_address=’192.168.0.13′, subnet_id=’03c52dd1-c555-4706-b188-029456de0917′ |
    | id | 3c89d8ad-544e-43d0-a37f-1c297832b19a |
    | ip_address | None |
    | mac_address | fa:16:3e:be:18:06 |
    | name | private_port |
    | network_id | 17e6212d-dd27-42f7-a0d0-30222ac2358c |
    | option_name | None |
    | option_value | None |
    | port_security_enabled | True |
    | project_id | fce9e3f27aad49e384f46943d3d8af60 |
    | qos_policy_id | None |
    | revision_number | 6 |
    | security_group_ids | 2e419460-03e3-4e5f-baa3-561c15ecf6e5 |
    | status | DOWN |
    | subnet_id | None |
    | tags | |
    | trunk_details | None |
    | updated_at | 2018-07-16T01:22:56Z |
    +———————–+—————————————————————————–+

    root@controller:~# openstack port list
    +————————————–+————–+——————-+—————————————————————————–+——–+
    | ID | Name | MAC Address | Fixed IP Addresses | Status |
    +————————————–+————–+——————-+—————————————————————————–+——–+
    | 13da2bbe-677a-4ea5-92a5-9710c72e3c7c | | fa:16:3e:5e:f5:ca | ip_address=’192.168.0.2′, subnet_id=’03c52dd1-c555-4706-b188-029456de0917′ | ACTIVE |
    | 3c89d8ad-544e-43d0-a37f-1c297832b19a | private_port | fa:16:3e:be:18:06 | ip_address=’192.168.0.13′, subnet_id=’03c52dd1-c555-4706-b188-029456de0917′ | DOWN |
    | 79194ca3-8732-4111-bab8-a053f25dd667 | | fa:16:3e:5b:d2:8d | ip_address=’192.168.0.1′, subnet_id=’03c52dd1-c555-4706-b188-029456de0917′ | ACTIVE |
    | 8a4d7917-0423-4393-84f6-e2fe34d7e581 | | fa:16:3e:a6:0f:9c | ip_address=’192.168.0.10′, subnet_id=’03c52dd1-c555-4706-b188-029456de0917′ | ACTIVE |
    +————————————–+————–+——————-+—————————————————————————–+——–+

     

  • 인스턴스에 포트 연결

    root@controller:~# openstack server add port test private_port

    root@controller:~# openstack port list
    +————————————–+————–+——————-+—————————————————————————–+——–+
    | ID | Name | MAC Address | Fixed IP Addresses | Status |
    +————————————–+————–+——————-+—————————————————————————–+——–+
    | 13da2bbe-677a-4ea5-92a5-9710c72e3c7c | | fa:16:3e:5e:f5:ca | ip_address=’192.168.0.2′, subnet_id=’03c52dd1-c555-4706-b188-029456de0917′ | ACTIVE |
    | 3c89d8ad-544e-43d0-a37f-1c297832b19a | private_port | fa:16:3e:be:18:06 | ip_address=’192.168.0.13′, subnet_id=’03c52dd1-c555-4706-b188-029456de0917′ | ACTIVE |
    | 79194ca3-8732-4111-bab8-a053f25dd667 | | fa:16:3e:5b:d2:8d | ip_address=’192.168.0.1′, subnet_id=’03c52dd1-c555-4706-b188-029456de0917′ | ACTIVE |
    | 8a4d7917-0423-4393-84f6-e2fe34d7e581 | | fa:16:3e:a6:0f:9c | ip_address=’192.168.0.10′, subnet_id=’03c52dd1-c555-4706-b188-029456de0917′ | ACTIVE |
    +————————————–+————–+——————-+—————————————————————————–+——–+

  • 생성한 포트와 floating 아이피 연결

    root@controller:~# openstack floating ip create –port private_port provider
    +———————+————————————–+
    | Field | Value |
    +———————+————————————–+
    | created_at | 2018-07-16T01:26:32Z |
    | description | |
    | fixed_ip_address | 192.168.0.13 |
    | floating_ip_address | xxx.xxx.xxx.9 |
    | floating_network_id | 1c0c5f01-29f9-41ae-8adb-4ee5ee0e6dfe |
    | id | a518d8b8-94ea-422b-874f-dcc037718992 |
    | name | 115.68.145.9 |
    | port_id | 3c89d8ad-544e-43d0-a37f-1c297832b19a |
    | project_id | fce9e3f27aad49e384f46943d3d8af60 |
    | qos_policy_id | None |
    | revision_number | 0 |
    | router_id | 3419db93-f8a2-46dc-bb09-15a96b233fe2 |
    | status | DOWN |
    | subnet_id | None |
    | updated_at | 2018-07-16T01:26:32Z |
    +———————+————————————–+

    root@controller:~# nova list
    +————————————–+——+——–+————+————-+————————————————————–+
    | ID | Name | Status | Task State | Power State | Networks |
    +————————————–+——+——–+————+————-+————————————————————–+
    | fad7232f-2caa-483e-9f22-b55dfd41befd | test | ACTIVE | – | Running | jyh=192.168.0.10, 192.168.0.13, xxx.xxx.xxx.8, xxx.xxx.xxx.9 |
    +————————————–+——+——–+————+————-+————————————————————–+

Category: 가상화/클라우드

장영호

About the Author ()