Openstack networking VLAN

To create floating IP pool on VLAN tagged physical network:

First create a VXLAN network (L2 network):

[bash]
openstack network create internal
[/bash]

 

[bash]
+—————————+————————————–+
| Field                     | Value                                |
+—————————+————————————–+
| admin_state_up            | UP                                   |
| availability_zone_hints   |                                      |
| availability_zones        |                                      |
| created_at                | 2017-01-03T11:22:33Z                 |
| description               |                                      |
| headers                   |                                      |
| id                        | 14cd4143-89a6-4d79-aefe-c148bae892cf |
| ipv4_address_scope        | None                                 |
| ipv6_address_scope        | None                                 |
| mtu                       | 1450                                 |
| name                      | internal                             |
| port_security_enabled     | True                                 |
| project_id                | 87f8c0ed08534b1da737f85d055a0912     |
| project_id                | 87f8c0ed08534b1da737f85d055a0912     |
| provider:network_type     | vxlan                                |
| provider:physical_network | None                                 |
| provider:segmentation_id  | 74                                   |
| revision_number           | 3                                    |
| router:external           | Internal                             |
| shared                    | False                                |
| status                    | ACTIVE                               |
| subnets                   |                                      |
| tags                      | []                                   |
| updated_at                | 2017-01-03T11:22:33Z                 |
+—————————+————————————–+
[bash]
Create subnet:

[bash]
openstack subnet create vxlan_10.0.0.0 –network internal   –subnet-range 10.0.0.0/24
[/bash]

[bash]
+——————-+————————————–+
| Field             | Value                                |
+——————-+————————————–+
| allocation_pools  | 10.0.0.2-10.0.0.254                  |
| cidr              | 10.0.0.0/24                          |
| created_at        | 2017-01-03T11:24:35Z                 |
| description       |                                      |
| dns_nameservers   |                                      |
| enable_dhcp       | True                                 |
| gateway_ip        | 10.0.0.1                             |
| headers           |                                      |
| host_routes       |                                      |
| id                | 9591dedc-2cd8-431b-9973-bf25a74d5a3c |
| ip_version        | 4                                    |
| ipv6_address_mode | None                                 |
| ipv6_ra_mode      | None                                 |
| name              | vxlan_10.0.0.0                       |
| network_id        | 14cd4143-89a6-4d79-aefe-c148bae892cf |
| project_id        | 87f8c0ed08534b1da737f85d055a0912     |
| project_id        | 87f8c0ed08534b1da737f85d055a0912     |
| revision_number   | 2                                    |
| service_types     | []                                   |
| subnetpool_id     | None                                 |
| updated_at        | 2017-01-03T11:24:35Z                 |
+——————-+————————————–+
[/bash]

Now let’s create VLAN network (physical):

[bash]
openstack network create vlan-102 –share –provider-physical-network vlan –provider-network-type vlan –provider-segment 102 –external
[/bash]

[bash]
+—————————+————————————–+
| Field                     | Value                                |
+—————————+————————————–+
| admin_state_up            | UP                                   |
| availability_zone_hints   |                                      |
| availability_zones        |                                      |
| created_at                | 2017-01-03T10:58:08Z                 |
| description               |                                      |
| headers                   |                                      |
| id                        | 41c4bda4-b8d4-43f3-88c7-9ba9ad6c6314 |
| ipv4_address_scope        | None                                 |
| ipv6_address_scope        | None                                 |
| is_default                | False                                |
| mtu                       | 1500                                 |
| name                      | vlan-102                             |
| port_security_enabled     | True                                 |
| project_id                | 87f8c0ed08534b1da737f85d055a0912     |
| project_id                | 87f8c0ed08534b1da737f85d055a0912     |
| provider:network_type     | vlan                                 |
| provider:physical_network | vlan                                 |
| provider:segmentation_id  | 102                                  |
| revision_number           | 3                                    |
| router:external           | External                             |
| shared                    | True                                 |
| status                    | ACTIVE                               |
| subnets                   |                                      |
| tags                      | []                                   |
| updated_at                | 2017-01-03T10:58:08Z                 |
+—————————+————————————–+
[/bash]

“-provider-physical-network vlan” is taken  from openstack_user_config.yml 

– network:
container_bridge: “br-vlan”
container_type: “veth”
container_interface: “eth12”
type: “vlan”
net_name: “vlan”
range: “102:102”
group_binds:
– neutron_linuxbridge_agent

It can also be found in neutron-server-container:

[bash]
grep -n network_vlan_ranges /etc/neutron/plugins/ml2/ml2_conf.ini
18:network_vlan_ranges = vlan:102:102[/bash]

Create a subnet:

[bash]
openstack subnet create –network vlan102 –subnet-range 192.168.102.0/24  –allocation-pool start=192.168.102.1,end=192.168.102.250 –gateway 192.168.102.254 vlan102_192.168.102.0 [/bash]

[bash]
+——————-+————————————–+
| Field             | Value                                |
+——————-+————————————–+
| allocation_pools  | 192.168.102.1-192.168.102.250        |
| cidr              | 192.168.102.0/24                     |
| created_at        | 2017-01-03T11:13:29Z                 |
| description       |                                      |
| dns_nameservers   |                                      |
| enable_dhcp       | True                                 |
| gateway_ip        | 192.168.102.254                      |
| headers           |                                      |
| host_routes       |                                      |
| id                | be4681b7-1301-46e1-9fda-0191063802fd |
| ip_version        | 4                                    |
| ipv6_address_mode | None                                 |
| ipv6_ra_mode      | None                                 |
| name              | vlan102_192.168.102.0                |
| network_id        | 697bebb8-b633-4cee-ac94-409433268f22 |
| project_id        | 87f8c0ed08534b1da737f85d055a0912     |
| project_id        | 87f8c0ed08534b1da737f85d055a0912     |
| revision_number   | 2                                    |
| service_types     | []                                   |
| subnetpool_id     | None                                 |
| updated_at        | 2017-01-03T11:13:29Z                 |
+——————-+————————————–+
[/bash]

Since virtual machines will have only internal (VXLAN) network attached to them, we need to create a router for IPs from external  network to be “glued” to internal network at Neutron side:

[bash]
openstack router create primary_router
[/bash]

[bash]
+————————-+————————————–+
| Field                   | Value                                |
+————————-+————————————–+
| admin_state_up          | UP                                   |
| availability_zone_hints |                                      |
| availability_zones      |                                      |
| created_at              | 2017-01-03T11:34:32Z                 |
| description             |                                      |
| distributed             | False                                |
| external_gateway_info   | null                                 |
| flavor_id               | None                                 |
| ha                      | True                                 |
| headers                 |                                      |
| id                      | fc299974-5836-46aa-baf7-a78eabe99486 |
| name                    | primary_router                       |
| project_id              | 87f8c0ed08534b1da737f85d055a0912     |
| project_id              | 87f8c0ed08534b1da737f85d055a0912     |
| revision_number         | 2                                    |
| routes                  |                                      |
| status                  | ACTIVE                               |
| updated_at              | 2017-01-03T11:34:32Z                 |
+————————-+————————————–+

[/bash]

Add VXLAN and VLAN subnets to router:

[bash]
neturon router-gateway-set primary_router vlan102
neutron router-interface-add primary_router

[/bash]

 


 

Tags :

About the Author

Leave a Reply

Your email address will not be published. Required fields are marked *