CentOS 7
Ads

OpenStack Ocata : Neutron Network (VXLAN)
2017/02/28
 
Configure virtual networking by OpenStack Network Service (Neutron).
For example, configure VXLAN type of networking on here.
Before it, Configure basic settings on Control Node, Network Node, Compute Node.
Furthermore, this example is based on the environment that Network Node has 2 network interfaces.
     ------------+--------------------------------+--------------------------------+------------
                 |                                |                                |
             eth0|10.0.0.30                   eth0|10.0.0.50                   eth0|10.0.0.51
     +-----------+-----------+        +-----------+-----------+        +-----------+-----------+
     |    [ Control Node ]   |        |    [ Network Node ]   |        |    [ Compute Node ]   |
     |                       |        |                       |        |                       |
     |  MariaDB    RabbitMQ  |        |      Open vSwitch     |eth1    |        Libvirt        |
     |  Memcached  httpd     |        |  L2,L3,Metadata Agent +----    |      Nova Compute     |
     |  Keystone   Glance    |        |                       |        |      Open vSwitch     |
     |  Nova API             |        |                       |        |        L2 Agent       |
     |  Neutron Server       |        |                       |        |                       |
     +-----------------------+        +-----------------------+        +-----------------------+

[1] Change settings on Control Node.
[root@dlp ~(keystone)]#
vi /etc/neutron/plugins/ml2/ml2_conf.ini
# line 115: add a value to tenant_network_types

[ml2]
type_drivers = flat,vlan,gre,vxlan
tenant_network_types =
vxlan
# line 166: add

[ml2_type_flat]
flat_networks = physnet1
# line 220: add

[ml2_type_vxlan]
vni_ranges = 1:1000
[root@dlp ~(keystone)]#
systemctl restart neutron-server

[2] Change settings on Network Node.
# add bridge

[root@network ~]#
ovs-vsctl add-br br-eth1

# add eth1 to the port of the bridge above

[root@network ~]#
ovs-vsctl add-port br-eth1 eth1

[root@network ~]#
vi /etc/neutron/plugins/ml2/ml2_conf.ini
# line 115: add a value to tenant_network_types

[ml2]
type_drivers = flat,vlan,gre,vxlan
tenant_network_types =
vxlan
# line 166: add

[ml2_type_flat]
flat_networks = physnet1
# line 220: add

[ml2_type_vxlan]
vni_ranges = 1:1000
# line 248: change

firewall_driver =
iptables_hybrid
[root@network ~]#
vi /etc/neutron/plugins/ml2/openvswitch_agent.ini
# line 114: add

[agent]
tunnel_types = vxlan
l2_population = True
prevent_arp_spoofing = True
# line 195: add (specify IP address of this host for local_ip)

[ovs]
local_ip = 10.0.0.50
bridge_mappings = physnet1:br-eth1
[root@network ~]#
for service in dhcp-agent l3-agent metadata-agent openvswitch-agent; do
systemctl restart neutron-$service
done
# if Firewalld is running, stop it

[root@network ~]#
systemctl stop firewalld

[3] Change settings on Compute Node.
[root@node01 ~]#
vi /etc/neutron/plugins/ml2/ml2_conf.ini
# line 115: add a value to tenant_network_types

[ml2]
type_drivers = flat,vlan,gre,vxlan
tenant_network_types =
vxlan
# line 166: add

[ml2_type_flat]
flat_networks = physnet1
# line 220: add

[ml2_type_vxlan]
vni_ranges = 1:1000
# line 248: change

firewall_driver =
iptables_hybrid
[root@node01 ~]#
vi /etc/neutron/plugins/ml2/openvswitch_agent.ini
# line 114: add

[agent]
tunnel_types = vxlan
l2_population = True
prevent_arp_spoofing = True
# line 195: add (specify IP address of this host for local_ip)

[ovs]
local_ip = 10.0.0.51
[root@node01 ~]#
systemctl restart neutron-openvswitch-agent
# if Firewalld is running, stop it

[root@node01 ~]#
systemctl stop firewalld

[4] Create a Virtual router. It's OK to work on any node. (This example is on Control Node)
[root@dlp ~(keystone)]#
openstack router create router01

