OpenStack Kilo : Neutron ネットワーク構成(FLAT)2015/06/13 |
OpenStack Network Service(Neutron)による仮想ネットワークの構成です。
また、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 # 最終行に追記
[ovs]
flat_networks = physnet1 bridge_mappings = physnet1:br-eth1 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 | 2628a0a1-8eec-4ff1-ab52-ea0fc2859720 | | 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 | 4e84300cbeeb4a68a0e1864ea0ae1869 | +---------------------------+--------------------------------------+ # 作成した「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.10 \ --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.10 | | enable_dhcp | True | | gateway_ip | 10.0.0.1 | | host_routes | | | id | 7fb33a0f-301a-430b-b649-7b58c81afb48 | | ip_version | 4 | | ipv6_address_mode | | | ipv6_ra_mode | | | name | | | network_id | 2628a0a1-8eec-4ff1-ab52-ea0fc2859720 | | subnetpool_id | | | tenant_id | 4e84300cbeeb4a68a0e1864ea0ae1869 | +-------------------+----------------------------------------------+ # 設定確認 [root@dlp ~(keystone)]# neutron net-list +--------------------------------------+------------+--------------------------------------------------+ | id | name | subnets | +--------------------------------------+------------+--------------------------------------------------+ | 2628a0a1-8eec-4ff1-ab52-ea0fc2859720 | sharednet1 | 7fb33a0f-301a-430b-b649-7b58c81afb48 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 | +--------------------------------------+---------+--------+--------+ | 2aab2d1a-e1e8-45c9-81a0-0c76a3c98ee5 | CentOS7 | ACTIVE | | +--------------------------------------+---------+--------+--------+
[root@dlp ~(keystone)]#
[root@dlp ~(keystone)]# nova boot --flavor 2 --image CentOS7 --security_group default --nic net-id=$netID CentOS_7
nova list +-----------+----------+--------+------------+-------------+-----------------------+ | ID | Name | Status | Task State | Power State | Networks | +-----------+----------+--------+------------+-------------+-----------------------+ | 3b20e6e3- | 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 | 8ab227d0-fac6-404f-a482-51bc976d1575 | | port_range_max | | | port_range_min | | | protocol | icmp | | remote_group_id | | | remote_ip_prefix | | | security_group_id | bb435945-4e05-4394-a780-f6e1fb9ca942 | | tenant_id | 98ea1b896d3a48438922c0dfa9f6bc52 | +-------------------+--------------------------------------+ # 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 | d0d5214d-2334-4a60-80af-5a7cd643d7d8 | | port_range_max | 22 | | port_range_min | 22 | | protocol | tcp | | remote_group_id | | | remote_ip_prefix | | | security_group_id | bb435945-4e05-4394-a780-f6e1fb9ca942 | | tenant_id | 98ea1b896d3a48438922c0dfa9f6bc52 | +-------------------+--------------------------------------+[root@dlp ~(keystone)]# neutron security-group-rule-list +--------------------------------------+----------------+-----------+----------+------------------+--------------+ | id | security_group | direction | protocol | remote_ip_prefix | remote_group | +--------------------------------------+----------------+-----------+----------+------------------+--------------+ | 13b520a3-ddac-4947-84cd-729aaa0312ee | default | egress | | | | | 5462edf6-6728-4f1e-b69f-0067a0269483 | default | ingress | | | default | | 8ab227d0-fac6-404f-a482-51bc976d1575 | default | ingress | icmp | | | | 9932dc71-3be7-4881-9b9b-1a2a9374ecaf | default | ingress | | | default | | d0d5214d-2334-4a60-80af-5a7cd643d7d8 | default | ingress | tcp | | | | fb494738-bedb-46d6-a6cb-f15b3c6979a0 | default | egress | | | | +--------------------------------------+----------------+-----------+----------+------------------+--------------+ |
[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 50:9a:4d:de:6a:9b:8f:ec:7e:27:7a:69:6c:12:c7:3d. 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: Wed Jun 10 21:40:45 2015 [root@host-10-0-0-201 ~]# # ログインできた
|
Sponsored Link |