设为首页 收藏本站
查看: 746|回复: 0

[经验分享] OpenStack部署应用第四篇:网络服务Neutron(转)

[复制链接]

尚未签到

发表于 2017-6-27 07:43:29 | 显示全部楼层 |阅读模式
1、网络服务介绍
  OpenStack Networking(neutron),允许创建、插入接口设备,这些设备由其他的OpenStack服务管理。插件式的实现可以容纳不同的网络设备和软件,为OpenStack架构与部署提供了灵活性。
它包含下列组件:
neutron-server
  接收和路由API请求到合适的OpenStack网络插件,以达到预想的目的。
OpenStack网络插件和代理
  Plug and unplug ports, create networks or subnets, and provide IP addressing. These plug-ins and agents differ depending on the vendor and technologies used in the particular cloud. OpenStack Networking ships with plug-ins and agents for Cisco virtual and physical switches, NEC OpenFlow products, Open vSwitch, Linux bridging, and the VMware NSX product.
  常见的代理L3(3层),DHCP(动态主机IP地址),以及插件代理。
消息队列
  大多数的OpenStack Networking安装都会用到,用于在neutron-server和各种各样的代理进程间路由信息。也为某些特定的插件扮演数据库的角色,以存储网络状态
OpenStack网络主要和OpenStack计算交互,以提供网络连接到它的实例。
  网络服务提供网络,子网以及路由这些对象的抽象概念。每个抽象概念都有自己的功能,可以模拟对应的物理设备:网络包括子网,路由在不同的子网和网络间进行路由转发。
  对于任意一个给定的网络都必须包含至少一个外部网络。不想其他的网络那样,外部网络不仅仅是一个定义的虚拟网络。相反,它代表了一种OpenStack安装之外的能从物理的,外部的网络访问的视图。外部网络上的IP地址可供外部网络上的任意的物理设备所访问
  外部网络之外,任何 Networking 设置拥有一个或多个内部网络。这些软件定义的网络直接连接到虚拟机。仅仅在给定网络上的虚拟机,或那些在通过接口连接到相近路由的子网上的虚拟机,能直接访问连接到那个网络上的虚拟机。
  如果外部网络想要访问实例或者相反实例想要访问外部网络,那么网络之间的路由就是必要的了。每一个路由都配有一个网关用于连接到外部网络,以及一个或多个连接到内部网络的接口。就像一个物理路由一样,子网可以访问同一个路由上其他子网中的机器,并且机器也可以访问路由的网关访问外部网络。
  另外,你可以将外部网络的IP地址分配给内部网络的端口。不管什么时候一旦有连接连接到子网,那个连接被称作端口。你可以给实例的端口分配外部网络的IP地址。通过这种方式,外部网络上的实体可以访问实例.
  网络服务同样支持安全组。安全组允许管理员在安全组中定义防火墙规则。一个实例可以属于一个或多个安全组,网络为这个实例配置这些安全组中的规则,阻止或者开启端口,端口范围或者通信类型。
  每一个Networking使用的插件都有其自有的概念。虽然对操作VNI和OpenStack环境不是至关重要的,但理解这些概念能帮助你设置Networking。所有的Networking安装使用了一个核心插件和一个安全组插件(或仅是空操作安全组插件)。另外,防火墙即服务(FWaaS)和负载均衡即服务(LBaaS)插件是可用的。

2、环境准备

2.1 控制节点(node1)
  1)创建数据库(第一篇中已经完成)
  2)安装软件及配置服务



yum install -y openstack-neutron openstack-neutron-ml2 openstack-neutron-linuxbridge ebtables


