Openstack: Membuat Network via CLI
Belajar Linux ID – Pada tutoril kali ini kita akan mempelajari bagaimana cara membuat sebuah network baik external atau internal di openstack melalui CLI (Command line interface).
Untuk membuat network di openstack bisa menggunakan 2 cara salah satunya melaui dashboard openstack atau Horizon.
Tutorial membuat network di horizon Anda dapat merujuk pada link berikut: Openstack: Membuat Network
Berikut tahapan membuat network openstack melalui CLI:
Untuk melihat help cara membuat network di openstack gunakan perintah berikut
1
2
[root@hamim-controller ~(keystone_admin)]#
[root@hamim-controller ~(keystone_admin)]# openstack network --help
Cek list network yang sudah dibuat sebelumnya, bisa menggunakan perintah opentack atau neutron berikut contoh perinthnya
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
[root@hamim-controller ~(keystone_admin)]#
[root@hamim-controller ~(keystone_admin)]# openstack network list
+--------------------------------------+---------+--------------------------------------+
| ID | Name | Subnets |
+--------------------------------------+---------+--------------------------------------+
| a747188f-09de-496d-95a4-908d7d6262e6 | net-int | 0e627d43-60fe-4a49-bfc6-3baec80087e1 |
| b077b37f-c38a-4759-b504-bbf4f91d3e94 | net-ext | 43e2a1a6-3920-437e-8f4f-60f04a3cab91 |
+--------------------------------------+---------+--------------------------------------+
[root@hamim-controller ~(keystone_admin)]#
[root@hamim-controller ~(keystone_admin)]#
[root@hamim-controller ~(keystone_admin)]# neutron net-list
neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
+--------------------------------------+---------+----------------------------------+------------------------------------------------------+
| id | name | tenant_id | subnets |
+--------------------------------------+---------+----------------------------------+------------------------------------------------------+
| a747188f-09de-496d-95a4-908d7d6262e6 | net-int | 99f200eba89b49a9b89a981ec76813e1 | 0e627d43-60fe-4a49-bfc6-3baec80087e1 192.168.10.0/24 |
| b077b37f-c38a-4759-b504-bbf4f91d3e94 | net-ext | 99f200eba89b49a9b89a981ec76813e1 | 43e2a1a6-3920-437e-8f4f-60f04a3cab91 10.136.136.0/24 |
+--------------------------------------+---------+----------------------------------+------------------------------------------------------+
[root@hamim-controller ~(keystone_admin)]#
Untuk membuat external network Anda dapat menggunakan perintah berikut:
1
2
# neutron net-create net-ext --provider:network_type flat --provider:physical_network extnet --shared --router:external
# neutron net-create net-int1
Noted: Apabila sudah memiliki external network, maka langkah diatas bisa di skip saja.
Selanjutnya kami akan membuat internal network dengan nama network net-internal1 menggunakan perintah berikut
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
[root@hamim-controller ~(keystone_admin)]#
[root@hamim-controller ~(keystone_admin)]# openstack network create net-internal1
+---------------------------+--------------------------------------+
| Field | Value |
+---------------------------+--------------------------------------+
| admin_state_up | UP |
| availability_zone_hints | |
| availability_zones | |
| created_at | 2020-09-24T11:19:11Z |
| description | |
| dns_domain | None |
| id | 4517136f-2436-41ba-a7c3-b973e65bd54a |
| ipv4_address_scope | None |
| ipv6_address_scope | None |
| is_default | False |
| is_vlan_transparent | None |
| mtu | 1450 |
| name | net-internal1 |
| port_security_enabled | True |
| project_id | 99f200eba89b49a9b89a981ec76813e1 |
| provider:network_type | vxlan |
| provider:physical_network | None |
| provider:segmentation_id | 22 |
| qos_policy_id | None |
| revision_number | 2 |
| router:external | Internal |
| segments | None |
| shared | False |
| status | ACTIVE |
| subnets | |
| categories | |
| updated_at | 2020-09-24T11:19:11Z |
+---------------------------+--------------------------------------+
[root@hamim-controller ~(keystone_admin)]#
Gunakan perintah berikut untuk melihat list network
1
2
3
4
5
6
7
8
9
[root@hamim-controller ~(keystone_admin)]# openstack network list
+--------------------------------------+---------------+--------------------------------------+
| ID | Name | Subnets |
+--------------------------------------+---------------+--------------------------------------+
| 4517136f-2436-41ba-a7c3-b973e65bd54a | net-internal1 | |
| a747188f-09de-496d-95a4-908d7d6262e6 | net-int | 0e627d43-60fe-4a49-bfc6-3baec80087e1 |
| b077b37f-c38a-4759-b504-bbf4f91d3e94 | net-ext | 43e2a1a6-3920-437e-8f4f-60f04a3cab91 |
+--------------------------------------+---------------+--------------------------------------+
[root@hamim-controller ~(keystone_admin)]#
Gunakan perintah berikut untuk melihat subnet list
1
2
3
4
5
6
7
8
9
[root@hamim-controller ~(keystone_admin)]#
[root@hamim-controller ~(keystone_admin)]# openstack subnet list
+--------------------------------------+------------+--------------------------------------+-----------------+
| ID | Name | Network | Subnet |
+--------------------------------------+------------+--------------------------------------+-----------------+
| 0e627d43-60fe-4a49-bfc6-3baec80087e1 | subnet-int | a747188f-09de-496d-95a4-908d7d6262e6 | 192.168.10.0/24 |
| 43e2a1a6-3920-437e-8f4f-60f04a3cab91 | subnet-ext | b077b37f-c38a-4759-b504-bbf4f91d3e94 | 10.136.136.0/24 |
+--------------------------------------+------------+--------------------------------------+-----------------+
[root@hamim-controller ~(keystone_admin)]#
Saat ini network sudah berhasil dibuat, namun belum memiliki subnet untuk membuat subnet untuk network internal yang sudah kita buat diatas, silakah gunakan perintah berikut
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
[root@hamim-controller ~(keystone_admin)]#
[root@hamim-controller ~(keystone_admin)]# neutron subnet-create net-internal1 192.168.1.0/24 --name subnet-net-internal1 --gateway 192.168.1.1 --allocation-pool start=192.168.1.100,end=192.168.1.199 --dns-nameserver 10.136.136.1
neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
Created a new subnet:
+-------------------+----------------------------------------------------+
| Field | Value |
+-------------------+----------------------------------------------------+
| allocation_pools | {"start": "192.168.1.100", "end": "192.168.1.199"} |
| cidr | 192.168.1.0/24 |
| created_at | 2020-09-24T11:24:04Z |
| description | |
| dns_nameservers | 10.136.136.1 |
| enable_dhcp | True |
| gateway_ip | 192.168.1.1 |
| host_routes | |
| id | 132a0c29-9cba-4451-b24c-619fbe700181 |
| ip_version | 4 |
| ipv6_address_mode | |
| ipv6_ra_mode | |
| name | subnet-net-internal1 |
| network_id | 4517136f-2436-41ba-a7c3-b973e65bd54a |
| project_id | 99f200eba89b49a9b89a981ec76813e1 |
| revision_number | 0 |
| service_types | |
| subnetpool_id | |
| categories | |
| tenant_id | 99f200eba89b49a9b89a981ec76813e1 |
| updated_at | 2020-09-24T11:24:04Z |
+-------------------+----------------------------------------------------+
[root@hamim-controller ~(keystone_admin)]#
Saat ini subnet untuk net-internal1 sudah berhasil dibuat, sekarang silakan pastikan untuk network net-internal1 sudah mempunyai subnet dengan cara melihat list subnet
1
2
3
4
5
6
7
8
9
10
11
[root@hamim-controller ~(keystone_admin)]#
[root@hamim-controller ~(keystone_admin)]# neutron subnet-list
neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
+--------------------------------------+----------------------+----------------------------------+-----------------+------------------------------------------------------+
| id | name | tenant_id | cidr | allocation_pools |
+--------------------------------------+----------------------+----------------------------------+-----------------+------------------------------------------------------+
| 0e627d43-60fe-4a49-bfc6-3baec80087e1 | subnet-int | 99f200eba89b49a9b89a981ec76813e1 | 192.168.10.0/24 | {"start": "192.168.10.100", "end": "192.168.10.199"} |
| 132a0c29-9cba-4451-b24c-619fbe700181 | subnet-net-internal1 | 99f200eba89b49a9b89a981ec76813e1 | 192.168.1.0/24 | {"start": "192.168.1.100", "end": "192.168.1.199"} |
| 43e2a1a6-3920-437e-8f4f-60f04a3cab91 | subnet-ext | 99f200eba89b49a9b89a981ec76813e1 | 10.136.136.0/24 | {"start": "10.136.136.100", "end": "10.136.136.199"} |
+--------------------------------------+----------------------+----------------------------------+-----------------+------------------------------------------------------+
[root@hamim-controller ~(keystone_admin)]#
Cek network list dan pastikan pemetaan subnet diatas sudah benar
1
2
3
4
5
6
7
8
9
10
[root@hamim-controller ~(keystone_admin)]# neutron net-list
neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
+--------------------------------------+---------------+----------------------------------+------------------------------------------------------+
| id | name | tenant_id | subnets |
+--------------------------------------+---------------+----------------------------------+------------------------------------------------------+
| 4517136f-2436-41ba-a7c3-b973e65bd54a | net-internal1 | 99f200eba89b49a9b89a981ec76813e1 | 132a0c29-9cba-4451-b24c-619fbe700181 192.168.1.0/24 |
| a747188f-09de-496d-95a4-908d7d6262e6 | net-int | 99f200eba89b49a9b89a981ec76813e1 | 0e627d43-60fe-4a49-bfc6-3baec80087e1 192.168.10.0/24 |
| b077b37f-c38a-4759-b504-bbf4f91d3e94 | net-ext | 99f200eba89b49a9b89a981ec76813e1 | 43e2a1a6-3920-437e-8f4f-60f04a3cab91 10.136.136.0/24 |
+--------------------------------------+---------------+----------------------------------+------------------------------------------------------+
[root@hamim-controller ~(keystone_admin)]#
Selamat mencoba 😁