CentOS 7
Sponsored Link

OpenStack Liberty : Neutron ネットワーク構成(FLAT)
2015/11/15
 
OpenStack Network Service(Neutron)による仮想ネットワークの構成です。
例として、FLAT タイプのプロバイダーネットワークを構成します。
Control ノードNetwork ノードCompute ノードはそれぞれ事前に基本設定をしておいてください。
また、Network ノードと Compute ノードはネットワークインターフェースを二つ持っていることを前提とします。

                                        |
  +-------------+                  +----+----+
  | Name Server |                  | Gateway |
  +------+------+                  +----+----+
         |10.0.0.10                     |10.0.0.1
         |                              |
         +------------+-----------------+------------------+
         |            |                 |                  |     10.0.0.200-10.0.0.250
     eth0|10.0.0.30   |             eth0|10.0.0.50         |         +-----------------+
+--------+---------+  |     +-----------+----------+       |     +---| Virtual Machine |
| [ Control Node ] |  |     |   [ Network Node ]   |       |     |   +-----------------+
|     Keystone     |  |     |       DHCP Agent     |       |     |   +-----------------+
|      Glance      |  |     |       L3 Agent       |eth1   |     |---| Virtual Machine |
|     Nova API     |  |     |       L2 Agent       |       |     |   +-----------------+
|  Neutron Server  |  |     |    Metadata Agent    |       |     |   +-----------------+
+------------------+  |     +----------------------+       +-----+---| Virtual Machine |
                      |                                          |   +-----------------+
                      |     +----------------------+             |   +-----------------+
                      | eth0|   [ Compute Node ]   |             |---| Virtual Machine |
                      +-----|     Nova Compute     |eth1         |   +-----------------+
                   10.0.0.51|       L2 Agent       |             |   +-----------------+
                            +----------------------+             +---| Virtual Machine |
                                                                     +-----------------+

[1] Network ノード、および Compute ノードの両方で以下のように設定します。
# ブリッジ追加

[root@network ~]#
ovs-vsctl add-br br-eth1

# 追加したブリッジのポートにeth1を追加

[root@network ~]#
ovs-vsctl add-port br-eth1 eth1

[root@network ~]#
vi /etc/neutron/plugins/ml2/ml2_conf.ini
# 65行目あたり:追記

[ml2_type_flat]
flat_networks = physnet1
[root@network ~]#
vi /etc/neutron/plugins/ml2/openvswitch_agent.ini
# 2行目:追記

[ovs]
bridge_mappings = physnet1:br-eth1
[root@network ~]#
systemctl restart neutron-openvswitch-agent

[2] ネットワークを作成します。作業場所はどこでもよいですが、ここでは Control ノード上で作業します。
[root@dlp ~(keystone)]#
tenantID=`openstack project list | grep service | awk '{print $2}'`
# 「sharednet1」という名前のネットワークを作成

[root@dlp ~(keystone)]#
neutron net-create --tenant-id $tenantID sharednet1 \
--shared --provider:network_type flat --provider:physical_network physnet1

Created a new network:
+---------------------------+--------------------------------------+
| Field                     | Value                                |
+---------------------------+--------------------------------------+
| admin_state_up            | True                                 |
| id                        | 0ff058fc-b4bf-4d94-b467-fb51090b613d |
| mtu                       | 0                                    |
| name                      | sharednet1                           |
| provider:network_type     | flat                                 |
| provider:physical_network | physnet1                             |
| provider:segmentation_id  |                                      |
| router:external           | False                                |
| shared                    | True                                 |
| status                    | ACTIVE                               |
| subnets                   |                                      |
| tenant_id                 | 11a4bfa2b8c748ad860efb34b5fefb7f     |
+---------------------------+--------------------------------------+

# 作成した「sharednet1」に「10.0.0.0/24」のサブネットを作成

[root@dlp ~(keystone)]#
neutron subnet-create \
--tenant-id $tenantID --gateway 10.0.0.1 --dns-nameserver 10.0.0.1 \
--allocation-pool start=10.0.0.200,end=10.0.0.250 sharednet1 10.0.0.0/24

Created a new subnet:
+-------------------+----------------------------------------------+
| Field             | Value                                        |
+-------------------+----------------------------------------------+
| allocation_pools  | {"start": "10.0.0.200", "end": "10.0.0.250"} |
| cidr              | 10.0.0.0/24                                  |
| dns_nameservers   | 10.0.0.1                                     |
| enable_dhcp       | True                                         |
| gateway_ip        | 10.0.0.1                                     |
| host_routes       |                                              |
| id                | 44f0c8f5-53d3-4cf4-acc0-529212b307b2         |
| ip_version        | 4                                            |
| ipv6_address_mode |                                              |
| ipv6_ra_mode      |                                              |
| name              |                                              |
| network_id        | 0ff058fc-b4bf-4d94-b467-fb51090b613d         |
| subnetpool_id     |                                              |
| tenant_id         | 11a4bfa2b8c748ad860efb34b5fefb7f             |
+-------------------+----------------------------------------------+

# 設定確認

[root@dlp ~(keystone)]#
neutron net-list