[iyunv@linux-node1 neutron]# grep -n '^[a-z]' neutron.conf
27:auth_strategy = keystone
30:core_plugin = ml2
33:service_plugins =
118:notify_nova_on_port_status_changes = true
122:notify_nova_on_port_data_changes = true
530:transport_url = rabbit://openstack:openstack@192.168.56.11
722:connection = mysql+pymysql://neutron:neutron@192.168.56.11/neutron
803:auth_uri = http://192.168.56.11:5000
804:auth_url = http://192.168.56.11:35357
805:memcached_servers = 192.168.56.11:11211
806:auth_type = password
807:project_domain_name = default
808:user_domain_name = default
809:project_name = service
810:username = neutron
811:password = neutron
1002:auth_url = http://192.168.56.11:35357
1003:auth_type = password
1004:project_domain_name = default
1005:user_domain_name = default
1006:region_name = RegionOne
1007:project_name = service
1008:username = nova
1009:password = nova
1122:lock_path = /var/lib/neutron/tmp

[iyunv@linux-node1 ml2]# grep -n '^[a-z]' ml2_conf.ini
109:type_drivers = flat,vlan,gre,vxlan,geneve
114:tenant_network_types = flat,vlan,gre,vxlan,geneve
118:mechanism_drivers = linuxbridge
123:extension_drivers = port_security
159:flat_networks = public
236:enable_ipset = true
[iyunv@linux-node1 ml2]# grep -n '^[a-z]' linuxbridge_agent.ini
143:physical_interface_mappings = public:eth0
156:firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
161:enable_security_group = true
176:enable_vxlan = false
[iyunv@linux-node1 ml2]# grep -n '^[a-z]' /etc/neutron/dhcp_agent.ini
16:interface_driver = neutron.agent.linux.interface.BridgeInterfaceDriver
32:dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq
41:enable_isolated_metadata = True
[iyunv@linux-node1 ml2]# grep -n '^[a-z]' /etc/neutron/metadata_agent.ini
22:nova_metadata_ip = 192.168.56.11
34:metadata_proxy_shared_secret = oldboy


# 网络服务初始化脚本需要一个超链接 /etc/neutron/plugin.ini``指向ML2插件配置文件/etc/neutron/plugins/ml2/ml2_conf.ini``。如果超链接不存在,使用下面的命令创建
ln -s /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugin.ini

# 同步数据库
su -s /bin/sh -c "neutron-db-manage --config-file /etc/neutron/neutron.conf \
--config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head" neutron
# 验证同步结果
mysql -h 192.168.56.11 -u neutron -pneutron -e "use neutron;show tables;"
# 启动服务
systemctl enable neutron-server.service neutron-linuxbridge-agent.service neutron-dhcp-agent.service neutron-metadata-agent.service
systemctl start neutron-server.service neutron-linuxbridge-agent.service neutron-dhcp-agent.service neutron-metadata-agent.service
  3)创建用户、API 端点等等



openstack service create --name neutron --description "OpenStack Networking" network
openstack endpoint create --region RegionOne network public http://192.168.56.11:9696
openstack endpoint create --region RegionOne network internal http://192.168.56.11:9696
openstack endpoint create --region RegionOne network admin http://192.168.56.11:9696
  4)验证服务



[iyunv@linux-node1 ~]# neutron agent-list         
+-----------------------------+--------------------+-------------------------+-------------------+-------+----------------+---------------------------+
| id                          | agent_type         | host                    | availability_zone | alive | admin_state_up | binary                    |
+-----------------------------+--------------------+-------------------------+-------------------+-------+----------------+---------------------------+
| 4a845146-20c8-4976-8440-8c5 | Metadata agent     | linux-node1.example.com |                   | :-)   | True           | neutron-metadata-agent    |
| 359e9f4b6                   |                    |                         |                   |       |                |                           |
| a0304ab9-4cf6-4dff-80ae-    | Linux bridge agent | linux-node1.example.com |                   | :-)   | True           | neutron-linuxbridge-agent |
| d517ec256f9b                |                    |                         |                   |       |                |                           |
| c753850b-aede-417e-         | DHCP agent         | linux-node1.example.com | nova              | :-)   | True           | neutron-dhcp-agent        |
| 8ea0-392a91248908           |                    |                         |                   |       |                |                           |
+-----------------------------+--------------------+-------------------------+-------------------+-------+----------------+---------------------------+