+-------------------------+--------------------------------------+
| Field                   | Value                                |
+-------------------------+--------------------------------------+
| admin_state_up          | UP                                   |
| availability_zone_hints |                                      |
| availability_zones      |                                      |
| created_at              | 2017-03-04T13:49:15Z                 |
| description             |                                      |
| distributed             | False                                |
| external_gateway_info   | None                                 |
| flavor_id               | None                                 |
| ha                      | False                                |
| id                      | 82ec16e7-19c0-4e2f-afd9-afeeaf1de0d2 |
| name                    | router01                             |
| project_id              | c654e2e098b14356b97b6e613775cc54     |
| revision_number         | None                                 |
| routes                  |                                      |
| status                  | ACTIVE                               |
| updated_at              | 2017-03-04T13:49:15Z                 |
+-------------------------+--------------------------------------+
[5] Create internal network and associate with the router above.
# create internal network

[root@dlp ~(keystone)]#
openstack network create int_net --provider-network-type vxlan

+---------------------------+--------------------------------------+
| Field                     | Value                                |
+---------------------------+--------------------------------------+
| admin_state_up            | UP                                   |
| availability_zone_hints   |                                      |
| availability_zones        |                                      |
| created_at                | 2017-03-04T13:50:37Z                 |
| description               |                                      |
| dns_domain                | None                                 |
| id                        | eab3a11e-930b-4eb6-a87d-9512ed460bed |
| ipv4_address_scope        | None                                 |
| ipv6_address_scope        | None                                 |
| is_default                | None                                 |
| mtu                       | 1450                                 |
| name                      | int_net                              |
| port_security_enabled     | True                                 |
| project_id                | c654e2e098b14356b97b6e613775cc54     |
| provider:network_type     | vxlan                                |
| provider:physical_network | None                                 |
| provider:segmentation_id  | 32                                   |
| qos_policy_id             | None                                 |
| revision_number           | 3                                    |
| router:external           | Internal                             |
| segments                  | None                                 |
| shared                    | False                                |
| status                    | ACTIVE                               |
| subnets                   |                                      |
| updated_at                | 2017-03-04T13:50:37Z                 |
+---------------------------+--------------------------------------+

# create subnet in the internal network

[root@dlp ~(keystone)]#
openstack subnet create subnet1 --network int_net \
--subnet-range 192.168.100.0/24 --gateway 192.168.100.1 \
--dns-nameserver 10.0.0.10

+-------------------+--------------------------------------+
| Field             | Value                                |
+-------------------+--------------------------------------+
| allocation_pools  | 192.168.100.2-192.168.100.254        |
| cidr              | 192.168.100.0/24                     |
| created_at        | 2017-03-04T13:51:11Z                 |
| description       |                                      |
| dns_nameservers   | 10.0.0.10                            |
| enable_dhcp       | True                                 |
| gateway_ip        | 192.168.100.1                        |
| host_routes       |                                      |
| id                | 4e93c50e-c147-4fa5-8916-f794ed262689 |
| ip_version        | 4                                    |
| ipv6_address_mode | None                                 |
| ipv6_ra_mode      | None                                 |
| name              | subnet1                              |
| network_id        | eab3a11e-930b-4eb6-a87d-9512ed460bed |
| project_id        | c654e2e098b14356b97b6e613775cc54     |
| revision_number   | 2                                    |
| segment_id        | None                                 |
| service_types     |                                      |
| subnetpool_id     | None                                 |
| updated_at        | 2017-03-04T13:51:11Z                 |
+-------------------+--------------------------------------+

# set internal network to the router above

[root@dlp ~(keystone)]#
openstack router add subnet router01 subnet1
[6] Create external network and associate with the router above.
# create external network

