OpenStack环境搭建(3) --网络节点

来源:互联网 发布:mac 命令行启动mysql 编辑:程序博客网 时间:2024/06/05 18:06

一、  基本环境配置

1、 配置第一个接口(桥接模式)为控制接口

在/etc/ network / interfaces中添加:

auto eth0

iface eth0 inet static

 address 10.17.x.x3

 netmask 255.255.0.0

 gateway 10.17.xxx.xxx

2、 配置第二个接口(桥接模式)

auto eth1

iface eth1 inet static

 address 10.17.xx.xx

 netmask 255.255.0.0

3、 第三个接口(桥接模式)为外部接口

在/etc/network/interfaces中添加如下内容:

# The external network interface

auto INTERFACE_NAME

iface INTERFACE_NAME inet manual

       up ip link set dev $IFACE up

down ip link set dev $IFACE down

(添加上面内容后,外网上不了,可以再添加一个网卡专门用来连外网)

4、 在/etc/hostname中设置主机名为network

 

5、 在/etc/hosts中添加如下内容并注意把127.0.1.1开头的行注释掉:

# network

10.17.x.x3       network

# controller

10.17.x.x1      controller

# compute

10.17.x.x2       compute

同时注释掉以下代码:

127.0.1.1       ubuntu

6、 安装网络时间协议(NTP)

# apt-get install ntp

打开文件/etc/ntp.conf增加或修改以下三行内容,目的是让本服务器时间与外部服务器时间同步

server ntp.ubuntu.com

server 127.127.1.0

fudge 127.127.1.0 stratum 10

7、 安装mysql的Python库:

apt-get install python-mysqldb

8、 源包升级:

apt-get update

apt-get dist-upgrade

9、 重新启动计算机,使更改生效

10、   使用OpenStack的RC文件设置环境变量:

1、 创建admin-opensrc.sh文件,并添加以下认证信息:

export OS_USERNAME=admin

export OS_PASSWORD=admin

export OS_TENANT_NAME=admin

exportOS_AUTH_URL=http://controller:35357/v2.0

2、 运行源文件:

source admin-openrc.sh

二、  安装配置Neutron

1、 前提条件:

1、编辑/etc/sysctl.conf文件添加以下内容:

net.ipv4.ip_forward=1

net.ipv4.conf.all.rp_filter=0

net.ipv4.conf.default.rp_filter=0

net.bridge.bridge-nf-call-arptables=1

net.bridge.bridge-nf-call-iptables=1

net.bridge.bridge-nf-call-ip6tables=1

2、执行改变

sysctl –p

注:如果运行后出现下面错误,则先运行# modprobe bridge 命令。

sysctl: cannot stat/proc/sys/net/bridge/bridge-nf-call-arptables: No such file or directory

sysctl: cannot stat/proc/sys/net/bridge/bridge-nf-call-iptables: No such file or directory

sysctl: cannot stat/proc/sys/net/bridge/bridge-nf-call-ip6tables: No such file or directory

2、 安装网络组件:

apt-getinstall neutron-plugin-ml2neutron-plugin-openvswitch-agent openvswitch-datapath-dkms \

 neutron-l3-agent neutron-dhcp-agent

3、 配置网络常用组件:

4、 配置网络使用身份服务进行身份认证

编辑/etc/neutron/neutron.conf在[DEFAULT]添加以下内容:

[DEFAULT]

...

auth_strategy = keystone

在[keystone_authtoken]添加以下内容:

更换NEUTRON_PASS为您选择的neutron用户密码身份认证服务

[keystone_authtoken]

...

auth_uri = http://controller:5000

auth_host = controller

auth_protocol = http

auth_port = 35357

admin_tenant_name = service

admin_user = neutron

admin_password = neutron

5、 配置网络使用消息代理

编辑/etc/neutron/neutron.conf文件,在[DEFAULT]部分添加以下内容:

用您选择的来宾账户密码替换RABBIT_PASS

[DEFAULT]

...

rpc_backend = neutron.openstack.common.rpc.impl_kombu

