這系列的文章只是我自己的 OpenStack Juno 安裝記錄,不過基本上內容都跟官方文件一樣
只是把一些細節整合起來,讓安裝時的設定稍微沒那麼繁瑣一點
但如果想知道各個步驟的原因以及用途,建議還是應該回頭去看看官方的安裝文件。
安裝環境的硬體、網路配置介紹請參考前文:三主機安裝 OpenStack Juno(一):安裝環境介紹
系統環境與前置工作
- 作業系統為 Ubuntu 14.04.1。
- 將會在 Compute Node 上安裝的各元件版本如下(使用 apt-show-versions):
12345nvswitch-agent neutron-l3-agent neutron-dhcp-agent
neutron-dhcp-agent:all
/trusty-updates
1:2014.2.1-0ubuntu1~cloud0 uptodate
neutron-l3-agent:all
/trusty-updates
1:2014.2.1-0ubuntu1~cloud0 uptodate
neutron-plugin-ml2:all
/trusty-updates
1:2014.2.1-0ubuntu1~cloud0 uptodate
neutron-plugin-openvswitch-agent:all
/trusty-updates
1:2014.2.1-0ubuntu1~cloud0 uptodate
- 編輯 /etc/hosts 設定節點的別名,將其他節點在 Administrative Network 的位址皆記錄下來。
12192.168.18.1 controller
192.168.18.2 network
安裝 OpenStack 網路節點
- 安裝 Neutron 套件。
1apt-get
install
neutron-plugin-ml2 neutron-plugin-openvswitch-agent neutron-l3-agent neutron-dhcp-agent
- 編輯 /etc/neutron/neutron.conf 設定檔:
(1) 註解資料庫連線設定,因為 Network Node 不會直接存取資料庫。
(2) 依據 Controller Node 中 Message Service 設定的資料,編輯 Nova Controller 存取 RabbitMQ 的相關設定。
(3) 設定存取 Keystone 的方法。
(4) 啟用 ML2 外掛以及相關的服務。
123456789101112131415161718192021222324252627[DEFAULT]
...
rpc_backend = rabbit
rabbit_host = controller
rabbit_port = 5672
rabbit_use_ssl =
false
rabbit_userid = opneutronnetwork
rabbit_password = neutron
rabbit_virtual_host = openstack
# Authentication
auth_strategy = keystone
# Enable the Modular Layer 2 (ML2) plug-in, router service, and overlapping IP addresses
core_plugin = ml2
service_plugins = router
allow_overlapping_ips = True
[database]
# connection = mysql://opneutron:qwer@controller/neutron
[keystone_authtoken]
auth_uri = http:
//controller
:5000
/v2
.0
identity_uri = http:
//controller
:35357
admin_tenant_name = service
admin_user = neutron
admin_password = qwer
- 編輯 /etc/neutron/plugins/ml2/ml2_conf.ini 以設定 Modular Layer 2 plug-in,以透過 Open vSwitch (OVS) 建立虛擬網路:
(1) 設定 Neutron 使用 flat 與 generic routing encapsulation (GRE) 型態提供網路服務。
(2) 設定 flat 網路為外部網路的提供者。
(3) 以 Open vSwitch 套件作為提供網路服務的驅動程式。
(4) 啟用 security group 以及 OVS 提供的 iptables 防火牆等。
(5) 設定 Tunnel 的介面 IP。
1234567891011121314151617181920212223242526272829[ml2]
...
type_drivers = flat,gre
tenant_network_types = gre
mechanism_drivers = openvswitch
[ml2_type_flat]
...
flat_networks = external
[ml2_type_gre]
...
tunnel_id_ranges = 1:1000
[securitygroup]
...
enable_security_group = True
enable_ipset = True
firewall_driver = neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver
[ovs]
...
local_ip = 192.168.17.2
enable_tunneling = True
bridge_mappings = external:br-ex
[agent]
...
tunnel_types = gre
- 編輯 /etc/neutron/l3_agent.ini 設定檔,以設定 Layer-3 agent,用以提供虛擬網路的路由功能:
12345[DEFAULT]
interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver
use_namespaces = True
external_network_bridge = br-ex
- 編輯 /etc/neutron/dhcp_agent.ini 設定檔,以設定 DHCP agent,用以提供虛擬網路的 DHCP 功能:
12345678[DEFAULT]
interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver
dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq
use_namespaces = True
# Configuration for solving issues of PMTUD
dnsmasq_config_file =
/etc/neutron/dnsmasq-neutron
.conf
- 建立並編輯 /etc/neutron/dnsmasq-neutron.conf 檔:
(1) 設定 jumbo frames 以避免某些 OS 拒絕超過 MTU 上限的封包傳送問題。(由於虛擬機器不會知道自己在虛擬網路中傳輸資料,封包會以網路預設的 MTU = 1500 bytes 送出,但通過 PMTUD 時封包大小可能會自動被調整,導致未支援 PMTUD 的 OS 可能會阻止連線)。
1dhcp-option-force=26,1454
- 關閉執行中的 dnsmasq 程序。
1pkill dnsmasq
- 編輯 /etc/neutron/metadata_agent.ini 設定檔,以設定提供給虛擬機器的資訊:
(1) 設定 metadata proxy 共享的 secret,以在 Controller Node 上設定的 secret 置換 METADATA_SECRET。
1234567891011[DEFAULT]
...
auth_url = http:
//controller
:5000
/v2
.0
auth_region = regionOne
admin_tenant_name = service
admin_user = neutron
admin_password = qwer
nova_metadata_ip = controller
metadata_proxy_shared_secret = METADATA_SECRET
- 設定 Open vSwitch 服務:
(1) 設定 OVS 的對外網路介面 eth5,需注意的是做了此設定後,eth5 上設定的 IP 等連線資訊將會失去作用。
123service openvswitch-switch restart
ovs-vsctl add-br br-ex
ovs-vsctl add-port br-ex eth5
- 重新啟動 Neutron 服務。
1service neutron-plugin-openvswitch-agent restart && service neutron-l3-agent restart && service neutron-dhcp-agent restart && service neutron-metadata-agent restart
- 驗證安裝結果的方法為使用 neutron agent-list 指令,正常的話會列出包括 Metadata agent、Open vSwitch agent、L3 agent 及 DHCP agent 的資訊。
建立虛擬網路
上述的動作完成後,就已經完成 Network Node 的安裝了。同時前文中也已經把 Controller Node 和 Compute Node 中關於 Neutron 的環境與相關設定都完成建置。接下來就要直接開始在 Neutron 上建立虛擬網路了。建立外部網路
- 在有安裝 Neutron Client 的任意節點上執行以下的指令:
(1) 建立一個使用 flat 網路的對外網路。
(2) 建立使用 10.5.0.1 作為 gateway 的 class B 網路,其中允許使用的對外 IP 為 10.5.17.100~10.5.17.200。
12neutron net-create ext-net --router:external True --provider:physical_network external --provider:network_type flat
neutron subnet-create ext-net --name ext-subnet --allocation-pool start=10.5.17.100,end=10.5.17.200 --disable-dhcp --gateway 10.5.0.1 10.5.0.0
/16
建立內部網路
- 在有安裝 Neutron Client 的任意節點上執行以下的指令:
(1) 建立一個名稱為 demo-net 的內部網路
(2) 在 demo-net 中建立一個名稱為 demo-subnet 的子網段,該子網段使用 192.168.1.1 作為 gateway 的 class C 網路。
(3) 建立一個名稱為 demo-router 的路由器,並且讓該路由器連接對外網路 ext-net 以及內部網路 demo-subnet。
12345neutron net-create demo-net
neutron subnet-create demo-net --name demo-subnet --gateway 192.168.1.1 192.168.1.0
/24
neutron router-create demo-router
neutron router-interface-add demo-router demo-subnet
neutron router-gateway-
set
demo-router ext-net
4 則留言:
請問一下
安裝 Neutron 套件。
這個部分是否能補充說明細節呢? 謝謝
因為文章內 這部分是空白的
我想有可能是瀏覽器或者是格式化套件的 BUG。文章本身的確有寫內容,但我自己用 Chrome 看時也是空白的,改用 Firefox 則可以正常顯示。
PS. 內容是「apt-get install neutron-plugin-ml2 neutron-plugin-openvswitch-agent neutron-l3-agent neutron-dhcp-agent」
非常感謝您的回覆!
張貼留言