CentOS 6
Sponsored Link

OpenStack Havana - Neutron Network Example#22013/10/29

 
Configure virtual networking with OpenStack Network Service (Neutron).
For an example, configure simple flat networking on here.
Configure basic settings first on Controle Node, Network Node, Compute Node first.
Furthermore, it needs that Network Node has 3 network interfaces and Control Node and Conpute Node have 2 network interfaces for this example.
[1] Configure on Control Node.
[root@dlp ~(keystone)]#
vi /etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini
# add at the last

[OVS]
tenant_network_type = vlan
network_vlan_ranges = physnet1:1:4094
bridge_mappings = physnet1:br-eth1
[root@dlp ~(keystone)]#
/etc/rc.d/init.d/neutron-server restart

Stopping neutron:                                          [  OK  ]
Starting neutron:                                          [  OK  ]
[2] Configure Network Node and Compute Node. ( Set on both Node like follows )
[root@network ~(neutron)]#
ovs-vsctl add-br br-eth1
# add bridge

[root@network ~(neutron)]#
ovs-vsctl add-port br-eth1 eth1
# add eth1 in bridge above

[root@network ~(neutron)]#
vi /etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini
# add at the last

[OVS]
tenant_network_type = vlan
network_vlan_ranges = physnet1:1:4094
bridge_mappings = physnet1:br-eth1
[root@network ~(neutron)]#
/etc/rc.d/init.d/neutron-openvswitch-agent restart

Stopping neutron-openvswitch-agent:                        [  OK  ]
Starting neutron-openvswitch-agent:                        [  OK  ]
[3] Create and define a bridge for external connection on Network Node.
[root@network ~(neutron)]#
ovs-vsctl add-br br-ext

[root@network ~(neutron)]#
ovs-vsctl add-port br-ext eth2

[root@network ~(neutron)]#
vi /etc/neutron/l3_agent.ini
# line 46: uncomment and change

external_network_bridge =
br-ext
[root@network ~(neutron)]#
/etc/rc.d/init.d/neutron-l3-agent restart

Stopping neutron-l3-agent: [  OK  ]
Starting neutron-l3-agent: [  OK  ]
[4] Create a virtual router. It's OK to work on any Node. ( this example works on Compute Node )
[root@node01 ~(keystone)]#
neutron router-create router01

Created a new router:
+-----------------------+--------------------------------------+
| Field                 | Value                                |
+-----------------------+--------------------------------------+
| admin_state_up        | True                                 |
| external_gateway_info |                                      |
| id                    | a9c4dea2-0b70-4d09-a676-5fcaae138c08 |
| name                  | router01                             |
| status                | ACTIVE                               |
| tenant_id             | 97be94660c2043e58fee407bc9cde0d5     |
+-----------------------+--------------------------------------+

[root@node01 ~(keystone)]#
Router_ID=`neutron router-list | grep router01 | awk '{ print $2 }'`

[5] Create an internal network.
[root@node01 ~(keystone)]#
neutron net-create int_net

Created a new network:
+---------------------------+--------------------------------------+
| Field                     | Value                                |
+---------------------------+--------------------------------------+
| admin_state_up            | True                                 |
| id                        | 8b1defd0-ba76-477e-8756-3694420b9343 |
| name                      | int_net                              |
| provider:network_type     | vlan                                 |
| provider:physical_network | physnet1                             |
| provider:segmentation_id  | 1                                    |
| shared                    | False                                |
| status                    | ACTIVE                               |
| subnets                   |                                      |
| tenant_id                 | 97be94660c2043e58fee407bc9cde0d5     |
+---------------------------+--------------------------------------+

[root@node01 ~(keystone)]#
neutron subnet-create int_net 192.168.100.0/24

Created a new subnet:
+------------------+------------------------------------------------------+
| Field            | Value                                                |
+------------------+------------------------------------------------------+
| allocation_pools | {"start": "192.168.100.2", "end": "192.168.100.254"} |
| cidr             | 192.168.100.0/24                                     |
| dns_nameservers  |                                                      |
| enable_dhcp      | True                                                 |
| gateway_ip       | 192.168.100.1                                        |
| host_routes      |                                                      |
| id               | 499ddb13-aa9a-41c7-8d2d-9fa85a0f3bb2                 |
| ip_version       | 4                                                    |
| name             |                                                      |
| network_id       | 8b1defd0-ba76-477e-8756-3694420b9343                 |
| tenant_id        | 97be94660c2043e58fee407bc9cde0d5                     |
+------------------+------------------------------------------------------+

[root@node01 ~(keystone)]#
Int_Subnet_ID=`neutron net-list | grep int_net | awk '{ print $6 }'`
# set the network to the virtual router

[root@node01 ~(keystone)]#
neutron router-interface-add $Router_ID $Int_Subnet_ID

Added interface 5a789a4e-2a06-4d42-97f9-2ff97bc18605 to router a9c4dea2-0b70-4d09-a676-5fcaae138c08.
[6] Create an external network.
[root@node01 ~(keystone)]#
neutron net-create ext_net --router:external=True

