-
Notifications
You must be signed in to change notification settings - Fork 0
RYU OpenStack Folsom environment Japanese HOWTO
このドキュメントでは、RyuとOpenStack Folsomを組み合わせた環境を、devstackを使用して構築する手順を説明します。
次のシステム構成を前提とします。
+--------+
| Client |
+----+---+
| Public Network
-----+----+----------
| Private Network
| ---+--------------+---------
| | |
+---+---------+---+ +-------+--------+
| Controller Node | | Compute Node |
| Ryu | | Quantum |
| Nova | | ryu-agent |
| Keystone | | Nova |
| Glance | | nova-compute |
| Quantum | +----------------+
| Cinder |
| Horizon |
+-----------------+
-
Controller Node:
RyuとOpenStackの各コンポーネントを実行します。nova-computeも実行し、このノードでもVMを起動します。また、Compute Nodeで起動したVMが、外部のネットワークへアクセスする際には、このノードを経由します。
-
Compute Node:
nova-computeとQuantum Ryu pluginのryu-agentを実行します。
-
Client:
VMと外部ネットワーク上のホストの通信を確認するために使います。
-
Public Network:
VMの外部のネットワークへのアクセス、ClientからFloatingIPを経由したVMへのアクセスで使用されます。
-
Private Network:
RyuとOVS、OpenStackのコンポーネント同士の通信、Controller NodeとCompute NodeのOVSをGRE Tunnelで接続するために使用されます。
なお、各ホストのOSは、Ubuntu 12.04 Serverを使用します。
このドキュメントでは、各ネットワークおよびホストのアドレスに以下の値を使用します。
-
ネットワーク
- Public Network: 192.168.100.0/24
- Private Network: 192.168.0.0/24
-
ホスト
-
Controller Node:
- ホスト名: controller
- IPアドレス: 192.168.0.10
-
Compute Node:
- ホスト名: compute
- IPアドレス: 192.168.0.11
-
Client:
- ホスト名: client
- IPアドレス: 192.168.100.200
-
各ノードの内部のネットワーク構成は以下のようになります。
Public Network
----+---------
| Private Network
| --+---------------------+-----
| | |
| | |
+---|---------|----+ +-------------|----+
| (eth1) (eth0) | | (eth0) |
| | | | |
| [br-ex] ______________ |
| : / GRE | \ |
| [br-int]--<qbr> | | [br-int]--<qbr> |
| | | | | |
| VM | | VM |
+------------------+ +------------------+
Controller Node Compute Node
[] OVS bridge
<> Linux bridge
() Network interface
.. IP Routing
各ノードとも、Ubuntu 12.04 Serverのインストールが完了しているものとします。
必要となるソフトウェアをGitHubから取得するため、gitコマンドをインストールします。
$ sudo apt-get install git
devstackを取得します。
$ cd
$ git clone git://github.com/yamahata/devstack -b ryu-gre-tunnel-oct-11-2012
ネットワークインターフェイスを設定します。
$ sudo vi /etc/network/interfaces
/etc/network/interfaces:
auto lo
auto eth0
iface eth0 inet static
address 192.168.0.10
netmask 255.255.255.0
gateway 192.168.0.1
dns-nameservers 192.168.0.1
auto eth1
iface eth1 inet manual
up ifconfig $IFACE 0.0.0.0 up
up ip link set $IFACE promisc on
down ip link set $IFACE promisc off
down ifconfig $IFACE down
ネットワークインターフェイスを再起動します。
$ sudo /etc/init.d/networking restart
devstackの設定を行います。
$ cd ~/devstack
$ vi localrc
$ vi local.sh
$ chmod +x local.sh
localrc:
SERVICE_HOST=192.168.0.10
disable_service n-net
enable_service q-svc q-agt q-dhcp q-l3 quantum ryu
FLOATING_RANGE=192.168.100.0/24
Q_PLUGIN=ryu
Q_HOST=$SERVICE_HOST
MYSQL_HOST=$SERVICE_HOST
RABBIT_HOST=$SERVICE_HOST
GLANCE_HOSTPORT=$SERVICE_HOST:9292
KEYSTONE_AUTH_HOST=$SERVICE_HOST
KEYSTONE_SERVICE_HOST=$SERVICE_HOST
RYU_API_HOST=$SERVICE_HOST
RYU_OFP_HOST=$SERVICE_HOST
RYU_APPS=ryu.app.gre_tunnel,ryu.app.quantum_adapter,ryu.app.rest,ryu.app.rest_conf_switch,ryu.app.rest_tunnel,ryu.app.tunnel_port_updater
QUANTUM_REPO=${GIT_BASE}/yamahata/quantum.git
QUANTUM_BRANCH=ryu-gre-tunnel-oct-11-2012
RYU_REPO=${GIT_BASE}/yamahata/ryu.git
RYU_BRANCH=ryu-gre-tunnel-oct-11-2012
CINDER_BRANCH=stable/folsom
NOVA_BRANCH=stable/folsom
SWIFT_BRANCH=stable/folsom
GLANCE_BRANCH=stable/folsom
KEYSTONE_BRANCH=stable/folsom
HORIZON_BRANCH=stable/folsom
local.sh:
sudo ovs-vsctl --no-wait -- --may-exist add-port br-ex eth1
ネットワークインターフェイスを設定します。
$ sudo vi /etc/network/interfaces
/etc/network/interfaces:
auto lo
auto eth0
iface eth0 inet static
address 192.168.0.11
netmask 255.255.255.0
gateway 192.168.0.1
dns-nameservers 192.168.0.1
ネットワークインターフェイスを再起動します。
$ sudo /etc/init.d/networking restart
devstackの設定を行います。
$ cd ~/devstack
$ vi localrc
localrc:
SERVICE_HOST=192.168.0.10
disable_all_services
enable_service rabbit n-cpu quantum q-agt
Q_PLUGIN=ryu
Q_HOST=$SERVICE_HOST
MYSQL_HOST=$SERVICE_HOST
RABBIT_HOST=$SERVICE_HOST
GLANCE_HOSTPORT=$SERVICE_HOST:9292
KEYSTONE_AUTH_HOST=$SERVICE_HOST
KEYSTONE_SERVICE_HOST=$SERVICE_HOST
RYU_API_HOST=$SERVICE_HOST
RYU_OFP_HOST=$SERVICE_HOST
QUANTUM_REPO=${GIT_BASE}/yamahata/quantum.git
QUANTUM_BRANCH=ryu-gre-tunnel-oct-11-2012
RYU_REPO=${GIT_BASE}/yamahata/ryu.git
RYU_BRANCH=ryu-gre-tunnel-oct-11-2012
CINDER_BRANCH=stable/folsom
NOVA_BRANCH=stable/folsom
SWIFT_BRANCH=stable/folsom
GLANCE_BRANCH=stable/folsom
KEYSTONE_BRANCH=stable/folsom
HORIZON_BRANCH=stable/folsom
まず、Controller Nodeのdevstackを起動します。
Controller Node:
$ cd ~/devstack
$ ./stack.sh
[snip]
Keystone is serving at http://192.168.0.10:5000/v2.0/
Examples on using novaclient command line is in exercise.sh
The default users are: admin and demo
The password: keystone
This is your host ip: 192.168.0.10
stack.sh completed in 162 seconds.
$
次にCompute Nodeのdevstackを起動します。
Compute Node:
$ cd ~/devstack
$ ./stack.sh
Controller Nodeで、サービスが起動されたことを確認します。
$ cd ~/devstack
$ . ./openrc admin admin
$ nova-manage service list
Binary Host Zone Status State Updated_At
nova-compute controller nova enabled :-) 2012-10-11 09:17:46
nova-cert controller nova enabled :-) 2012-10-11 09:17:51
nova-scheduler controller nova enabled :-) 2012-10-11 09:17:43
nova-consoleauth controller nova enabled :-) 2012-10-11 09:17:47
nova-compute compute nova enabled :-) 2012-10-11 09:17:48
$
次のコマンドでVMを起動します。
nova boot --flavor <flavor-id> --image <image-id> --nic net-id=<net-id> <VM-name>
実行例:
$ . ./openrc demo demo
$ nova flavor-list
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+-------------+
| ID | Name | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public | extra_specs |
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+-------------+
| 1 | m1.tiny | 512 | 0 | 0 | | 1 | 1.0 | True | {} |
| 2 | m1.small | 2048 | 20 | 0 | | 1 | 1.0 | True | {} |
| 3 | m1.medium | 4096 | 40 | 0 | | 2 | 1.0 | True | {} |
| 4 | m1.large | 8192 | 80 | 0 | | 4 | 1.0 | True | {} |
| 5 | m1.xlarge | 16384 | 160 | 0 | | 8 | 1.0 | True | {} |
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+-------------+
$ nova image-list
+--------------------------------------+---------------------------------+--------+--------+
| ID | Name | Status | Server |
+--------------------------------------+---------------------------------+--------+--------+
| c0051ff9-39a6-405d-b671-b56c08bd7dfa | cirros-0.3.0-x86_64-uec | ACTIVE | |
| 4afc9464-5d14-4892-a900-186ac45db9ab | cirros-0.3.0-x86_64-uec-kernel | ACTIVE | |
| 6ed779fb-6555-40e8-91ad-0cf008d38573 | cirros-0.3.0-x86_64-uec-ramdisk | ACTIVE | |
+--------------------------------------+---------------------------------+--------+--------+
$ quantum net-list
+--------------------------------------+---------+--------------------------------------+
| id | name | subnets |
+--------------------------------------+---------+--------------------------------------+
| c265268c-7d86-4561-a30a-475fc8beddfe | ext_net | cf74c5a1-0c5b-4810-b7d4-98e6ea724680 |
| c426ba2c-de29-4744-a072-77e7bf6d87d9 | net1 | f18c803a-8420-484a-a975-23d7be479515 |
+--------------------------------------+---------+--------------------------------------+
$ nova boot --flavor 1 --image c0051ff9-39a6-405d-b671-b56c08bd7dfa --nic net-id=c426ba2c-de29-4744-a072-77e7bf6d87d9 vm1
$ nova list
+--------------------------------------+------+--------+---------------+
| ID | Name | Status | Networks |
+--------------------------------------+------+--------+---------------+
| 3f22f259-ab36-435e-9d58-1b5c5efb1b57 | vm1 | ACTIVE | net1=10.0.0.3 |
+--------------------------------------+------+--------+---------------+
次のコマンドでSecurity Groupsの設定を行います。
nova secgroup-add-rule <group name> icmp <from-type> <to-type> <cidr>
nova secgroup-add-rule <group name> tcp <from-port> <to-port> <cidr>
nova secgroup-add-rule <group name> udp <from-port> <to-port> <cidr>
実行例:
$ nova secgroup-add-rule default icmp -1 -1 0.0.0.0/0
$ nova secgroup-add-rule default tcp 22 22 0.0.0.0/0
次のコマンドでVMにFloating IPを割り当てます。
quantum floatingip-create <net-id>
quantum floatingip-associate <float-id> <port-id>
実行例:
$ quantum net-list
+--------------------------------------+---------+--------------------------------------+
| id | name | subnets |
+--------------------------------------+---------+--------------------------------------+
| c265268c-7d86-4561-a30a-475fc8beddfe | ext_net | cf74c5a1-0c5b-4810-b7d4-98e6ea724680 |
| c426ba2c-de29-4744-a072-77e7bf6d87d9 | net1 | f18c803a-8420-484a-a975-23d7be479515 |
+--------------------------------------+---------+--------------------------------------+
$ quantum port-list
+--------------------------------------+------+-------------------+---------------------------------------------------------------------------------+
| id | name | mac_address | fixed_ips |
+--------------------------------------+------+-------------------+---------------------------------------------------------------------------------+
| 2487aacc-bc52-4b28-b959-f20989288ec5 | | fa:16:3e:27:2e:9e | {"subnet_id": "f18c803a-8420-484a-a975-23d7be479515", "ip_address": "10.0.0.3"} |
| 2643f293-6170-464e-9d7b-0057769ff01b | | fa:16:3e:8e:19:c2 | {"subnet_id": "f18c803a-8420-484a-a975-23d7be479515", "ip_address": "10.0.0.1"} |
| 8d13c7cb-eeee-4744-97d8-1eacf16b7264 | | fa:16:3e:0e:55:8b | {"subnet_id": "f18c803a-8420-484a-a975-23d7be479515", "ip_address": "10.0.0.2"} |
+--------------------------------------+------+-------------------+---------------------------------------------------------------------------------+
$ quantum floatingip-create c265268c-7d86-4561-a30a-475fc8beddfe
Created a new floatingip:
+---------------------+--------------------------------------+
| Field | Value |
+---------------------+--------------------------------------+
| fixed_ip_address | |
| floating_ip_address | 192.168.100.3 |
| floating_network_id | c265268c-7d86-4561-a30a-475fc8beddfe |
| id | dcfeeb00-298f-4b17-9b85-b1918a2ae84d |
| port_id | |
| router_id | |
| tenant_id | 1082ef1b89004ff58e6af9b9fac20026 |
+---------------------+--------------------------------------+
$ quantum floatingip-associate dcfeeb00-298f-4b17-9b85-b1918a2ae84d 2487aacc-bc52-4b28-b959-f20989288ec5
Associated floatingip dcfeeb00-298f-4b17-9b85-b1918a2ae84d
$ quantum floatingip-list
+--------------------------------------+------------------+---------------------+--------------------------------------+
| id | fixed_ip_address | floating_ip_address | port_id |
+--------------------------------------+------------------+---------------------+--------------------------------------+
| dcfeeb00-298f-4b17-9b85-b1918a2ae84d | 10.0.0.3 | 192.168.100.3 | 2487aacc-bc52-4b28-b959-f20989288ec5 |
+--------------------------------------+------------------+---------------------+--------------------------------------+
VMへのpingおよびsshログインが行えます。
$ ping -c 10 192.168.100.3
PING 192.168.100.3 (192.168.100.3) 56(84) bytes of data.
64 bytes from 192.168.100.3: icmp_req=1 ttl=63 time=13.2 ms
64 bytes from 192.168.100.3: icmp_req=2 ttl=63 time=0.718 ms
64 bytes from 192.168.100.3: icmp_req=3 ttl=63 time=0.843 ms
64 bytes from 192.168.100.3: icmp_req=4 ttl=63 time=0.838 ms
64 bytes from 192.168.100.3: icmp_req=5 ttl=63 time=0.892 ms
64 bytes from 192.168.100.3: icmp_req=6 ttl=63 time=0.798 ms
64 bytes from 192.168.100.3: icmp_req=7 ttl=63 time=0.803 ms
64 bytes from 192.168.100.3: icmp_req=8 ttl=63 time=0.765 ms
64 bytes from 192.168.100.3: icmp_req=9 ttl=63 time=0.858 ms
64 bytes from 192.168.100.3: icmp_req=10 ttl=63 time=0.824 ms
--- 192.168.100.3 ping statistics ---
10 packets transmitted, 10 received, 0% packet loss, time 9008ms
rtt min/avg/max/mdev = 0.718/2.055/13.216/3.720 ms
$
$ ssh [email protected]
The authenticity of host '192.168.100.3 (192.168.100.3)' can't be established.
RSA key fingerprint is a0:ed:1a:09:3a:35:21:5f:86:4e:8e:be:c0:c5:93:bd.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.100.3' (RSA) to the list of known hosts.
[email protected]'s password: cubswin:)
$ ifconfig
eth0 Link encap:Ethernet HWaddr FA:16:3E:27:2E:9E
inet addr:10.0.0.3 Bcast:10.0.0.255 Mask:255.255.255.0
inet6 addr: fe80::f816:3eff:fe27:2e9e/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:105 errors:0 dropped:0 overruns:0 frame:0
TX packets:183 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:13582 (13.2 KiB) TX bytes:21578 (21.0 KiB)
Interrupt:11 Base address:0xa000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
$ exit
Connection to 192.168.100.3 closed.