Openstack: Membuat Router via CLI
Belajar Linux ID - Tutorial kali ini merupakan kelanjutan dari tutorial sebelumnya atau bisa di bilang sebagai series dari tutorial sebelumnya mengenai openstack.
Untuk membuat router di Openstack terdapat 2 cara bisa melalui horizon dashboard atau CLI (Command Line Interface).
Untuk tutorial membuat router melalui dashboard horizon dapat Anda lihat pada link berikut: Openstack: Membuat Router
Berikut merupakan tahapan membuat router via CLI, sebelum itu mari kita lihat list router terlebih dahulu, gunakan perintah berikut
1
2
3
4
5
6
7
8
[root@hamim-controller ~(keystone_admin)]# neutron router-list
neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
+--------------------------------------+------------+----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------+-------+
| id | name | tenant_id | external_gateway_info | distributed | ha |
+--------------------------------------+------------+----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------+-------+
| a5b00947-db9a-4846-a202-f4b0c8f51a1c | router-int | 99f200eba89b49a9b89a981ec76813e1 | {"network_id": "b077b37f-c38a-4759-b504-bbf4f91d3e94", "enable_snat": true, "external_fixed_ips": [{"subnet_id": "43e2a1a6-3920-437e-8f4f-60f04a3cab91", "ip_address": "10.136.136.105"}]} | False | False |
+--------------------------------------+------------+----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------+-------+
[root@hamim-controller ~(keystone_admin)]#
Selanjutnya kita akan membuat router dengan nama router1
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
[root@hamim-controller ~(keystone_admin)]#
[root@hamim-controller ~(keystone_admin)]# neutron router-create router1
neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
Created a new router:
+-------------------------+--------------------------------------+
| Field | Value |
+-------------------------+--------------------------------------+
| admin_state_up | True |
| availability_zone_hints | |
| availability_zones | |
| created_at | 2020-09-24T11:27:22Z |
| description | |
| distributed | False |
| external_gateway_info | |
| flavor_id | |
| ha | False |
| id | e2214ca3-1074-489d-acb2-84e4c3d75c5d |
| name | router1 |
| project_id | 99f200eba89b49a9b89a981ec76813e1 |
| revision_number | 1 |
| routes | |
| status | ACTIVE |
| categories | |
| tenant_id | 99f200eba89b49a9b89a981ec76813e1 |
| updated_at | 2020-09-24T11:27:22Z |
+-------------------------+--------------------------------------+
[root@hamim-controller ~(keystone_admin)]#
Selanjutnya set gateway untuk router yang telah dibuat
1
2
3
4
5
[root@hamim-controller ~(keystone_admin)]#
[root@hamim-controller ~(keystone_admin)]# neutron router-gateway-set router1 net-ext
neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
Set gateway for router router1
[root@hamim-controller ~(keystone_admin)]#
Jika sudah set gateway secara otomatis network net-ext
akan di tambahkan ke router1
, selanjutnya Anda dapat menambahkan interface atau network baru ke router yang telah dibuat sebelumnya
1
2
3
4
5
[root@hamim-controller ~(keystone_admin)]#
[root@hamim-controller ~(keystone_admin)]# neutron router-interface-add router1 subnet-net-internal1
neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
Added interface ce1f89fc-168f-4a07-9075-4438937d63d5 to router router1.
[root@hamim-controller ~(keystone_admin)]#
Cek list router yang telah kita buat, seharusnya sudah ada 2 router
1
2
3
4
5
6
7
8
9
10
[root@hamim-controller ~(keystone_admin)]#
[root@hamim-controller ~(keystone_admin)]# neutron router-list
neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
+--------------------------------------+------------+----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------+-------+
| id | name | tenant_id | external_gateway_info | distributed | ha |
+--------------------------------------+------------+----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------+-------+
| a5b00947-db9a-4846-a202-f4b0c8f51a1c | router-int | 99f200eba89b49a9b89a981ec76813e1 | {"network_id": "b077b37f-c38a-4759-b504-bbf4f91d3e94", "enable_snat": true, "external_fixed_ips": [{"subnet_id": "43e2a1a6-3920-437e-8f4f-60f04a3cab91", "ip_address": "10.136.136.105"}]} | False | False |
| e2214ca3-1074-489d-acb2-84e4c3d75c5d | router1 | 99f200eba89b49a9b89a981ec76813e1 | {"network_id": "b077b37f-c38a-4759-b504-bbf4f91d3e94", "enable_snat": true, "external_fixed_ips": [{"subnet_id": "43e2a1a6-3920-437e-8f4f-60f04a3cab91", "ip_address": "10.136.136.104"}]} | False | False |
+--------------------------------------+------------+----------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------+-------+
[root@hamim-controller ~(keystone_admin)]#
Keterangan:
Router-int
: Router internal yang telah dibuat sebelumnya melalui horizonRouter1
: Router yang baru saja kita buat
Jika ingin melihat detail informasi dari router1
, gunakan perintah berikut
1
2
3
4
5
6
7
8
9
10
[root@hamim-controller ~(keystone_admin)]#
[root@hamim-controller ~(keystone_admin)]# neutron router-port-list router1
neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
+--------------------------------------+------+----------------------------------+-------------------+---------------------------------------------------------------------------------------+
| id | name | tenant_id | mac_address | fixed_ips |
+--------------------------------------+------+----------------------------------+-------------------+---------------------------------------------------------------------------------------+
| a7e42f6b-a057-4476-9478-fa9b2b4f23b6 | | | fa:16:3e:41:85:35 | {"subnet_id": "43e2a1a6-3920-437e-8f4f-60f04a3cab91", "ip_address": "10.136.136.104"} |
| ce1f89fc-168f-4a07-9075-4438937d63d5 | | 99f200eba89b49a9b89a981ec76813e1 | fa:16:3e:dc:e8:b6 | {"subnet_id": "132a0c29-9cba-4451-b24c-619fbe700181", "ip_address": "192.168.1.1"} |
+--------------------------------------+------+----------------------------------+-------------------+---------------------------------------------------------------------------------------+
[root@hamim-controller ~(keystone_admin)]#
Testing ping ke IP router1
yang telah dibuat, jika reply seperti berikut, menandakan router Anda sudah berhasil dibuat dengan baik dan benar
1
2
3
4
5
6
7
[root@hamim-controller ~(keystone_admin)]#
[root@hamim-controller ~(keystone_admin)]# ping -c4 10.136.136.104 |grep icmp
64 bytes from 10.136.136.104: icmp_seq=1 ttl=64 time=1.23 ms
64 bytes from 10.136.136.104: icmp_seq=2 ttl=64 time=0.062 ms
64 bytes from 10.136.136.104: icmp_seq=3 ttl=64 time=0.065 ms
64 bytes from 10.136.136.104: icmp_seq=4 ttl=64 time=0.057 ms
[root@hamim-controller ~(keystone_admin)]#
Itulah tahapan singkat bagaimana cara membuat router openstack via CLI.
Selamat mencoba 😁