# OpenStack中使用vlan模式安装neutron ## 问题简述 ​ 根据2020年云计算大赛第一套习题中,部署neutron时需要使用vlan模式。但是默认的安装脚本使用vxlan模式,无法使用vlan进行网络通讯。 ## 解决方案 ### 交换机配置 ​ 在三层交换机配置中,需要修改个节点外部网卡(例:eth1)对应的端口为trunk模式。 ### 安装脚本(修改后) ​ 这里贴出修改部分的脚本内容。 ``` shell # iaas-install-neutron-controller.sh ################################################################### #/etc/neutron/plugins/ml2/ml2_conf.ini crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 type_drivers flat,vlan crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 tenant_network_types crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 mechanism_drivers linuxbridge crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2 extension_drivers port_security crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_type_flat flat_networks $Physical_NAME crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_type_vlan network_vlan_ranges $Physical_NAME:$minvlan:$maxvlan # crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_type_vxlan vni_ranges $minvlan:$maxvlan crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini securitygroup enable_ipset true #/etc/neutron/plugins/ml2/linuxbridge_agent.ini crudini --set /etc/neutron/plugins/ml2/linuxbridge_agent.ini linux_bridge physical_interface_mappings $Physical_NAME:$INTERFACE_NAME crudini --set /etc/neutron/plugins/ml2/linuxbridge_agent.ini vxlan enable_vxlan false # crudini --set /etc/neutron/plugins/ml2/linuxbridge_agent.ini vxlan local_ip $INTERFACE_IP # crudini --set /etc/neutron/plugins/ml2/linuxbridge_agent.ini vxlan l2_population true ################################################################### # iaas-install-neutron-compute.sh ################################################################### #/etc/neutron/plugins/ml2/linuxbridge_agent.ini crudini --set /etc/neutron/plugins/ml2/linuxbridge_agent.ini linux_bridge physical_interface_mappings provider:$INTERFACE_NAME crudini --set /etc/neutron/plugins/ml2/linuxbridge_agent.ini vxlan enable_vxlan false # crudini --set /etc/neutron/plugins/ml2/linuxbridge_agent.ini vxlan local_ip $INTERFACE_IP # crudini --set /etc/neutron/plugins/ml2/linuxbridge_agent.ini vxlan l2_population true crudini --set /etc/neutron/plugins/ml2/linuxbridge_agent.ini securitygroup enable_security_group true crudini --set /etc/neutron/plugins/ml2/linuxbridge_agent.ini securitygroup firewall_driver neutron.agent.linux.iptables_firewall.IptablesFirewallDriver