2.2 计算节点(node2)
  1)软件安装及配置



yum install -y openstack-neutron-linuxbridge ebtables ipset


[iyunv@linux-node2 neutron]# grep -n '^[a-z]' /etc/neutron/neutron.conf
27:auth_strategy = keystone
530:transport_url = rabbit://openstack:openstack@192.168.56.11
803:auth_uri = http://192.168.56.11:5000
804:auth_url = http://192.168.56.11:35357
805:memcached_servers = 192.168.56.11:11211
806:auth_type = password
807:project_domain_name = default
808:user_domain_name = default
809:project_name = service
810:username = neutron
811:password = neutron
1116:lock_path = /var/lib/neutron/tmp
[iyunv@linux-node2 neutron]# grep -n '^[a-z]' /etc/neutron/plugins/ml2/linuxbridge_agent.ini   
143:physical_interface_mappings = public:eth0
156:firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
161:enable_security_group = true
176:enable_vxlan = false


systemctl restart openstack-nova-compute.service
systemctl enable neutron-linuxbridge-agent.service
systemctl start neutron-linuxbridge-agent.service
  2)验证服务配置



[iyunv@linux-node1 ~]# neutron agent-list
+-----------------------------+--------------------+-------------------------+-------------------+-------+----------------+---------------------------+
| id                          | agent_type         | host                    | availability_zone | alive | admin_state_up | binary                    |
+-----------------------------+--------------------+-------------------------+-------------------+-------+----------------+---------------------------+
| 4a845146-20c8-4976-8440-8c5 | Metadata agent     | linux-node1.example.com |                   | :-)   | True           | neutron-metadata-agent    |
| 359e9f4b6                   |                    |                         |                   |       |                |                           |
| 56378775-792f-483c-         | Linux bridge agent | linux-node2.example.com |                   | :-)   | True           | neutron-linuxbridge-agent |
| ad04-bd662200d1fc           |                    |                         |                   |       |                |                           |
| a0304ab9-4cf6-4dff-80ae-    | Linux bridge agent | linux-node1.example.com |                   | :-)   | True           | neutron-linuxbridge-agent |
| d517ec256f9b                |                    |                         |                   |       |                |                           |
| c753850b-aede-417e-         | DHCP agent         | linux-node1.example.com | nova              | :-)   | True           | neutron-dhcp-agent        |
| 8ea0-392a91248908           |                    |                         |                   |       |                |                           |
+-----------------------------+--------------------+-------------------------+-------------------+-------+----------------+---------------------------+
[iyunv@linux-node1 ~]# nova service-list
+----+------------------+-------------------------+----------+---------+-------+----------------------------+-----------------+
| Id | Binary           | Host                    | Zone     | Status  | State | Updated_at                 | Disabled Reason |
+----+------------------+-------------------------+----------+---------+-------+----------------------------+-----------------+
| 1  | nova-scheduler   | linux-node1.example.com | internal | enabled | up    | 2017-01-13T14:31:06.000000 | -               |
| 2  | nova-conductor   | linux-node1.example.com | internal | enabled | up    | 2017-01-13T14:31:09.000000 | -               |
| 3  | nova-consoleauth | linux-node1.example.com | internal | enabled | up    | 2017-01-13T14:31:12.000000 | -               |
| 6  | nova-compute     | linux-node2.example.com | nova     | enabled | up    | 2017-01-13T14:31:13.000000 | -               |
+----+------------------+-------------------------+----------+---------+-------+----------------------------+-----------------+

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-388490-1-1.html 上篇帖子: <转>Openstack Ceilometer监控项扩展 下篇帖子: openstack私有云布署实践【5 数据库MariaDB 集群】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表