美文网首页
4)创建flat,local网络

4)创建flat,local网络

作者: 山大刀 | 来源:发表于2018-01-16 11:07 被阅读0次

    我们创建的云主机,肯定不能没有网络吧,所以我们在创建主机之前最好创建一个网络。可选择的网络类型有:local,flat,vlan,gre,vxlan,geneve 等等。
    有5种网络模式
    Local模式:一般测试时使用,只需一台物理机即可。
    GRE模式:隧道数量没有限制,性能有点问题。
    Vlan模式:vlan数量有4096的限制
    VXlan模式:vlan数量没有限制,性能比GRE好。
    Flat模式:管理员创建,租户直接到外网,不需要NAT了

    启动前我们可以检查一下相关配置,不一致的地方照着修改修改。网络部分对我来说是比较难的,我在这里纠结了好多天,差点都放弃学习了。
    编辑/etc/neutron/plugin.ini

    # vi  /etc/neutron/plugin.ini
    #type_drivers = vlan,flat 这里要把所有支持的驱动都填入,不然在控制台页面创建网络的时候会报错。
    tenant_network_types = local,flat
    type_drivers = local,flat,vlan,gre,vxlan,geneve
    mechanism_drivers = linuxbridge
    extension_drivers = port_security
    [ml2_type_flat]
    #flat_networks = provider
    flat_networks = public
    

    编辑后,/etc/neutron/plugins/ml2/ml2_conf.ini​中的对应项也会自动跟着变,这是一个软连接。大家可以确认一下。没有软连接的改一下软连接。

    再编辑/etc/neutron/plugins/ml2/linuxbridge_agent.ini中的​

    #physical_interface_mappings = provider:eth0
    physical_interface_mappings = public:eth0
    

    重启neutron 服务

    [root@controller neutron]# systemctl restart neutron-server
    或者
    [root@controller neutron]# openstack-service restart neutron
    

    现在可以去去控制台dashboard上 创建flat网络了。
    dashboard 中有两个地方可以创建 network:

    1. Project -> Network -> Networks这是普通用户在自己的 tenant 中创建 network 的地方,只能创建tenant_network_types 配置的默认网络类型,
    2. Admin -> Networks 这是 admin 创建 network 的地方,管理员可以挑选指定创建的网络类型。

    我们先用第二种方式创建,点击 “Create Network” 按钮。
    在 “管理员” 条目下选择 “网络”,再点击 “创建网络” ,在里面要注意选择 “Flat” ,物理网络为 “public” (注意这里与/etc/neutron/plugins/ml2/ml2_conf.ini内的[ml2_type_flat]​的flat_networks对应),然后再把 “共享的” 和 “外部网络” 勾选起来,之后点击 “创建网络”。

    QQ图片20180115180249.png

    然后下一步,配置子网。注意子网的信息一定要与你真实的宿主机物理网络一样。


    QQ图片20180116112154.png

    配置子网详情,注意这里的 192.168.25.200,192.168.25.250 为真实物理网络中的一段:


    QQ图片20180115181040.png

    创建成功


    QQ图片20180115181354.png

    如果创建网络过程中,出现错误大家可以调查下日志,参照错误信息,自己找出答案。可以百度谷歌,不会的奇怪问题可以问我,一起分析。下面是我创建local网络时出的错误,大家可以参考。因为type_drivers参数没有支持local的网络类型,加上类型就好了。

    [root@controller neutron]# cat server.log |grep fail
    2018-01-15 09:57:52.058 15482 INFO neutron.pecan_wsgi.hooks.translation [req-cdb8f07b-23b0-434d-a6df-b7658c202ff6 1472d65524bb4a7ca1243a7f4a11fd11 ffaf3f6cd7a44f5fadad62e6dbc4356f - default default] POST failed (client error): The server couldnot comply with the request since it is either malformed or otherwise incorrect.
    2018-01-15 09:58:44.740 15484 INFO neutron.pecan_wsgi.hooks.translation [req-957e086d-445e-4218-b882-5bf29186ccac 1472d65524bb4a7ca1243a7f4a11fd11 ffaf3f6cd7a44f5fadad62e6dbc4356f - default default] POST failed (client error): The server couldnot comply with the request since it is either malformed or otherwise incorrect.
    2018-01-15 10:01:36.896 15484 INFO neutron.pecan_wsgi.hooks.translation [req-6b58e14b-9238-4a67-a8a8-d3fb00ff50fe 1472d65524bb4a7ca1243a7f4a11fd11 ffaf3f6cd7a44f5fadad62e6dbc4356f - default default] POST failed (client error): The server couldnot comply with the request since it is either malformed or otherwise incorrect.
    2018-01-15 10:24:17.922 15485 INFO neutron.pecan_wsgi.hooks.translation [req-d9471a2d-22a3-4fb0-8bf5-1c40b17df4a0 1472d65524bb4a7ca1243a7f4a11fd11 ffaf3f6cd7a44f5fadad62e6dbc4356f - default default] POST failed (client error): The server couldnot comply with the request since it is either malformed or otherwise incorrect.
    
    [root@controller httpd]# cat error_log|grep local
    [Mon Jan 15 09:57:52.116303 2018] [:error] [pid 32173] WARNING horizon.exceptions Recoverable error: Invalid input for operation: network_type value 'local' not supported.
    [Mon Jan 15 09:58:44.776506 2018] [:error] [pid 32173] WARNING horizon.exceptions Recoverable error: Invalid input for operation: network_type value 'local' not supported.
    [Mon Jan 15 10:01:36.933763 2018] [:error] [pid 32173] WARNING horizon.exceptions Recoverable error: Invalid input for operation: network_type value 'local' not supported.
    [Mon Jan 15 10:24:17.972489 2018] [:error] [pid 32173] WARNING horizon.exceptions Recoverable error: Invalid input for operation: network_type value 'local' not supported.
    

    相关文章

      网友评论

          本文标题:4)创建flat,local网络

          本文链接:https://www.haomeiwen.com/subject/etedoxtx.html