[root@dlp ~(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                | 2017-03-04T13:53:53Z                 |
| description               |                                      |
| dns_domain                | None                                 |
| id                        | 0eb12bc2-4375-4cf0-bedb-e8cae969976e |
| ipv4_address_scope        | None                                 |
| ipv6_address_scope        | None                                 |
| is_default                | False                                |
| mtu                       | 1500                                 |
| name                      | ext_net                              |
| port_security_enabled     | True                                 |
| project_id                | c654e2e098b14356b97b6e613775cc54     |
| provider:network_type     | flat                                 |
| provider:physical_network | physnet1                             |
| provider:segmentation_id  | None                                 |
| qos_policy_id             | None                                 |
| revision_number           | 4                                    |
| router:external           | External                             |
| segments                  | None                                 |
| shared                    | False                                |
| status                    | ACTIVE                               |
| subnets                   |                                      |
| updated_at                | 2017-03-04T13:53:53Z                 |
+---------------------------+--------------------------------------+

# create subnet in external network

[root@dlp ~(keystone)]#
openstack subnet create subnet2 \
--network ext_net --subnet-range 10.0.0.0/24 \
--allocation-pool start=10.0.0.200,end=10.0.0.254 \
--gateway 10.0.0.1 --dns-nameserver 10.0.0.10 --no-dhcp

+-------------------+--------------------------------------+
| Field             | Value                                |
+-------------------+--------------------------------------+
| allocation_pools  | 10.0.0.200-10.0.0.254                |
| cidr              | 10.0.0.0/24                          |
| created_at        | 2017-03-04T13:55:15Z                 |
| description       |                                      |
| dns_nameservers   | 10.0.0.10                            |
| enable_dhcp       | False                                |
| gateway_ip        | 10.0.0.1                             |
| host_routes       |                                      |
| id                | 26cd73d2-d2a4-4d6b-a527-1ec58ebbdac4 |
| ip_version        | 4                                    |
| ipv6_address_mode | None                                 |
| ipv6_ra_mode      | None                                 |
| name              | subnet2                              |
| network_id        | 0eb12bc2-4375-4cf0-bedb-e8cae969976e |
| project_id        | c654e2e098b14356b97b6e613775cc54     |
| revision_number   | 2                                    |
| segment_id        | None                                 |
| service_types     |                                      |
| subnetpool_id     | None                                 |
| updated_at        | 2017-03-04T13:55:15Z                 |
+-------------------+--------------------------------------+

# set gateway to the router above

[root@dlp ~(keystone)]#
openstack router set router01 --external-gateway ext_net

[7] Create and start Virtual machine Instance.
[root@dlp ~(keystone)]#
Int_Net_ID=`openstack network list | grep int_net | awk '{ print $2 }'`

[root@dlp ~(keystone)]#
openstack image list

+--------------------------------------+---------+--------+
| ID                                   | Name    | Status |
+--------------------------------------+---------+--------+
| c13b45a8-5664-4169-93c7-625ae2e561e9 | CentOS7 | active |
+--------------------------------------+---------+--------+

[root@dlp ~(keystone)]#
openstack server create --flavor m1.small --image CentOS7 --security-group default --nic net-id=$Int_Net_ID CentOS_7

[root@dlp ~(keystone)]#
openstack server list

+-----------+----------+--------+-----------------------+------------+
| ID        | Name     | Status | Networks              | Image Name |
+-----------+----------+--------+-----------------------+------------+
| e45e43eb- | CentOS_7 | ACTIVE | int_net=192.168.100.9 | CentOS7    |
+-----------+----------+--------+-----------------------+------------+
[8] Assign floating IP address to the Instance above.
[root@dlp ~(keystone)]#
openstack floating ip create ext_net

+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| created_at          | 2017-03-04T14:01:13Z                 |
| description         |                                      |
| fixed_ip_address    | None                                 |
| floating_ip_address | 10.0.0.210                           |
| floating_network_id | 0eb12bc2-4375-4cf0-bedb-e8cae969976e |
| id                  | 8b8efd26-01cc-426b-bb7c-35e6b2a389a4 |
| name                | None                                 |
| port_id             | None                                 |
| project_id          | c654e2e098b14356b97b6e613775cc54     |
| revision_number     | 1                                    |
| router_id           | None                                 |
| status              | DOWN                                 |
| updated_at          | 2017-03-04T14:01:13Z                 |
+---------------------+--------------------------------------+

[root@dlp ~(keystone)]#
openstack server add floating ip CentOS_7 10.0.0.210

# show settings

[root@dlp ~(keystone)]#
openstack floating ip show 10.0.0.210

+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| created_at          | 2017-03-04T14:01:13Z                 |
| description         |                                      |
| fixed_ip_address    | 192.168.100.9                        |
| floating_ip_address | 10.0.0.210                           |
| floating_network_id | 0eb12bc2-4375-4cf0-bedb-e8cae969976e |
| id                  | 8b8efd26-01cc-426b-bb7c-35e6b2a389a4 |
| name                | None                                 |
| port_id             | 2cea5e35-38cd-4ca9-92f8-10c5427ba544 |
| project_id          | c654e2e098b14356b97b6e613775cc54     |
| revision_number     | 2                                    |
| router_id           | 82ec16e7-19c0-4e2f-afd9-afeeaf1de0d2 |
| status              | ACTIVE                               |
| updated_at          | 2017-03-04T14:01:33Z                 |
+---------------------+--------------------------------------+

[root@dlp ~(keystone)]#
openstack server list

+-----------+----------+--------+-----------------------------------+------------+
| ID        | Name     | Status | Networks                          | Image Name |
+-----------+----------+--------+-----------------------------------+------------+
| e45e43eb- | CentOS_7 | ACTIVE | int_net=192.168.100.9, 10.0.0.210 | CentOS7    |
+-----------+----------+--------+-----------------------------------+------------+
[9] Configure security settings like follows to access with SSH and ICMP.
# permit ICMP

[root@dlp ~(keystone)]#
openstack security group rule create --protocol icmp --ingress default

+-------------------+--------------------------------------+
| Field             | Value                                |
+-------------------+--------------------------------------+
| created_at        | 2017-02-28T07:54:12Z                 |
| description       |                                      |
| direction         | ingress                              |
| ether_type        | IPv4                                 |
| id                | 180e4ec7-9221-42fb-bdba-382c5a06a8f4 |
| name              | None                                 |
| port_range_max    | None                                 |
| port_range_min    | None                                 |
| project_id        | c654e2e098b14356b97b6e613775cc54     |
| protocol          | icmp                                 |
| remote_group_id   | None                                 |
| remote_ip_prefix  | 0.0.0.0/0                            |
| revision_number   | 1                                    |
| security_group_id | 160e1d9e-72b9-4ed3-a434-276518f22a7b |
| updated_at        | 2017-02-28T07:54:12Z                 |
+-------------------+--------------------------------------+

# permit SSH

[root@dlp ~(keystone)]#
openstack security group rule create --protocol tcp --dst-port 22:22 default

+-------------------+--------------------------------------+
| Field             | Value                                |
+-------------------+--------------------------------------+
| created_at        | 2017-02-28T07:55:14Z                 |
| description       |                                      |
| direction         | ingress                              |
| ether_type        | IPv4                                 |
| id                | 93a858de-87b5-4544-8d23-ef4f24da5f3b |
| name              | None                                 |
| port_range_max    | 22                                   |
| port_range_min    | 22                                   |
| project_id        | c654e2e098b14356b97b6e613775cc54     |
| protocol          | tcp                                  |
| remote_group_id   | None                                 |
| remote_ip_prefix  | 0.0.0.0/0                            |
| revision_number   | 1                                    |
| security_group_id | 160e1d9e-72b9-4ed3-a434-276518f22a7b |
| updated_at        | 2017-02-28T07:55:14Z                 |
+-------------------+--------------------------------------+

[root@dlp ~(keystone)]#
openstack security group rule list

+-------------------+-------------+-----------+------------+--------------------------------------+--------------+
| ID                | IP Protocol | IP Range  | Port Range | Remote Security Group                | Security Gro |
+-------------------+-------------+-----------+------------+--------------------------------------+--------------+
| 180e4ec7-9221-... | icmp        | 0.0.0.0/0 |            | None                                 | 160e1d9e-... |
| 29b38eb3-2004-... | None        | None      |            | 160e1d9e-72b9-4ed3-a434-276518f22a7b | 160e1d9e-... |
| 93a858de-87b5-... | tcp         | 0.0.0.0/0 | 22:22      | None                                 | 160e1d9e-... |
| 9f86c90e-6357-... | None        | None      |            | None                                 | 160e1d9e-... |
| a1feacc0-c8ea-... | None        | None      |            | None                                 | 160e1d9e-... |
| f46d96c3-235a-... | None        | None      |            | 160e1d9e-72b9-4ed3-a434-276518f22a7b | 160e1d9e-... |
+-------------------+-------------+-----------+------------+--------------------------------------+--------------+
[10] It's possible to login to the Instance to connect to the IP address with SSH like follows.
[root@dlp ~(keystone)]#
openstack server list

+-----------+----------+--------+-----------------------------------+------------+
| ID        | Name     | Status | Networks                          | Image Name |
+-----------+----------+--------+-----------------------------------+------------+
| e45e43eb- | CentOS_7 | ACTIVE | int_net=192.168.100.9, 10.0.0.210 | CentOS7    |
+-----------+----------+--------+-----------------------------------+------------+

[root@dlp ~(keystone)]#
ssh 10.0.0.210

The authenticity of host '10.0.0.195 (10.0.0.210)' can't be established.
ECDSA key fingerprint is xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.0.0.210' (ECDSA) to the list of known hosts.
root@10.0.0.210's password:
Last login: Wed Mar  1 16:30:10 2017
[root@host-192-168-100-9 ~]#    
# just logined
 
Tweet