OpenStack Queens三节点从零部署-配置网络(VXLAN_LinuxBridge)

最后修改时间:2018年7月1日

文档版本:1.0

本操作分别在三个节点上完成

一. 配置控制节点

root@controller:~(keystone)# vim /etc/neutron/plugins/ml2/ml2_conf.ini
 
# 第130行:添加网络类型
tenant_network_types = vxlan
 
# 第181行:添加
flat_networks = physnet1
 
# 第235行:添加
vni_ranges = 1:1000
root@controller:~(keystone)# systemctl restart neutron-server

二. 配置网络节点

root@network:~# vim /etc/neutron/plugins/ml2/ml2_conf.ini
 
# 第130行:添加网络类型
tenant_network_types = vxlan
 
# 第181行:添加
flat_networks = physnet1
 
# 第235行:添加
vni_ranges = 1:1000
 
root@network:~# vim /etc/neutron/plugins/ml2/linuxbridge_agent.ini
 
# 第118行:添加
[agent]
prevent_arp_spoofing = True
 
# 第147行:添加
[linux_bridge]
physical_interface_mappings = physnet1:ens3
 
# 第201行:添加
[vxlan]
enable_vxlan = True
l2_population = True
 
root@network:~# vim /etc/neutron/dhcp_agent.ini
 
# 第63行:添加
dnsmasq_config_file = /etc/neutron/dnsmasq-neutron.conf
 
root@network:~# vim /etc/neutron/dnsmasq-neutron.conf
 
# 这是一个新文件,添加以下内容
dhcp-option-force=26,1450
 
root@network:~# for service in l3-agent dhcp-agent metadata-agent linuxbridge-agent; do
systemctl restart neutron-$service
done

三. 配置计算节点

root@compute:~# vim /etc/neutron/plugins/ml2/ml2_conf.ini
 
# 第130行:添加网络类型
tenant_network_types = vxlan
 
# 第181行:添加
flat_networks = physnet1
 
# 第235行:添加
vni_ranges = 1:1000
 
root@compute:~# vim /etc/neutron/plugins/ml2/linuxbridge_agent.ini
 
# 第118行:添加
[agent]
prevent_arp_spoofing = True
 
# 第201行:添加
[vxlan]
enable_vxlan = True
l2_population = True
 
root@compute# systemctl restart neutron-linuxbridge-agent

四. 创建网络及路由(控制节点上完成)

[1] 创建虚拟路由

root@controller:~(keystone)# openstack router create router_01
+-------------------------+--------------------------------------+
| Field                   | Value                                |
+-------------------------+--------------------------------------+
| admin_state_up          | UP                                   |
| availability_zone_hints |                                      |
| availability_zones      |                                      |
| created_at              | 2018-07-01T09:23:14Z                 |
| description             |                                      |
| distributed             | False                                |
| external_gateway_info   | None                                 |
| flavor_id               | None                                 |
| ha                      | False                                |
| id                      | c3ls8351-1952-3s85-2f95-02335s8j30s1 |
| name                    | router_01                            |
| project_id              | 29j348sj583h6i1j238zk20so1jf91j2     |
| revision_number         | 0                                    |
| routes                  |                                      |
| status                  | ACTIVE                               |
| tags                    |                                      |
| updated_at              | 2018-07-01T09:23:14Z                 |
+-------------------------+--------------------------------------+

[2] 创建外部网络

root@controller:~(keystone)# openstack network create \
--provider-physical-network physnet1 \
--provider-network-type flat --external ext_net
+---------------------------+--------------------------------------+
| Field                     | Value                                |
+---------------------------+--------------------------------------+
| admin_state_up            | UP                                   |
| availability_zone_hints   |                                      |
| availability_zones        |                                      |
| created_at                | 2018-07-01T09:24:12Z                 |
| description               |                                      |
| dns_domain                | None                                 |
| id                        | 25j29sj3-sd21-9s1a-1d02-2296038k28sj |
| ipv4_address_scope        | None                                 |
| ipv6_address_scope        | None                                 |
| is_default                | False                                |
| is_vlan_transparent       | None                                 |
| mtu                       | 1500                                 |
| name                      | ext_net                              |
| port_security_enabled     | True                                 |
| project_id                | 29j348sj583h6i1j238zk20so1jf91j2     |
| provider:network_type     | flat                                 |
| provider:physical_network | physnet1                             |
| provider:segmentation_id  | None                                 |
| qos_policy_id             | None                                 |
| revision_number           | 5                                    |
| router:external           | External                             |
| segments                  | None                                 |
| shared                    | False                                |
| status                    | ACTIVE                               |
| subnets                   |                                      |
| tags                      |                                      |
| updated_at                | 2018-07-01T09:24:12Z                 |
+---------------------------+--------------------------------------+
 
