Neutron云计算网络虚拟化 龚永生 微信:robingong2004 2015.4.16 agenda • neutron做什么 • neutron体系结构 • neutron的管理员特权 • neutron的普通用户工作流程 • neutron运维 neutron起源于虚拟机的网卡 计算 存储 网络 虚拟化 hypervisor VCPU, 内存 块设备 虚拟网卡 虚拟机 虚拟机 虚拟机 虚拟机 Cinder NeutronNova 虚拟化网络功能 Neutron 虚拟化不只网卡 交换 机 路由 器 NAT防火 墙 负载均 衡 ACL 虚拟化组件的实现 • 网卡 -> tap设备,linux bridge, OVS bridge, SRIOV, 甚至是物理设备直接挂载 • 防火墙: xtables, • 路由器: linux操作系统的路由功能 • 负载均衡器: haproxy • NAT: iptables NAT Neutron 不只虚拟化,还要互 联 VM1 VM2 VM3 VM4 虚拟化网络组件和物理通道 虚拟化网络 路由 器 网络和子 网 端口 ACL ACL网络和子 网 外部网络 和子网 内部网络外部网络 物理网络及 隔离技术 vxlan agenda • neutron做什么 • neutron体系结构 • neutron的管理员特权 • neutron的普通用户工作流程 • neutron运维 核心数据模型 网络 子网 端口 路由器 浮动IP VM 绑定 绑定 绑定 获取IP 获取IP等其 它网络配置 提供隔离配置 安全组 安全组 规则 提供ACL 来自于Nova OpenStack neutron组件社区实 现版 virtual network management L3 router service VPN service Firewall service Load balance service Neutron server & plugin agent DHCP agent DB MSG Queue l3-agent metadata-agent vpn-agent lbaas-agent OpenStack Neutron Server Core REST API Extension A REST API Extension … REST API AuthN/AuthZ/Input Validation/Output view Core Plugin Interface Service A Plugin Interface Service … Plugin Interface Core Plugin Service … PluginService A Plugin 多节点部署一 关于物理网卡的数量? API 多节点部署二 多节点部署三 agenda • neutron做什么 • neutron体系结构 • neutron的管理员特权 • neutron的普通用户工作流程 • neutron运维 管理员特权 • 系统组件情况 • 外部网络 • 手动绑定 查看系统扩展列表(普通用户也可) 查看系统的agent及其状态 网络的绑定 network_type: gre, vxlan, vlan, flat, local五种 physical_network: 对于vlan, flat类型,指定桥接到 bridge上去(OVS) segmentation_id: 指的是隧道ID, vlan ID 管理员在创建虚拟网络 的时候可以指定绑定信 息,而普通租户不能指 定。系统会根据配置来 选择这些值。 创建外部网络和子网 • $ neutron net-create ext_net --provider:network_type local -- router:external True • $ neutron subnet-create ext_net 192.168.30.0/24 --name ext_subnet --enable_dhcp False --allocation_pools list=true type=dict start=192.168.30.20,end=192.168.30.40 外部网络 物理网络及 隔离技术 虚拟化网络 路由器 外部网络 和子网 agenda • neutron做什么 • neutron体系结构 • neutron的管理员特权 • neutron的普通用户工作流程 • neutron运维 租户典型的操作流程 1. 创建一个虚拟网络 2. 创建一个子网,主要指定IP 地址段,名字服务 器,网关地址 3. 创建虚拟路由器 4. 链接子网到虚拟路由 5. 链接虚拟路由器到外部网络 6. 调整安全组规则 7. 利用安全组和子网创建虚拟机(Nova) 8. 重复7创建更多的虚拟机 租户典型的操作流程1/3 1. 创建一个虚拟网络 2. 创建一个子网,主要指定IP 地址段,名字服务器,网关地址 内部网络外部网络 物理网络及 隔离技术 虚拟化网络 vxlan 路由 器 网络和子 网 端口 ACL ACL网络和子 网 外部网络 和子网 租户典型的操作流程2/3 3. 创建虚拟路由器 4. 链接子网到虚拟路由 5. 链接虚拟路由器到外部网络 内部网络外部网络 物理网络及 隔离技术 虚拟化网络 vxlan 路由 器 网络和子 网 端口 ACL网络和子 网 外部网络 和子网 租户典型的操作流程3/3 6. 调整安全组规则 内部网络外部网络 物理网络及 隔离技术 虚拟化网络 vxlan 路由 器 网络和子 网 端口 ACL网络和子 网 7. 利用安全组和子网创建虚拟机(Nova) 外部网络 和子网 agenda • neutron做什么 • neutron体系结构 • neutron的管理员特权 • neutron的普通用户工作流程 • neutron运维 节点down 1. 检查各个agent日志 2. 检查rabbitmq 3. 检查server 4. 检查时间一致性 floatingip不通 1. 检查VM到其网关是否通 2. 查询安全组规则 3. 查询floatingip 所在router $ neutron floatingip-show fip_id 4. 查询路由器所在l3agent $neutron l3-agent-list- hosting-router 5. 进入router所在名字空间,检查到公网网络的网关 是否通 6. 进入router所在名字空间,查看floatingip是否存在 7. 重启l3-agent服务 L3节点错误,router迁移 • 查询L3 agent的状态$ neutron agent-list, neutron agent-show • 设置该agent的管理状态为down $neutron agent- update • 查询agent节点上的所有router $neutron router- list-on-l3-agent • 设置各个router的管理状态为down $neutron router-update • 设置各个router的管理状态为up $neutron router- update 路由 器 使用HA router是个不错的选择 端口绑定失败 $ neutron port-list -c id -c binding:vif_type -c binding:host_id +--------------------------------------+------------------+------------------+ | id | binding:vif_type | binding:host_id | +--------------------------------------+------------------+------------------+ | 13fae5f1-90d6-4cef-90ec-0eb7fd520ed7 | ovs | ubuntu | | 2042df4d-fcaa-47dc-8aa9-4dc1ebadfaec | ovs | ubuntu | | 5ea44449-eca8-48fc-9afb-be57c6787f65 | binding_failed | ubuntu1404-2 | | bfdfc239-a5c2-436f-bcc2-7e52b3bbc719 | ovs | ubuntu1404-2 | | e8e03dd1-0e01-4fa3-8b06-1904850166eb | ovs | ubuntu1404-2 | | f138218c-5f6b-4639-91f4-386ad4765696 | ovs | ubuntu | +--------------------------------------+------------------+------------------+ 没有tag 解决方案: $ neutron port-update 5ea44449-eca8-48fc- 9afb-be57c6787f65 --binding:host_id=ggg $ neutron port-update 5ea44449-eca8-48fc- 9afb-be57c6787f65 -- binding:host_id=ubuntu1404-2 注意tag 4095端口 $ sudo ovs-vsctl show Bridge br-int fail_mode: secure Port patch-tun Interface patch-tun type: patch options: {peer=patch-int} Port "tap2042df4d-fc" tag: 1 Interface "tap2042df4d-fc" type: internal Port "qvof138218c-5f" tag: 4095 Interface "qvof138218c-5f" 1.确认 port 不在neutron server 中,然后删除ovs port 2.如在neutron server中,重新 更改binding neutron链路分析 谢谢 微信: robingong2004