+--------------------------------------+------------+--------------------------------------------------+
| id                                   | name       | subnets                                          |
+--------------------------------------+------------+--------------------------------------------------+
| 0ff058fc-b4bf-4d94-b467-fb51090b613d | sharednet1 | 44f0c8f5-53d3-4cf4-acc0-529212b307b2 10.0.0.0/24 |
+--------------------------------------+------------+--------------------------------------------------+
[3] 作成したネットワークをインスタンスに紐付けてインスタンスを作成・起動します。
[root@dlp ~(keystone)]#
netID=`neutron net-list | grep sharednet1 | awk '{print $2}'`

[root@dlp ~(keystone)]#
nova image-list

+--------------------------------------+---------+--------+--------+
| ID                                   | Name    | Status | Server |
+--------------------------------------+---------+--------+--------+
| 34beed31-2971-43f0-9c5a-d39d3df1d501 | CentOS7 | ACTIVE |        |
+--------------------------------------+---------+--------+--------+

[root@dlp ~(keystone)]#
nova boot --flavor 2 --image CentOS7 --security_group default --nic net-id=$netID CentOS_7
[root@dlp ~(keystone)]#
nova list

+-----------+----------+--------+------------+-------------+-----------------------+
| ID        | Name     | Status | Task State | Power State | Networks              |
+-----------+----------+--------+------------+-------------+-----------------------+
| d2940d50- | CentOS_7 | ACTIVE | -          | Running     | sharednet1=10.0.0.201 |
+-----------+----------+--------+------------+-------------+-----------------------+
[4] 起動した仮想マシンインスタンスにSSHで接続できるように、デフォルトセキュリティグループにポート許可の設定をしておきます。
# ICMP 許可

[root@dlp ~(keystone)]#
neutron security-group-rule-create --direction ingress --protocol icmp default

Created a new security_group_rule:
+-------------------+--------------------------------------+
| Field             | Value                                |
+-------------------+--------------------------------------+
| direction         | ingress                              |
| ethertype         | IPv4                                 |
| id                | db4c60a3-cc3a-402d-94e0-e0484d8e68c9 |
| port_range_max    |                                      |
| port_range_min    |                                      |
| protocol          | icmp                                 |
| remote_group_id   |                                      |
| remote_ip_prefix  |                                      |
| security_group_id | 7a196ffd-a7d0-49ff-8771-cde18d299d72 |
| tenant_id         | d625e02b3d394afbad250def2f88fefa     |
+-------------------+--------------------------------------+

# SSH 許可

[root@dlp ~(keystone)]#
neutron security-group-rule-create --direction ingress --protocol tcp --port_range_min 22 --port_range_max 22 default

Created a new security_group_rule:
+-------------------+--------------------------------------+
| Field             | Value                                |
+-------------------+--------------------------------------+
| direction         | ingress                              |
| ethertype         | IPv4                                 |
| id                | f19c4f1f-7055-4a8e-8b6a-67282ea5819a |
| port_range_max    | 22                                   |
| port_range_min    | 22                                   |
| protocol          | tcp                                  |
| remote_group_id   |                                      |
| remote_ip_prefix  |                                      |
| security_group_id | 7a196ffd-a7d0-49ff-8771-cde18d299d72 |
| tenant_id         | d625e02b3d394afbad250def2f88fefa     |
+-------------------+--------------------------------------+

[root@dlp ~(keystone)]#
neutron security-group-rule-list

+--------------------------------------+----------------+-----------+-----------+---------------+-----------------+
| id                                   | security_group | direction | ethertype | protocol/port | remote          |
+--------------------------------------+----------------+-----------+-----------+---------------+-----------------+
| 08262f7f-584f-4f26-933b-ab7a4dc888a9 | default        | ingress   | IPv4      | any           | default (group) |
| aff0d3dc-ed67-4e8b-85c6-e2eb42311fe3 | default        | egress    | IPv4      | any           | any             |
| bcacccd1-5424-4407-8b9b-5002ef035be4 | default        | egress    | IPv6      | any           | any             |
| cbd0e7e6-a372-410e-9d33-0f6ae7c7a2e0 | default        | ingress   | IPv6      | any           | default (group) |
| db4c60a3-cc3a-402d-94e0-e0484d8e68c9 | default        | ingress   | IPv4      | icmp          | any             |
| f19c4f1f-7055-4a8e-8b6a-67282ea5819a | default        | ingress   | IPv4      | 22/tcp        | any             |
+--------------------------------------+----------------+-----------+-----------+---------------+-----------------+
[5] インスタンスにログインします。
[root@dlp ~(keystone)]#
ssh 10.0.0.201

The authenticity of host '10.0.0.201 (10.0.0.201)' can't be established.
ECDSA key fingerprint is 03:3d:a6:2c:21:0d:03:cc:de:29:d1:c0:3b:4d:4c:e7.
Are you sure you want to continue connecting (yes/no)?
yes

Warning: Permanently added '10.0.0.201' (ECDSA) to the list of known hosts.
root@10.0.0.201's password:
Last login: Sat Nov 14 21:10:58 2015
[root@host-10-0-0-201 ~]#    
# ログインできた
関連コンテンツ
 
Tweet