rabbit_host = controller

rabbit_password = 1234

6、 配置网络使用Modular Layer 2(ML2)插件和相关的服务

编辑/etc/neutron/neutron.conf文件,在[DEFAULT]部分添加以下内容:

[DEFAULT]

...

core_plugin = ml2

service_plugins = router

allow_overlapping_ips = True

建议在编辑/etc/neutron/neutron.conf文件,在[DEFAULT]部分添加verbose = True帮助查找问题。

7、 配置Layer-3 (L3)代理:

编辑/etc/neutron/l3_agent.ini文件,在[DEFAULT]部分添加以下内容:

[DEFAULT]

...

interface_driver =neutron.agent.linux.interface.OVSInterfaceDriver

use_namespaces = True

建议在编辑/etc/neutron/neutron.conf文件,在[DEFAULT]部分添加verbose = True帮助查找问题。

8、 配置DHCP代理:

1、 编辑/etc/neutron/dhcp_agent.ini文件,在[DEFAULT]部分添加以下内容:

[DEFAULT]

...

interface_driver =neutron.agent.linux.interface.OVSInterfaceDriver

dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq

use_namespaces = True

建议在编辑/etc/neutron/neutron.conf文件,在[DEFAULT]部分添加verbose = True帮助查找问题。

2、 编辑/etc/neutron/dhcp_agent.ini文件,在[DEFAULT]部分添加以下内容:

[DEFAULT]

...

dnsmasq_config_file =/etc/neutron/dnsmasq-neutron.conf

新建并编辑/etc/neutron/dnsmasq-neutron.conf文件,添加以下内容:

dhcp-option-force=26,1454

杀掉任何存在的dnsmasq进程:

killall dnsmasq

 

9、 配置元数据代理:

编辑/etc/neutron/metadata_agent.ini文件,在[DEFAULT]部分添加下面的键:

更换NEUTRON_PASS为您选择的neutron用户密码身份认证服务,用合适的元数据代理密码替换METADATA_SECRET

[DEFAULT]

...

auth_url = http://controller:5000/v2.0

auth_region = regionOne

admin_tenant_name = service

admin_user = neutron

admin_password = neutron

nova_metadata_ip = controller

metadata_proxy_shared_secret = 1234

建议在编辑/etc/neutron/neutron.conf文件,在[DEFAULT]部分添加verbose = True帮助查找问题。

10、   配置Modular Layer 2(ML2) plug-in:

编辑/etc/neutron/plugins/ml2/ml2_conf.ini文件,

在[ml2]部分添加下面的键:

[ml2]

...

type_drivers = gre

tenant_network_types = gre

mechanism_drivers = openvswitch

在[ml2_type_gre]部分添加以下内容:

[ml2_type_gre]

...

tunnel_id_ranges = 1:1000

添加[ovs]部分和下面的键:

替换INSTANCE_TUNNELS_INTERFACE_IP_ADDRESS为你的网络节点的tunnels network interface

[ovs]

...

local_ip =INSTANCE_TUNNELS_INTERFACE_IP_ADDRESS

tunnel_type = gre

enable_tunneling = True

添加[securitygroup]部分和下面的键:

[securitygroup]

...

firewall_driver =neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver

enable_security_group = True

11、   配置开放式的vSwitch (OVS)服务:

1、重启OVS服务:

service openvswitch-switch restart

2、添加集成桥

ovs-vsctl add-br br-int

3、添加外部桥

ovs-vsctl add-br br-ex

4、添加一个端口连接到外部桥,连接到外部物理网络口:

更换 INTERFACE_NAME为实际的接口名称。例如,eth2或ens256。

ovs-vsctl add-port br-ex INTERFACE_NAME

注意:

要暂时禁用 GRO同时测试外部网络接口:

ethtool -K INTERFACE_NAME gro off

12、   完成安装:

重启网络服务

# service neutron-plugin-openvswitch-agentrestart

# service neutron-l3-agent restart

# service neutron-dhcp-agent restart

# service neutron-metadata-agent restart

原创粉丝点击