注:Controller
节点 ip
是192.168.0.200
,compute1
节点是 192.168.0.203
- 安装和配置(基于 Self-service networks
Controller
节点)
- 下载:
yum install openstack-neutron openstack-neutron-ml2 openstack-neutron-linuxbridge ebtables
- 配置
vi /etc/neutron/neutron.conf
[database] ... connection = mysql+pymysql://neutron:123456@controller/neutron [DEFAULT] ... core_plugin = ml2 service_plugins = router allow_overlapping_ips = true transport_url = rabbit://openstack:123456@controller auth_strategy = keystone notify_nova_on_port_status_changes = true notify_nova_on_port_data_changes = true [keystone_authtoken] ... auth_uri = http://controller:5000 auth_url = http://controller:35357 memcached_servers = controller:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = neutron password = 123456 [nova] ... auth_url = http://controller:35357 auth_type = password project_domain_name = default user_domain_name = default region_name = RegionOne project_name = service username = nova password = 123456 [oslo_concurrency] ... lock_path = /var/lib/neutron/tmp
- 配置
vi /etc/neutron/plugins/ml2/ml2_conf.ini
[ml2] ... type_drivers = flat,vlan,vxlan tenant_network_types = vxlan mechanism_drivers = linuxbridge,l2population extension_drivers = port_security [ml2_type_flat] ... flat_networks = provider [ml2_type_vxlan] ... vni_ranges = 1:1000 [securitygroup] ... enable_ipset = true
- 配置
vi /etc/neutron/plugins/ml2/linuxbridge_agent.ini
[linux_bridge] physical_interface_mappings = provider:enp3s0 [vxlan] enable_vxlan = true local_ip = 192.168.0.200 l2_population = true [securitygroup] ... enable_security_group = true firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
- 配置
vi /etc/neutron/l3_agent.ini
[DEFAULT] ... interface_driver = linuxbridge
- 配置
vi /etc/neutron/dhcp_agent.ini
[DEFAULT] ... interface_driver = linuxbridge dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq enable_isolated_metadata = true
- 启动
systemctl enable neutron-l3-agent.service
systemctl start neutron-l3-agent.service
- 配置(基于 Self-service networks
compute1
节点)
- 配置
vi /etc/neutron/plugins/ml2/linuxbridge_agent.ini
[linux_bridge] physical_interface_mappings = provider:enp3s0 [vxlan] enable_vxlan = true local_ip = 192.168.0.203 l2_population = true [securitygroup] ... enable_security_group = true firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
- 验证(Controller 节点)
注:先创建provider
网络
- 登录:
. admin-openrc
- 查看列表:
openstack network agent list
image.png
- 创建网络
- 登录:
. demo-openrc
- 创建:
openstack network create selfservice
image.png- 创建子网:
openstack subnet create --network selfservice --dns-nameserver 192.168.0.1 --gateway 172.16.1.1 --subnet-range 172.16.1.0/24 selfservice
image.png
- 创建路由
登录:
. demo-openrc
创建
router
openstack router create router
image.png添加到网络上
neutron router-interface-add router selfservice
image.png在路由器上设置网关
neutron router-gateway-set router provider
image.png
- 验证
- 登录:
. admin-openrc
- ip:
ip netns
image.png- 查看路由:
neutron router-port-list router
image.png