OpenStack Havana - Neutron 利用例#12013/10/29 |
OpenStack Network Service(Neutron)による仮想ネットワークの設定です。
また、ネットワークノードと計算ノードはネットワークインターフェースを二つ持っていることを前提とし、
ここでは「eth1」に内部用ネットワークを割り当てるように設定します。(よって「eth1」のIPアドレスは事前に未割り当てにしてあります)
|
[1] | まずは制御ノードでの設定です。 |
[root@dlp ~(keystone)]#
vi /etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini # 最終行に追記
[OVS]
tenant_network_type = vlan network_vlan_ranges = physnet1 bridge_mappings = physnet1:br-eth1 /etc/rc.d/init.d/neutron-server restart Stopping neutron: [ OK ] Starting neutron: [ OK ] |
[2] | ネットワークノード、および、計算ノードの両方で以下の設定をしてください。 |
[root@network ~(neutron)]# ovs-vsctl add-br br-eth1 # ブリッジ追加 [root@network ~(neutron)]# ovs-vsctl add-port br-eth1 eth1 # 追加したブリッジのポートにeth1を追加
[root@network ~(neutron)]#
vi /etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini # 最終行に追記
[OVS]
tenant_network_type = vlan network_vlan_ranges = physnet1 bridge_mappings = physnet1:br-eth1 /etc/rc.d/init.d/neutron-openvswitch-agent restart Stopping neutron-openvswitch-agent: [ OK ] Starting neutron-openvswitch-agent: [ OK ] |
[3] | ネットワークを作成します。作業場所はどこでもよいですが、ここでは計算ノード上で作業しています。 |
[root@node01 ~(keystone)]# keystone tenant-list +----------------------------------+---------+---------+ | id | name | enabled | +----------------------------------+---------+---------+ | 97be94660c2043e58fee407bc9cde0d5 | admin | True | | 17867024fb23470f8005a15c6ccfed44 | service | True | +----------------------------------+---------+---------+ # 「sharednet1」という名前のネットワークを作成 [root@node01 ~(keystone)]# neutron net-create --tenant-id 17867024fb23470f8005a15c6ccfed44 sharednet1 --shared --provider:network_type flat --provider:physical_network physnet1 Created a new network: +---------------------------+--------------------------------------+ | Field | Value | +---------------------------+--------------------------------------+ | admin_state_up | True | | id | cd40926d-9ed9-41bf-8a9d-8bec6f0152cb | | name | sharednet1 | | provider:network_type | flat | | provider:physical_network | physnet1 | | provider:segmentation_id | | | shared | True | | status | ACTIVE | | subnets | | | tenant_id | 17867024fb23470f8005a15c6ccfed44 | +---------------------------+--------------------------------------+ # 作成した「sharednet1」に「192.168.100.0/24」のサブネットを作成 [root@node01 ~(keystone)]# neutron subnet-create --tenant-id 17867024fb23470f8005a15c6ccfed44 sharednet1 192.168.100.0/24 Created a new subnet: +------------------+------------------------------------------------------+ | Field | Value | +------------------+------------------------------------------------------+ | allocation_pools | {"start": "192.168.100.2", "end": "192.168.100.254"} | | cidr | 192.168.100.0/24 | | dns_nameservers | | | enable_dhcp | True | | gateway_ip | 192.168.100.1 | | host_routes | | | id | fe865e29-0409-49f5-b2c9-367d9c885987 | | ip_version | 4 | | name | | | network_id | cd40926d-9ed9-41bf-8a9d-8bec6f0152cb | | tenant_id | 17867024fb23470f8005a15c6ccfed44 | +------------------+------------------------------------------------------+ # 設定確認 [root@node01 ~(keystone)]# neutron net-list +--------------------------------------+------------+-------------------------------------------------------+ | id | name | subnets | +--------------------------------------+------------+-------------------------------------------------------+ | cd40926d-9ed9-41bf-8a9d-8bec6f0152cb | sharednet1 | fe865e29-0409-49f5-b2c9-367d9c885987 192.168.100.0/24 | +--------------------------------------+------------+-------------------------------------------------------+ |
[4] | 作成したネットワークをインスタンスに紐付けてインスタンスを作成・起動します。 |
[root@node01 ~(keystone)]# nova image-list +--------------------------------------+---------+--------+--------+ | ID | Name | Status | Server | +--------------------------------------+---------+--------+--------+ | 46042f47-c307-4fce-af0d-a1b2c14d6d78 | CentOS6 | ACTIVE | | +--------------------------------------+---------+--------+--------+
[root@node01 ~(keystone)]#
[root@node01 ~(keystone)]# nova boot --flavor 2 --image CentOS6 --security_group default --nic net-id=cd40926d-9ed9-41bf-8a9d-8bec6f0152cb CentOS_64
nova list +--------------------------------------+-----------+--------+------------+-------------+--------------------------+ | ID | Name | Status | Task State | Power State | Networks | +--------------------------------------+-----------+--------+------------+-------------+--------------------------+ | 9b9f2275-7f3d-428c-ae2d-8f9fe02fcbcb | CentOS_64 | ACTIVE | None | Running | sharednet1=192.168.100.2 | +--------------------------------------+-----------+--------+------------+-------------+--------------------------+ # br-eth1 にインスタンスと同一ネットワークの 192.168.100.10/24 を割り当てる [root@node01 ~(keystone)]# ip addr add 192.168.100.10/24 dev br-eth1 # インスタンスにログイン [root@node01 ~(keystone)]# ssh 192.168.100.2 The authenticity of host '192.168.100.2 (192.168.100.2)' can't be established. RSA key fingerprint is xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:a5:3c:84. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '192.168.100.2' (RSA) to the list of known hosts. root@192.168.100.2's password: Last login: Wed Oct 23 04:40:30 2013 [root@host-192-168-100-2 ~]# # ログインできた |
Sponsored Link |
|