OpenStack: Configure OpenStack Networking

From Define Wiki
Jump to navigation Jump to search
[root@server2-a ~]# source /root/keystonerc_myuser 
[root@server2-a ~(keystone_myuser)]$ neutron router-create router1
Created a new router:
+-----------------------+--------------------------------------+
| Field                 | Value                                |
+-----------------------+--------------------------------------+
| admin_state_up        | True                                 |
| external_gateway_info |                                      |
| id                    | 0087300b-9b72-4034-b11c-dcdf30545f91 |
| name                  | router1                              |
| status                | ACTIVE                               |
| tenant_id             | 02f8b026fc754acea4466e5c1e28eecc     |
+-----------------------+--------------------------------------+
[root@server2-a ~(keystone_myuser)]$ neutron net-create private
Created a new network:
+----------------+--------------------------------------+
| Field          | Value                                |
+----------------+--------------------------------------+
| admin_state_up | True                                 |
| id             | 6077b8ec-6564-49d4-a476-181b2b916ba9 |
| name           | private                              |
| shared         | False                                |
| status         | ACTIVE                               |
| subnets        |                                      |
| tenant_id      | 02f8b026fc754acea4466e5c1e28eecc     |
+----------------+--------------------------------------+
[root@server2-a ~(keystone_myuser)]$ neutron subnet-create --name subpriv private 172.25.102.0/24 --gateway 172.25.102.25 --allocation-pool start=172.25.102.26,end=172.25.102.99
Created a new subnet:
+------------------+----------------------------------------------------+
| Field            | Value                                              |
+------------------+----------------------------------------------------+
| allocation_pools | {"start": "172.25.102.26", "end": "172.25.102.99"} |
| cidr             | 172.25.102.0/24                                    |
| dns_nameservers  |                                                    |
| enable_dhcp      | True                                               |
| gateway_ip       | 172.25.102.25                                      |
| host_routes      |                                                    |
| id               | 0ef72eb6-cd4c-4b09-ad60-9a94051b027c               |
| ip_version       | 4                                                  |
| name             | subpriv                                            |
| network_id       | 6077b8ec-6564-49d4-a476-181b2b916ba9               |
| tenant_id        | 02f8b026fc754acea4466e5c1e28eecc                   |
+------------------+----------------------------------------------------+
[root@server2-a ~(keystone_myuser)]$ neutron router-interface-add router1 subpriv
Added interface ae966ab8-5fc8-4d02-b9a9-1e01079cd3db to router router1.
[root@server2-a ~(keystone_myuser)]$ neutron port-list 
+--------------------------------------+------+-------------------+--------------------------------------------------------------------------------------+
| id                                   | name | mac_address       | fixed_ips                                                                            |
+--------------------------------------+------+-------------------+--------------------------------------------------------------------------------------+
| ae966ab8-5fc8-4d02-b9a9-1e01079cd3db |      | fa:16:3e:11:df:c3 | {"subnet_id": "0ef72eb6-cd4c-4b09-ad60-9a94051b027c", "ip_address": "172.25.102.25"} |
+--------------------------------------+------+-------------------+--------------------------------------------------------------------------------------+
[root@server2-a ~(keystone_myuser)]$ source /root/keystonerc_admin 
[root@server2-a ~(keystone_admin)]$ neutron net-create --tenant-id services public --router:external=True
Created a new network:
+---------------------------+--------------------------------------+
| Field                     | Value                                |
+---------------------------+--------------------------------------+
| admin_state_up            | True                                 |
| id                        | d7e212ee-f91d-4e84-a802-252833c80940 |
| name                      | public                               |
| provider:network_type     | vlan                                 |
| provider:physical_network | physnet1                             |
| provider:segmentation_id  | 1001                                 |
| router:external           | True                                 |
| shared                    | False                                |
| status                    | ACTIVE                               |
| subnets                   |                                      |
| tenant_id                 | services                             |
+---------------------------+--------------------------------------+
[root@server2-a ~(keystone_admin)]$ neutron subnet-create --tenant-id services --allocation-pool start=172.25.2.25,end=172.25.2.99 --gateway 172.25.2.254 --disable-dhcp --name subpub public 172.25.2.0/24
Created a new subnet:
+------------------+------------------------------------------------+
| Field            | Value                                          |
+------------------+------------------------------------------------+
| allocation_pools | {"start": "172.25.2.25", "end": "172.25.2.99"} |
| cidr             | 172.25.2.0/24                                  |
| dns_nameservers  |                                                |
| enable_dhcp      | False                                          |
| gateway_ip       | 172.25.2.254                                   |
| host_routes      |                                                |
| id               | 028495a2-e735-4999-8752-687383ed855f           |
| ip_version       | 4                                              |
| name             | subpub                                         |
| network_id       | d7e212ee-f91d-4e84-a802-252833c80940           |
| tenant_id        | services                                       |
+------------------+------------------------------------------------+
[root@server2-a ~(keystone_admin)]$ neutron router-gateway-set router1 public
Set gateway for router router1
[root@server2-a ~(keystone_admin)]$ neutron port-list 
+--------------------------------------+------+-------------------+--------------------------------------------------------------------------------------+
| id                                   | name | mac_address       | fixed_ips                                                                            |
+--------------------------------------+------+-------------------+--------------------------------------------------------------------------------------+
| 6555d6b3-6c6c-4276-b821-18ddbfd7056b |      | fa:16:3e:e5:85:a7 | {"subnet_id": "028495a2-e735-4999-8752-687383ed855f", "ip_address": "172.25.2.25"}   |
| ae966ab8-5fc8-4d02-b9a9-1e01079cd3db |      | fa:16:3e:11:df:c3 | {"subnet_id": "0ef72eb6-cd4c-4b09-ad60-9a94051b027c", "ip_address": "172.25.102.25"} |
+--------------------------------------+------+-------------------+--------------------------------------------------------------------------------------+
[root@server2-a ~(keystone_admin)]$ source /root/keystonerc_myuser 
[root@server2-a ~(keystone_myuser)]$ neutron floatingip-create public
Created a new floatingip:
+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| fixed_ip_address    |                                      |
| floating_ip_address | 172.25.2.26                          |
| floating_network_id | d7e212ee-f91d-4e84-a802-252833c80940 |
| id                  | 787c484c-1497-4b6d-a0ac-617d5cce4e06 |
| port_id             |                                      |
| router_id           |                                      |
| status              | DOWN                                 |
| tenant_id           | 02f8b026fc754acea4466e5c1e28eecc     |
+---------------------+--------------------------------------+
[root@server2-a ~(keystone_myuser)]$ neutron floatingip-list 
+--------------------------------------+------------------+---------------------+---------+
| id                                   | fixed_ip_address | floating_ip_address | port_id |
+--------------------------------------+------------------+---------------------+---------+
| 787c484c-1497-4b6d-a0ac-617d5cce4e06 |                  | 172.25.2.26         |         |
+--------------------------------------+------------------+---------------------+---------+