OpenStack Icehouse : ネットワーク構成#12014/06/25 |
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 # ブリッジ追加 [root@network ~]# ovs-vsctl add-port br-eth1 eth1 # 追加したブリッジのポートにeth1を追加
[root@network ~]#
vi /etc/neutron/plugins/ml2/ml2_conf.ini # 最終行に追記
[ovs]
flat_networks = 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 ] |
[2] | ネットワークを作成します。作業場所はどこでもよいですが、ここでは Control ノード上で作業します。 |
[root@dlp ~(keystone)]#
tenantID=`keystone tenant-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 | 8291f377-18b4-4315-a397-6fdc358680d9 | | name | sharednet1 | | provider:network_type | flat | | provider:physical_network | physnet1 | | provider:segmentation_id | | | shared | True | | status | ACTIVE | | subnets | | | tenant_id | fc294b687db2410189f7c8bd81efe426 | +---------------------------+--------------------------------------+ # 作成した「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 | 7940c0df-c16f-4c47-853b-045682ce2b39 | | ip_version | 4 | | name | | | network_id | 8291f377-18b4-4315-a397-6fdc358680d9 | | tenant_id | fc294b687db2410189f7c8bd81efe426 | +------------------+----------------------------------------------+ # 設定確認 [root@dlp ~(keystone)]# neutron net-list +--------------------------------------+------------+--------------------------------------------------+ | id | name | subnets | +--------------------------------------+------------+--------------------------------------------------+ | 8291f377-18b4-4315-a397-6fdc358680d9 | sharednet1 | 7940c0df-c16f-4c47-853b-045682ce2b39 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 | +--------------------------------------+---------+--------+--------+ | 04ea6c45-c928-4df9-bb12-d3728a3d9a74 | CentOS6 | ACTIVE | | +--------------------------------------+---------+--------+--------+
[root@dlp ~(keystone)]#
[root@dlp ~(keystone)]# nova boot --flavor 2 --image CentOS6 --security_group default --nic net-id=$netID CentOS_66
nova list +-----------+-----------+--------+------------+-------------+--------------------------+ | ID | Name | Status | Task State | Power State | Networks | +-----------+-----------+--------+------------+-------------+--------------------------+ | bbfe0a8e- | CentOS_66 | ACTIVE | - | Running | sharednet1=10.0.0.200 | +-----------+-----------+--------+------------+-------------+--------------------------+ |
[4] | 起動した仮想マシンインスタンスにSSHで接続できるように、デフォルトセキュリティグループにポート許可の設定をしておきます。 |
# SSH 許可 [root@dlp ~(keystone)]# nova secgroup-add-rule default tcp 22 22 0.0.0.0/0 +-------------+-----------+---------+-----------+--------------+ | IP Protocol | From Port | To Port | IP Range | Source Group | +-------------+-----------+---------+-----------+--------------+ | tcp | 22 | 22 | 0.0.0.0/0 | | +-------------+-----------+---------+-----------+--------------+ # ICMP 許可 [root@dlp ~(keystone)]# nova secgroup-add-rule default icmp -1 -1 0.0.0.0/0 +-------------+-----------+---------+-----------+--------------+ | IP Protocol | From Port | To Port | IP Range | Source Group | +-------------+-----------+---------+-----------+--------------+ | icmp | -1 | -1 | 0.0.0.0/0 | | +-------------+-----------+---------+-----------+--------------+[root@dlp ~(keystone)]# nova secgroup-list-rules default +-------------+-----------+---------+-----------+--------------+ | IP Protocol | From Port | To Port | IP Range | Source Group | +-------------+-----------+---------+-----------+--------------+ | tcp | 22 | 22 | 0.0.0.0/0 | | | icmp | -1 | -1 | 0.0.0.0/0 | | +-------------+-----------+---------+-----------+--------------+ |
[5] | インスタンスにログインします。 |
[root@dlp ~(keystone)]# ssh 10.0.0.200 The authenticity of host '10.0.0.200 (10.0.0.200)' can't be established. RSA key fingerprint is xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:76:84:a6. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '10.0.0.200' (RSA) to the list of known hosts. root@192.168.100.3's password: Last login: Thu Jun 26 01:50:50 2014 [root@host-10.0.0.200 ~]# # ログインできた
|
Sponsored Link |