CentOS 6
Sponsored Link

OpenStack Icehouse : Neutron Networking#1(Flat)2014/06/25

 
Configure virtual networking by OpenStack Network Service (Neutron).
For example, configure simply flat networking.
Before it, Configure basic settings on Control Node, Network Node. Compute Node.
Furthermore, this example is based on the environment that Network Node and Compute Node have 2 network interfaces.

                                        |
  +-------------+                  +----+----+
  | Name Server |                  | Gateway |
  +------+------+                  +----+----+
         |10.0.0.10                     |10.0.0.1
         |                              |
         +------------+-----------------+------------------+
         |            |                 |                  |     10.0.0.200-10.0.0.250
     eth0|10.0.0.30   |             eth0|10.0.0.50         |         +-----------------+
+--------+---------+  |     +-----------+----------+       |     +---| Virtual Machine |
| [ Control Node ] |  |     |   [ Network Node ]   |       |     |   +-----------------+
|     Keystone     |  |     |       DHCP Agent     |       |     |   +-----------------+
|      Glance      |  |     |       L3 Agent       |eth1   |     |---| Virtual Machine |
|     Nova API     |  |     |       L2 Agent       |       |     |   +-----------------+
|  Neutron Server  |  |     |    Metadata Agent    |       |     |   +-----------------+
+------------------+  |     +----------------------+       +-----+---| Virtual Machine |
                      |                                          |   +-----------------+
                      |     +----------------------+             |   +-----------------+
                      | eth0|   [ Compute Node ]   |             |---| Virtual Machine |
                      +-----|     Nova Compute     |eth1         |   +-----------------+
                   10.0.0.51|       L2 Agent       |             |   +-----------------+
                            +----------------------+             +---| Virtual Machine |
                                                                     +-----------------+

[1] Change settings like follows on both Network Node and Compute Node.
[root@network ~]#
ovs-vsctl add-br br-eth1
# add a bridge

[root@network ~]#
ovs-vsctl add-port br-eth1 eth1
# add eth1 to the port of the bridge above

[root@network ~]#
vi /etc/neutron/plugins/ml2/ml2_conf.ini
# add at the last line

[ovs]
flat_networks = physnet1
bridge_mappings = physnet1:br-eth1
[root@network ~]#
/etc/rc.d/init.d/neutron-openvswitch-agent restart

Stopping neutron-openvswitch-agent:                        [  OK  ]
Starting neutron-openvswitch-agent:                        [  OK  ]
[2] Create network. It's OK to work on any node. (This example is on Control Node)
[root@dlp ~(keystone)]#
tenantID=`keystone tenant-list | grep service | awk '{print $2}'`
# create network named "sharednet1"

[root@dlp ~(keystone)]#
neutron net-create --tenant-id $tenantID sharednet1 \
--shared --provider:network_type flat --provider:physical_network physnet1

Created a new network:
+---------------------------+--------------------------------------+
| Field                     | Value                                |
+---------------------------+--------------------------------------+
| admin_state_up            | True                                 |
| id                        | 8291f377-18b4-4315-a397-6fdc358680d9 |
| name                      | sharednet1                           |
| provider:network_type     | flat                                 |
| provider:physical_network | physnet1                             |
| provider:segmentation_id  |                                      |
| shared                    | True                                 |
| status                    | ACTIVE                               |
| subnets                   |                                      |
| tenant_id                 | fc294b687db2410189f7c8bd81efe426     |
+---------------------------+--------------------------------------+

# create subnet "10.0.0.0/24" in "sharednet1"

[root@dlp ~(keystone)]#
neutron subnet-create \
--tenant-id $tenantID --gateway 10.0.0.1 --dns-nameserver 10.0.0.1 \
--allocation-pool start=10.0.0.200,end=10.0.0.250 sharednet1 10.0.0.0/24

