本帖最后由 hyj 于 2014-12-2 16:40 编辑
问题导读
1.如何绑定路由到外网?
2.如何绑定路由到子网?
扩展
3.租户 网络 子网 路由他们之间是如何关联的?
本文是是openstack租户网络设置,这个也是比较复杂和难以理解的,操作不复杂,就是写shell,关键是能理解操作的含义
1.创建租户
- keystone tenant-create --name test_tenant
- +-------------+----------------------------------+
- | Property | Value |
- +-------------+----------------------------------+
- | description | |
- | enabled | True |
- | id | 6cfa815662fb401789dc7dc75b5ba1e8 |
- | name | test_tenant |
- +-------------+----------------------------------+
复制代码
2.使新的租户被admin可见
- keystone user-list
- +----------------------------------+---------+---------+-------+
- | id | name | enabled | email |
- +----------------------------------+---------+---------+-------+
- | 38436513c8f0441780c75fcc198710b0 | admin | True | |
- | ff89ee3e0cad48269367782c52c2cc2b | cinder | True | |
- | 87046c5379304082974a2f98309a3dba | ec2 | True | |
- | d596c959fe1e4a229708e567a7adb70d | glance | True | |
- | f9292edbe5434737a2293dd5f8dd9e27 | nova | True | |
- | 4ded12f274634eb0a06564d9b0967f86 | quantum | True | |
- | e1300cc43e4c4d7cacef112cd5269375 | swift | True | |
- +----------------------------------+---------+---------+-------+
- keystone role-list
- +----------------------------------+----------+
- | id | name |
- +----------------------------------+----------+
- | 100d061b5298490b843cc10d5dd80ba5 | Member |
- | 9fe2ff9ee4384b1894a90878d3e92bab | _member_ |
- | 7a1d979082b84aeaa39b20fe95b77648 | admin |
- +----------------------------------+----------+
- keystone user-role-add --tenant_id 6cfa815662fb401789dc7dc75b5ba1e8 --user-id 38436513c8f0441780c75fcc198710b0 --role-id 7a1d979082b84aeaa39b20fe95b77648
复制代码
3.创建network
- quantum net-create --tenant-id 6cfa815662fb401789dc7dc75b5ba1e8 net_test_tenant
- Created a new network:
- +---------------------------+--------------------------------------+
- | Field | Value |
- +---------------------------+--------------------------------------+
- | admin_state_up | True |
- | id | 1385ae9c-b29d-4e22-9669-8fd5c794821d |
- | name | net_test_tenant |
- | provider:network_type | gre |
- | provider:physical_network | |
- | provider:segmentation_id | 5 |
- | router:external | False |
- | shared | False |
- | status | ACTIVE |
- | subnets | |
- | tenant_id | 6cfa815662fb401789dc7dc75b5ba1e8 |
- +---------------------------+--------------------------------------+
复制代码
4.创建subnet
- quantum subnet-create --tenant-id 6cfa815662fb401789dc7dc75b5ba1e8 net_test_tenant --name sub_net_test_tenant 172.0.0.0/24
- Created a new subnet:
- +------------------+----------------------------------------------+
- | Field | Value |
- +------------------+----------------------------------------------+
- | allocation_pools | {"start": "172.0.0.2", "end": "172.0.0.254"} |
- | cidr | 172.0.0.0/24 |
- | dns_nameservers | |
- | enable_dhcp | True |
- | gateway_ip | 172.0.0.1 |
- | host_routes | |
- | id | f7d59dec-44ac-4454-a1b4-bf88e1f6680a |
- | ip_version | 4 |
- | name | sub_net_test_tenant |
- | network_id | 1385ae9c-b29d-4e22-9669-8fd5c794821d |
- | tenant_id | 6cfa815662fb401789dc7dc75b5ba1e8 |
- +------------------+----------------------------------------------+
复制代码
5.创建路由
- quantum router-create --tenant-id 6cfa815662fb401789dc7dc75b5ba1e8 test_router
- Created a new router:
- +-----------------------+--------------------------------------+
- | Field | Value |
- +-----------------------+--------------------------------------+
- | admin_state_up | True |
- | external_gateway_info | |
- | id | ede346db-c8c6-429e-8726-eaccf7fd62d4 |
- | name | test_router |
- | status | ACTIVE |
- | tenant_id | 6cfa815662fb401789dc7dc75b5ba1e8 |
- +-----------------------+--------------------------------------+
复制代码
6.绑定路由到外网
- quantum router-gateway-set ede346db-c8c6-429e-8726-eaccf7fd62d4 ext_net
- Set gateway for router ede346db-c8c6-429e-8726-eaccf7fd62d4
复制代码
7.绑定路由到子网
- quantum router-interface-add ede346db-c8c6-429e-8726-eaccf7fd62d4 f7d59dec-44ac-4454-a1b4-bf88e1f6680a
- Added interface to router ede346db-c8c6-429e-8726-eaccf7fd62d4
复制代码
需要注意的是,这些配置在删除时必须从后往前删,不然的话删除起来很麻烦!
有关界面操作参考
openstack部署开发高可用手册、通过devstack自动部署Openstack icehouse 版本
本文链接地址: http://www.ineeke.com/archives/1496/
|