next up previous contents
Next: 驗證 Up: Instance Previous: 存取 Instance cirros   Contents

使用 provider network 新增 Instance crtusb

  1. 載入用戶 demo 的環境變數。
    [root@controller ~]# . demo.token
    
  2. 再列一次必要環境。
    [root@controller ~]# openstack flavor list
    +----+---------+------+------+-----------+-------+-----------+
    | ID | Name    |  RAM | Disk | Ephemeral | VCPUs | Is Public |
    +----+---------+------+------+-----------+-------+-----------+
    | 0  | m1.nano |   64 |    1 |         0 |     1 | True      |
    | 1  | m1.crt  | 4096 |   16 |         0 |     2 | True      |
    +----+---------+------+------+-----------+-------+-----------+
    [root@controller ~]# openstack image list
    +--------------------------------------+--------+--------+
    | ID                                   | Name   | Status |
    +--------------------------------------+--------+--------+
    | 5bb44bde-d1e8-4937-b0fc-d3cdab6929c5 | cirros | active |
    | e4bea3db-581a-472d-a0dd-37b1e7055bbf | crtusb | active |
    +--------------------------------------+--------+--------+
    [root@controller ~]# openstack network list
    +--------------------------------------+-------------+--------------------------------------+
    | ID                                   | Name        | Subnets                              |
    +--------------------------------------+-------------+--------------------------------------+
    | 0b0ebcee-057b-4798-bf73-5dd449e7879a | provider    | 2a7287d7-4a4f-43cc-beb2-bc9c023af929 |
    | 37d0dee7-d573-4f3b-863d-c92c05b6dbbb | selfservice | 36c70394-9a28-4cdf-bfee-9c65f4512027 |
    +--------------------------------------+-------------+--------------------------------------+
    [root@controller ~]# openstack security group list
    +--------------------------------------+---------+------------------------+----------------------------------+
    | ID                                   | Name    | Description            | Project                          |
    +--------------------------------------+---------+------------------------+----------------------------------+
    | 1f149288-87c2-43b5-a3b3-89eb153c9249 | default | Default security group | 92d1ec3e04384ad599c1a8f5aed73663 |
    +--------------------------------------+---------+------------------------+----------------------------------+
    
  3. 以 flavor m1.crt, image crtusb, network selfservice, security group default 新增名為 crt1 的 server。
    [root@controller ~]# openstack server create --flavor m1.crt --image crtusb \
    --nic net-id=0b0ebcee-057b-4798-bf73-5dd449e7879a --security-group default \
    --key-name mykey crt1
    +-----------------------------+-----------------------------------------------+
    | Field                       | Value                                         |
    +-----------------------------+-----------------------------------------------+
    | OS-DCF:diskConfig           | MANUAL                                        |
    | OS-EXT-AZ:availability_zone |                                               |
    | OS-EXT-STS:power_state      | NOSTATE                                       |
    | OS-EXT-STS:task_state       | scheduling                                    |
    | OS-EXT-STS:vm_state         | building                                      |
    | OS-SRV-USG:launched_at      | None                                          |
    | OS-SRV-USG:terminated_at    | None                                          |
    | accessIPv4                  |                                               |
    | accessIPv6                  |                                               |
    | addresses                   |                                               |
    | adminPass                   | YURzGpQ8sK2r                                  |
    | config_drive                |                                               |
    | created                     | 2018-05-27T08:51:58Z                          |
    | flavor                      | m1.crt (1)                                    |
    | hostId                      |                                               |
    | id                          | 60da86d9-bb99-4a20-80cd-6c62581d6276          |
    | image                       | crtusb (e4bea3db-581a-472d-a0dd-37b1e7055bbf) |
    | key_name                    | mykey                                         |
    | name                        | crt1                                          |
    | progress                    | 0                                             |
    | project_id                  | 92d1ec3e04384ad599c1a8f5aed73663              |
    | properties                  |                                               |
    | security_groups             | name='1f149288-87c2-43b5-a3b3-89eb153c9249'   |
    | status                      | BUILD                                         |
    | updated                     | 2018-05-27T08:51:58Z                          |
    | user_id                     | 0d7bb3820384452abb97ec0b40c445b1              |
    | volumes_attached            |                                               |
    +-----------------------------+-----------------------------------------------+
    
  4. 列出 server,目前有兩台 VM,一台使用 selfservice network 的 cirros1,IP 為 192.168.10.5,另一台使用 provider network 剛新增的 crt1,自動取得 IP 為 163.17.10.115。
    [root@controller ~]# openstack server list
    +--------------------------------------+---------+--------+--------------------------+--------+---------+
    | ID                                   | Name    | Status | Networks                 | Image  | Flavor  |
    +--------------------------------------+---------+--------+--------------------------+--------+---------+
    | 60da86d9-bb99-4a20-80cd-6c62581d6276 | crt1    | ACTIVE | provider=163.17.10.115   | crtusb | m1.crt  |
    | bfaefe36-2310-4241-bbea-e02e1a4a482f | cirros1 | ACTIVE | selfservice=192.168.10.5 | cirros | m1.nano |
    +--------------------------------------+---------+--------+--------------------------+--------+---------+
    
  5. 成功 ping 163.17.10.115。
    [root@controller ~]# ping -c3 163.17.10.115
    PING 163.17.10.115 (163.17.10.115) 56(84) bytes of data.
    64 bytes from 163.17.10.115: icmp_seq=1 ttl=64 time=1.65 ms
    64 bytes from 163.17.10.115: icmp_seq=2 ttl=64 time=1.64 ms
    64 bytes from 163.17.10.115: icmp_seq=3 ttl=64 time=7.86 ms
    
    --- 163.17.10.115 ping statistics ---
    3 packets transmitted, 3 received, 0% packet loss, time 2003ms
    rtt min/avg/max/mdev = 1.640/3.721/7.868/2.932 ms
    
  6. SSH 成功 連線 163.17.10.115。
    [root@controller ~]# ssh 163.17.10.115
    The authenticity of host '163.17.10.115 (163.17.10.115)' can't be established.
    RSA key fingerprint is SHA256:bVYrBjLSTxVa7SleYd3ADBhysnzIUiOyxRYbcKrckjo.
    RSA key fingerprint is MD5:9e:5d:fa:d4:3c:ea:66:e4:2c:4e:46:99:ca:14:c7:07.
    Are you sure you want to continue connecting (yes/no)? yes
    Warning: Permanently added '163.17.10.115' (RSA) to the list of known hosts.
    root@163.17.10.115's password: 
    [root@deyu ~]# exit
    logout
    Connection to 163.17.10.115 closed.
    [root@controller ~]#
    



De-Yu Wang 2018-08-15