Created a new subnet:
+------------------+----------------------------------------------+
| Field            | Value                                        |
+------------------+----------------------------------------------+
| allocation_pools | {"start": "10.0.0.200", "end": "10.0.0.250"} |
| cidr             | 10.0.0.0/24                                  |
| dns_nameservers  | 10.0.0.1                                     |
| enable_dhcp      | True                                         |
| gateway_ip       | 10.0.0.1                                     |
| host_routes      |                                              |
| id               | 7940c0df-c16f-4c47-853b-045682ce2b39         |
| ip_version       | 4                                            |
| name             |                                              |
| network_id       | 8291f377-18b4-4315-a397-6fdc358680d9         |
| tenant_id        | fc294b687db2410189f7c8bd81efe426             |
+------------------+----------------------------------------------+

# confirm settings

[root@dlp ~(keystone)]#
neutron net-list

+--------------------------------------+------------+--------------------------------------------------+
| id                                   | name       | subnets                                          |
+--------------------------------------+------------+--------------------------------------------------+
| 8291f377-18b4-4315-a397-6fdc358680d9 | sharednet1 | 7940c0df-c16f-4c47-853b-045682ce2b39 10.0.0.0/24 |
+--------------------------------------+------------+--------------------------------------------------+
[3] Create and start a Virtual machine Instance with the network just created above.
[root@dlp ~(keystone)]#
netID=`neutron net-list | grep sharednet1 | awk '{print $2}'`

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

+--------------------------------------+---------+--------+--------+
| ID                                   | Name    | Status | Server |
+--------------------------------------+---------+--------+--------+
| 04ea6c45-c928-4df9-bb12-d3728a3d9a74 | CentOS6 | ACTIVE |        |
+--------------------------------------+---------+--------+--------+

[root@dlp ~(keystone)]#
nova boot --flavor 2 --image CentOS6 --security_group default --nic net-id=$netID CentOS_65
[root@dlp ~(keystone)]#
nova list

+-----------+-----------+--------+------------+-------------+--------------------------+
| ID        | Name      | Status | Task State | Power State | Networks                 |
+-----------+-----------+--------+------------+-------------+--------------------------+
| bbfe0a8e- | CentOS_65 | ACTIVE | -          | Running     | sharednet1=10.0.0.200    |
+-----------+-----------+--------+------------+-------------+--------------------------+
[4] Configure security settings like follows to access with SSH and ICMP.
# permit SSH

[root@dlp ~(keystone)]#
nova secgroup-add-rule default tcp 22 22 0.0.0.0/0

+-------------+-----------+---------+-----------+--------------+
| IP Protocol | From Port | To Port | IP Range  | Source Group |
+-------------+-----------+---------+-----------+--------------+
| tcp         | 22        | 22      | 0.0.0.0/0 |              |
+-------------+-----------+---------+-----------+--------------+

# permit ICMP

[root@dlp ~(keystone)]#
nova secgroup-add-rule default icmp -1 -1 0.0.0.0/0

+-------------+-----------+---------+-----------+--------------+
| IP Protocol | From Port | To Port | IP Range  | Source Group |
+-------------+-----------+---------+-----------+--------------+
| icmp        | -1        | -1      | 0.0.0.0/0 |              |
+-------------+-----------+---------+-----------+--------------+

[root@dlp ~(keystone)]#
nova secgroup-list-rules default

+-------------+-----------+---------+-----------+--------------+
| IP Protocol | From Port | To Port | IP Range  | Source Group |
+-------------+-----------+---------+-----------+--------------+
| tcp         | 22        | 22      | 0.0.0.0/0 |              |
| icmp        | -1        | -1      | 0.0.0.0/0 |              |
+-------------+-----------+---------+-----------+--------------+
[5] Login to the Instance.
[root@dlp ~(keystone)]#
ssh 10.0.0.200

The authenticity of host '10.0.0.200 (10.0.0.200)' can't be established.
RSA key fingerprint is xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:76:84:a6.
Are you sure you want to continue connecting (yes/no)?
yes

Warning: Permanently added '10.0.0.200' (RSA) to the list of known hosts.
root@192.168.100.3's password:
Last login: Thu Jun 26 01:50:50 2014
[root@host-10.0.0.200 ~]#
# just logined
Matched Content