OpenStack Icehouse : ネットワーク構成#12014/05/23 |
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 # 27行目あたりに追記 [ml2_type_flat] flat_networks = physnet1
# 最終行に追記
[ovs]
bridge_mappings = physnet1:br-eth1 service neutron-plugin-openvswitch-agent restart neutron-plugin-openvswitch-agent stop/waiting neutron-plugin-openvswitch-agent start/running, process 5682 |
[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 | 02d7350f-dc6e-4fdc-b47c-a88c5e51d442 | | name | sharednet1 | | provider:network_type | flat | | provider:physical_network | physnet1 | | provider:segmentation_id | | | shared | True | | status | ACTIVE | | subnets | | | tenant_id | 45fa65597c464d48a20be990f660a27b | +---------------------------+--------------------------------------+ # 作成した「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 | b852ce6a-b1a0-4199-b7ee-50cfa835bc35 | | ip_version | 4 | | name | | | network_id | 02d7350f-dc6e-4fdc-b47c-a88c5e51d442 | | tenant_id | 45fa65597c464d48a20be990f660a27b | +------------------+----------------------------------------------+ # 設定確認 root@dlp ~(keystone)# neutron net-list +-----------+------------+--------------------------------------------------+ | id | name | subnets | +-----------+------------+--------------------------------------------------+ | 02d7350f- | sharednet1 | b852ce6a-b1a0-4199-b7ee-50cfa835bc35 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 | +--------------------------------------+-------------+--------+--------+ | 98c7ba58-512f-4750-a0ff-3b892753f096 | Ubuntu14.04 | ACTIVE | | +--------------------------------------+-------------+--------+--------+
root@dlp ~(keystone)#
root@dlp ~(keystone)# nova boot --flavor 2 --image Ubuntu14.04 --security_group default --nic net-id=$netID Ubuntu_Trusty
nova list +-----------+---------------+--------+------------+-------------+-----------------------+ | ID | Name | Status | Task State | Power State | Networks | +-----------+---------------+--------+------------+-------------+-----------------------+ | 63d338b9- | Ubuntu_Trusty | 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 trusty@10.0.0.200
The authenticity of host '10.0.0.200 (10.0.0.200)' can't be established.
* Documentation: https://help.ubuntu.com/ECDSA key fingerprint is xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:af:3d:00. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '10.0.0.200' (ECDSA) to the list of known hosts. trusty@10.0.0.200's password: Welcome to Ubuntu 14.04 LTS (GNU/Linux 3.13.0-24-generic x86_64) Last login: Thu May 15 21:11:26 2014 trusty@host-10-0-0-200:~$ # ログインできた
|
Sponsored Link |