Ask Your Question

Revision history [back]

Create an internal network under a tenant network
(ostenant). Source the keystone user's credentials:

  $ . keystonerc_user

Create a router attached to the external network. This router routes
traffic to the internal subnets

  $ neutron router-create router1
  Created a new router:
  +-----------------------+--------------------------------------+
  | Field                 | Value                                |
  +-----------------------+--------------------------------------+
  | admin_state_up        | True                                 |
  | external_gateway_info |                                      |
  | id                    | d72adddf-4c02-4916-ae6d-16bfdaf59d99 |
  | name                  | router1                              |
  | status                | ACTIVE                               |
  | tenant_id             | 2c845a6ad20e45ccb0b045cee27a9661     |
  +-----------------------+--------------------------------------+

Connect the router to ext by setting the gateway for the router as ext

  $ neutron router-gateway-set router1 ext
  Set gateway for router router1

Create an internal network and its associated subnet

  $ neutron net-create int
  Created a new network:
  +----------------+--------------------------------------+
  | Field          | Value                                |
  +----------------+--------------------------------------+
  | admin_state_up | True                                 |
  | id             | 1a4157a6-5cf2-46e3-bdea-1533c8f54cdf |
  | name           | int                                  |
  | shared         | False                                |
  | status         | ACTIVE                               |
  | subnets        |                                      |
  | tenant_id      | 2c845a6ad20e45ccb0b045cee27a9661     |
  +----------------+--------------------------------------+

  $ neutron subnet-create int 30.0.0.0/24 --dns_nameservers list=true  8.8.8.8

  Created a new subnet:
  +------------------+--------------------------------------------+
  | Field            | Value                                      |
  +------------------+--------------------------------------------+
  | allocation_pools | {"start": "30.0.0.2", "end": "30.0.0.254"} |
  | cidr             | 30.0.0.0/24                                |
  | dns_nameservers  | 192.168.122.1                              |
  | enable_dhcp      | True                                       |
  | gateway_ip       | 30.0.0.1                                   |
  | host_routes      |                                            |
  | id               | 04b95f13-cc77-4f9a-8206-7f6ed183461d       |
  | ip_version       | 4                                          |
  | name             |                                            |
  | network_id       | 1a4157a6-5cf2-46e3-bdea-1533c8f54cdf       |
  | tenant_id        | 2c845a6ad20e45ccb0b045cee27a9661           |
  +------------------+--------------------------------------------+

Connect the above subnet to the router by setting it as a port

  $ neutron router-interface-add router1 \
  04b95f13-cc77-4f9a-8206-7f6ed183461d
  Added interface 63ea2815-b524-4a12-931d-3e7db60ea170 to router router1.


List subnets (as keystonerc_user)

  $ neutron subnet-list
  +--------------------------------------+------+-------------+--------------------------------------------+
  | id                                   | name | cidr        | allocation_pools                           |
  +--------------------------------------+------+-------------+--------------------------------------------+
  | 04b95f13-cc77-4f9a-8206-7f6ed183461d |      | 30.0.0.0/24 | {"start": "30.0.0.2", "end": "30.0.0.254"} |
  +--------------------------------------+------+-------------+--------------------------------------------+
Create an internal network under a tenant network
(ostenant). Source the keystone user's credentials:

  $ . keystonerc_user

Create a router attached to the external network. This router routes
traffic to the internal subnets

  $ neutron router-create router1
  Created a new router:
  +-----------------------+--------------------------------------+
  | Field                 | Value                                |
  +-----------------------+--------------------------------------+
  | admin_state_up        | True                                 |
  | external_gateway_info |                                      |
  | id                    | d72adddf-4c02-4916-ae6d-16bfdaf59d99 |
  | name                  | router1                              |
  | status                | ACTIVE                               |
  | tenant_id             | 2c845a6ad20e45ccb0b045cee27a9661     |
  +-----------------------+--------------------------------------+

Connect the router to ext by setting the gateway for the router as ext

  $ neutron router-gateway-set router1 ext
  Set gateway for router router1

Create an internal network and its associated subnet

  $ neutron net-create int
  Created a new network:
  +----------------+--------------------------------------+
  | Field          | Value                                |
  +----------------+--------------------------------------+
  | admin_state_up | True                                 |
  | id             | 1a4157a6-5cf2-46e3-bdea-1533c8f54cdf |
  | name           | int                                  |
  | shared         | False                                |
  | status         | ACTIVE                               |
  | subnets        |                                      |
  | tenant_id      | 2c845a6ad20e45ccb0b045cee27a9661     |
  +----------------+--------------------------------------+

  $ neutron subnet-create int 30.0.0.0/24 --dns_nameservers list=true  8.8.8.8

  Created a new subnet:
  +------------------+--------------------------------------------+
  | Field            | Value                                      |
  +------------------+--------------------------------------------+
  | allocation_pools | {"start": "30.0.0.2", "end": "30.0.0.254"} |
  | cidr             | 30.0.0.0/24                                |
  | dns_nameservers  | 192.168.122.1 8.8.8.8                              |
  | enable_dhcp      | True                                       |
  | gateway_ip       | 30.0.0.1                                   |
  | host_routes      |                                            |
  | id               | 04b95f13-cc77-4f9a-8206-7f6ed183461d       |
  | ip_version       | 4                                          |
  | name             |                                            |
  | network_id       | 1a4157a6-5cf2-46e3-bdea-1533c8f54cdf       |
  | tenant_id        | 2c845a6ad20e45ccb0b045cee27a9661           |
  +------------------+--------------------------------------------+

Connect the above subnet to the router by setting it as a port

  $ neutron router-interface-add router1 \
  04b95f13-cc77-4f9a-8206-7f6ed183461d
  Added interface 63ea2815-b524-4a12-931d-3e7db60ea170 to router router1.


List subnets (as keystonerc_user)

  $ neutron subnet-list
  +--------------------------------------+------+-------------+--------------------------------------------+
  | id                                   | name | cidr        | allocation_pools                           |
  +--------------------------------------+------+-------------+--------------------------------------------+
  | 04b95f13-cc77-4f9a-8206-7f6ed183461d |      | 30.0.0.0/24 | {"start": "30.0.0.2", "end": "30.0.0.254"} |
  +--------------------------------------+------+-------------+--------------------------------------------+