Created a new network:
+---------------------------+--------------------------------------+
| Field                     | Value                                |
+---------------------------+--------------------------------------+
| admin_state_up            | True                                 |
| id                        | ee3890df-c382-46e5-aba4-15655d892aff |
| name                      | ext_net                              |
| provider:network_type     | vlan                                 |
| provider:physical_network | physnet1                             |
| provider:segmentation_id  | 2                                    |
| router:external           | True                                 |
| shared                    | False                                |
| status                    | ACTIVE                               |
| subnets                   |                                      |
| tenant_id                 | 97be94660c2043e58fee407bc9cde0d5     |
+---------------------------+--------------------------------------+

[root@node01 ~(keystone)]#
neutron subnet-create ext_net --allocation-pool start=10.0.0.200,end=10.0.0.254 --gateway 10.0.0.1 10.0.0.0/24 --disable-dhcp

Created a new subnet:
+------------------+----------------------------------------------+
| Field            | Value                                        |
+------------------+----------------------------------------------+
| allocation_pools | {"start": "10.0.0.200", "end": "10.0.0.254"} |
| cidr             | 10.0.0.0/24                                  |
| dns_nameservers  |                                              |
| enable_dhcp      | False                                        |
| gateway_ip       | 10.0.0.1                                     |
| host_routes      |                                              |
| id               | 264f4d43-67f1-46f8-9828-11f49cc9cec9         |
| ip_version       | 4                                            |
| name             |                                              |
| network_id       | ee3890df-c382-46e5-aba4-15655d892aff         |
| tenant_id        | 97be94660c2043e58fee407bc9cde0d5             |
+------------------+----------------------------------------------+

[root@node01 ~(keystone)]#
Ext_Net_ID=`neutron net-list | grep ext_net | awk '{ print $2 }'`

# set the gatway to the virtual router

[root@node01 ~(keystone)]#
neutron router-gateway-set $Router_ID $Ext_Net_ID

Set gateway for router a9c4dea2-0b70-4d09-a676-5fcaae138c08
[7] Assign internal network just created to an Instance and boot it.
[root@node01 ~(keystone)]#
Int_Net_ID=`neutron net-list | grep int_net | awk '{ print $2 }'`

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

+--------------------------------------+---------+--------+--------+
| ID                                   | Name    | Status | Server |
+--------------------------------------+---------+--------+--------+
| 46042f47-c307-4fce-af0d-a1b2c14d6d78 | CentOS6 | ACTIVE |        |
+--------------------------------------+---------+--------+--------+

[root@node01 ~(keystone)]#
nova boot --flavor 2 --image CentOS6 --security_group default --nic net-id=$Int_Net_ID CentOS_64
[8] Assign froating IP to the Instance. Then it's possible to login to the Instance.
[root@node01 ~(keystone)]#
neutron floatingip-create ext_net

Created a new floatingip:
+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| fixed_ip_address    |                                      |
| floating_ip_address | 10.0.0.201                           |
| floating_network_id | ee3890df-c382-46e5-aba4-15655d892aff |
| id                  | ab2f609b-2f6d-488f-8ddd-eec04db22644 |
| port_id             |                                      |
| router_id           |                                      |
| tenant_id           | 97be94660c2043e58fee407bc9cde0d5     |
+---------------------+--------------------------------------+

[root@node01 ~(keystone)]#
Device_ID=`nova list | grep CentOS_64 | awk '{ print $2 }'`

[root@node01 ~(keystone)]#
Port_ID=`neutron port-list -- --device_id $Device_ID | grep 192.168.100.2 | awk '{ print $2 }'`

[root@node01 ~(keystone)]#
Floating_ID=`neutron floatingip-list | grep 10.0.0.201 | awk '{ print $2 }'`

[root@node01 ~(keystone)]#
neutron floatingip-associate $Floating_ID $Port_ID

Associated floatingip ab2f609b-2f6d-488f-8ddd-eec04db22644
[root@node01 ~(keystone)]#
neutron floatingip-show $Floating_ID

+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| fixed_ip_address    | 192.168.100.2                        |
| floating_ip_address | 10.0.0.201                           |
| floating_network_id | ee3890df-c382-46e5-aba4-15655d892aff |
| id                  | ab2f609b-2f6d-488f-8ddd-eec04db22644 |
| port_id             | 51d13c42-34ca-42dc-9d6b-feff28197929 |
| router_id           | a9c4dea2-0b70-4d09-a676-5fcaae138c08 |
| tenant_id           | 97be94660c2043e58fee407bc9cde0d5     |
+---------------------+--------------------------------------+

# login to instance

[root@node01 ~(keystone)]#
ssh 10.0.0.201

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

Warning: Permanently added '10.0.0.201' (RSA) to the list of known hosts.
root@10.0.0.201's password:
Last login: Wed Oct 23 04:40:30 2013
[root@host-192-168-100-2 ~]#
# just logined

Matched Content