# 创建外部网络的子网
root@controller:~(keystone)# openstack subnet create subnet_01 \
--network ext_net --subnet-range 10.0.0.0/24 \
--allocation-pool start=10.0.0.50,end=10.0.0.100 \
--gateway 10.0.0.1 --dns-nameserver 10.0.0.1 --no-dhcp
+-------------------+--------------------------------------+
| Field             | Value                                |
+-------------------+--------------------------------------+
| allocation_pools  | 10.0.0.50-10.0.0.100                 |
| cidr              | 10.0.0.0/24                          |
| created_at        | 2018-07-01T09:24:49Z                 |
| description       |                                      |
| dns_nameservers   | 10.0.0.1                             |
| enable_dhcp       | False                                |
| gateway_ip        | 10.0.0.1                             |
| host_routes       |                                      |
| id                | 239n75s8-2bx8-1953-1k9s-3js9gz55q934 |
| ip_version        | 4                                    |
| ipv6_address_mode | None                                 |
| ipv6_ra_mode      | None                                 |
| name              | subnet2                              |
| network_id        | 25j29sj3-sd21-9s1a-1d02-2296038k28sj |
| project_id        | 29j348sj583h6i1j238zk20so1jf91j2     |
| revision_number   | 0                                    |
| segment_id        | None                                 |
| service_types     |                                      |
| subnetpool_id     | None                                 |
| tags              |                                      |
| updated_at        | 2018-07-01T09:24:49Z                 |
+-------------------+--------------------------------------+
 
# 连接外部网络到路由
root@controller:~(keystone)# openstack router set router_01 --external-gateway ext_net

[3] 创建内部网络

root@controller:~(keystone)# openstack network create int_net --provider-network-type vxlan
+---------------------------+--------------------------------------+
| Field                     | Value                                |
+---------------------------+--------------------------------------+
| admin_state_up            | UP                                   |
| availability_zone_hints   |                                      |
| availability_zones        |                                      |
| created_at                | 2018-07-01T09:24:58Z                 |
| description               |                                      |
| dns_domain                | None                                 |
| id                        | 3396hn93-ak63-jj92-1l30-2394jsu2o49s |
| ipv4_address_scope        | None                                 |
| ipv6_address_scope        | None                                 |
| is_default                | False                                |
| is_vlan_transparent       | None                                 |
| mtu                       | 1450                                 |
| name                      | int_net                              |
| port_security_enabled     | True                                 |
| project_id                | 29j348sj583h6i1j238zk20so1jf91j2     |
| provider:network_type     | vxlan                                |
| provider:physical_network | None                                 |
| provider:segmentation_id  | 60                                   |
| qos_policy_id             | None                                 |
| revision_number           | 2                                    |
| router:external           | Internal                             |
| segments                  | None                                 |
| shared                    | False                                |
| status                    | ACTIVE                               |
| subnets                   |                                      |
| tags                      |                                      |
| updated_at                | 2018-07-01T09:24:58Z                 |
+---------------------------+--------------------------------------+
 
# 创建内部网络的子网
root@controller:~(keystone)# openstack subnet create subnet_02 --network int_net \
--subnet-range 192.168.100.0/24 --gateway 192.168.100.1 \
--dns-nameserver 10.0.0.1
 
# 连接内部网络到路由
root@controller:~(keystone)# openstack router add subnet router_01 subnet_02
Leave a Reply