無法存取使用 Microstack 啟動的虛擬機器 - 目標主機無法存取

無法存取使用 Microstack 啟動的虛擬機器 - 目標主機無法存取

我安裝了它Microstack,並試圖Openstack透過在網路上找到的糟糕文件來了解它的操作。我嘗試訪問一些已啟動的虛擬機,但沒有成功。已經Microstack創建了以下兩個網路:

microstack.openstack network list
+--------------------------------------+----------+--------------------------------------+
| ID                                   | Name     | Subnets                              |
+--------------------------------------+----------+--------------------------------------+
| 750286d8-2801-4dd3-85d8-85b0e4219b46 | test     | fbe5a4e4-34c7-4b39-a4e5-a447431d78dc |
| e9d9520f-3ad7-4f96-bff5-060beb1c0161 | external | 3041f82a-9be5-4f47-84a4-6229e5eb60cb |

下面,我列出了用於啟動虛擬機器的安全群組:

microstack.openstack security group show 3c69498c-c210-48c8-ba43-fbf60a0c224e
+-----------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field           | Value                                                                                                                                                                                                                                          |
+-----------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| created_at      | 2020-08-14T17:54:45Z                                                                                                                                                                                                                           |
| description     | Default security group                                                                                                                                                                                                                         |
| id              | 3c69498c-c210-48c8-ba43-fbf60a0c224e                                                                                                                                                                                                           |
| location        | Munch({'cloud': '', 'region_name': '', 'zone': None, 'project': Munch({'id': '37f73779b3cd42dc96044ea0fd6d1e98', 'name': 'admin', 'domain_id': None, 'domain_name': 'default'})})                                                              |
| name            | default                                                                                                                                                                                                                                        |
| project_id      | 37f73779b3cd42dc96044ea0fd6d1e98                                                                                                                                                                                                               |
| revision_number | 3                                                                                                                                                                                                                                              |
| rules           | created_at='2020-08-14T17:54:45Z', direction='egress', ethertype='IPv6', id='1e5c2fed-7c7a-4dd4-9e11-c87d0de012ee', updated_at='2020-08-14T17:54:45Z'                                                                                          |
|                 | created_at='2020-08-14T17:54:45Z', direction='ingress', ethertype='IPv4', id='36394ec6-0f35-4b26-9788-61bf76a08088', remote_group_id='3c69498c-c210-48c8-ba43-fbf60a0c224e', updated_at='2020-08-14T17:54:45Z'                                 |
|                 | created_at='2020-08-14T17:54:45Z', direction='ingress', ethertype='IPv6', id='48986d96-ec57-4f49-aee8-6e1c68e273b1', remote_group_id='3c69498c-c210-48c8-ba43-fbf60a0c224e', updated_at='2020-08-14T17:54:45Z'                                 |
|                 | created_at='2020-08-14T17:56:16Z', direction='ingress', ethertype='IPv4', id='58816267-8df8-4a89-a9c5-31986a441365', port_range_max='22', port_range_min='22', protocol='tcp', remote_ip_prefix='0.0.0.0/0', updated_at='2020-08-14T17:56:16Z' |
|                 | created_at='2020-08-14T17:54:45Z', direction='egress', ethertype='IPv4', id='c75e9aa8-84f3-4d05-9d33-0da7892f7a07', updated_at='2020-08-14T17:54:45Z'                                                                                          |
|                 | created_at='2020-08-14T17:56:14Z', direction='ingress', ethertype='IPv4', id='d029b66c-219e-488d-93af-1f87a9d8b006', protocol='icmp', remote_ip_prefix='0.0.0.0/0', updated_at='2020-08-14T17:56:14Z'                                          |
| tags            | []                                                                                                                                                                                                                                             |
| updated_at      | 2020-08-14T17:56:16Z                                                                                                                                                                                                                           |
+-----------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

我已經啟動了兩個Ubuntu具有可用網路(testexternal)的虛擬機,如下所示:

microstack.openstack server list
+--------------------------------------+-------------+--------+-----------------------------------+-------------+-----------+
| ID                                   | Name        | Status | Networks                          | Image       | Flavor    |
+--------------------------------------+-------------+--------+-----------------------------------+-------------+-----------+
| 4bd80f7c-8c16-4b15-9973-887f0f2517ff | test1   | ACTIVE | external=10.20.20.197             | ubuntu_1804 | m1.medium |
| ca2e690e-e679-4fd7-a507-07f12bcf1c5e | test2   | ACTIVE | test=192.168.222.141              | ubuntu_1804 | m1.medium |

這是用於啟動虛擬機器的命令:

microstack.openstack server create --flavor m1.medium --image ubuntu_1804 \
--nic net-id=e9d9520f-3ad7-4f96-bff5-060beb1c0161 --key-name mykey \
--security-group 3c69498c-c210-48c8-ba43-fbf60a0c224e test1

然後,當我嘗試存取兩個已啟動的虛擬機器時,我得到Destination Host Unreachable

ping 10.20.20.197
PING 10.20.20.197 (10.20.20.197) 56(84) bytes of data.
From 10.20.20.1 icmp_seq=1 Destination Host Unreachable

ping 192.168.222.141
PING 192.168.222.141 (192.168.222.141) 56(84) bytes of data.
From 192.168.131.133 icmp_seq=1 Destination Host Unreachable

誰能解釋一下我錯過了什麼嗎?

答案1

現在我對Openstack有了一些了解,我認為問題是缺少浮動IP。下面,我列出了將浮動 IP 關聯到虛擬機器所需的步驟,並可能解決該問題。

  1. external為您的網路建立浮動IP :

    microstack.openstack floating ip create external
    
  2. 建立一個路由器來通訊兩個網路(內部和外部):

    microstack.openstack router create router1
    
  3. 將網路加入external路由器:

    microstack.openstack router set router1 --external-gateway external
    
  4. 將您的私人子網路新增至路由器(假設您的子網路 ID 是f16b8b8c-482e-4cf5-a5d6-74e284b7e0f1):

    microstack.openstack router add subnet router1 f16b8b8c-482e-4cf5-a5d6-74e284b7e0f1
    
  5. 將浮動 IP 關聯到您的虛擬機器(假設已建立的 IP 為10.20.20.92):

    microstack.openstack server add floating ip server_micro 10.20.20.92
    

現在您應該能夠存取ping虛擬機器並通過ssh.

相關內容