路由相关功能点:
模块 | 功能 | 描述 | 备注 |
---|---|---|---|
路由 | 创建路由 | 创建指定名称、指定外部网络的路由, | |
修改路由 |
修改路由名称 | ||
删除外部网络(清除网关) | |||
停用路由 | |||
添加/删除路由接口 | |||
添加静态路由 | |||
删除路由 | 删除路由 |
router-create Create a router for a given tenant. router-delete Delete a given router. router-gateway-clear Remove an external network gateway from a router. router-gateway-set Set the external network gateway for a router. router-interface-add Add an internal network interface to a router. router-interface-delete Remove an internal network interface from a router. router-list List routers that belong to a given tenant. router-list-on-l3-agent List the routers on a L3 agent. router-port-list List ports that belong to a given tenant, with specified router. router-show Show information of a given router. router-update Update router's information.
router-create子命令属性
参数
|
描述
|
---|---|
NAME | 创建路由的名称 |
--tenant-id | 指定路由的租户ID |
--admin-state-down | 设置路由管理接口状态 |
--description | 描述信息 |
--flavor | Neutron service flavor |
--distributed | 创建分布式路由 |
--ha | 创建高可用路由 |
--availability-zone-hint | 指定可用域 |
示例:创建一个路由
命令语法:neutron router-create < ROUTER_NAME > --tenant-id < 租户ID > --admin-state-up --description '描述信息.' --distributed < TRUE/FALSE是否创建分布式路由>
--ha < TRUE/FALSE是否创建高可用路由 > --availability-zone-hint < 选择可用域 >
[root@10-0-192-18 ~]# neutron router-create ltwtest --tenant-id 73c538f5e43c4ac98ee01482f371539c --admin-state-up --description 'test create.' --distributed True --ha False --availability-zone-hint nova Created a new router: +-------------------------+--------------------------------------+ | Field | Value | +-------------------------+--------------------------------------+ | admin_state_up | True | | availability_zone_hints | nova | | availability_zones | | | created_at | 2017-05-11T05:58:16Z | | description | test create. | | distributed | True | | external_gateway_info | | | flavor_id | | | ha | False | | id | ebabff61-010d-43fa-839d-13ae31afe0e1 | | name | ltwtest | | project_id | 73c538f5e43c4ac98ee01482f371539c | | revision_number | 3 | | routes | | | status | ACTIVE | | tenant_id | 73c538f5e43c4ac98ee01482f371539c | | updated_at | 2017-05-11T05:58:16Z | +-------------------------+--------------------------------------+
router-update子命令相关属性:
参数
|
描述
|
---|---|
ROUTER | 要更新的路由ID或者NAME |
--name | 更新路由的NAME |
--description | 描述信息 |
--admin-state-up | 更新路由管理接口的状态 |
--distributed | 分布式路由 |
--route destination=CIDR,nexthop=IP_ADDR | 添加静态路由 |
--no-routes | 移除静态路由 |
示例:修改路由名称
命令语法:neutron router-update < ROUTER_NAME/ID > --name < ROUTER_NAME > --description '描述信息.' --admin-state-up < 路由管理接口UP/DOWN > --distributed < 分布式路由TRUE/FALSE >
{--route < destination=CIDR,nexthop=IP_ADDR > or --no-routes 添加或移除静态路由 }
[root@10-0-192-18 ~]# neutron router-update --name testrouter --description 'update.' jjj Updated router: jjj
router-gateway-set子命令相关属性:
参数
|
描述
|
---|---|
ROUTER | ROUTER_ID/NAME |
EXTERNAL-NETWORK | EXTERNAL-NETWORK_ID/NAME |
--disable-snat | 禁用路由的源地址转换 |
--fixed-ip subnet_id=SUBNET,ip_address=IP_ADDR | 设置外部网络的IP或子网 |
示例:给路由设置外部网络,即网关
命令语法:neutron router-gateway-set < ROUTER_ID/NAME > < EXTERNAL-NETWORK_ID/NAME > --disable-snat --fixed-ip < subnet_id=xxxxxx,ip_address=xxx.xxx.xxx.xxx >
[root@10-0-192-18 ~]# neutron router-gateway-set ebabff61-010d-43fa-839d-13ae31afe0e1 c68a590d-4b7a-4c89-aa26-4e87ac65e6d5 --disable-snat --fixed-ip subnet_id=1f7f901d-0c86-45b7-bde9-d81b7b3c2290 Set gateway for router ebabff61-010d-43fa-839d-13ae31afe0e1
router-gateway-clear子命令相关属性:
参数
|
描述
|
---|---|
ROUTER | ROUTER_ID/NAME |
示例:删除路由外部网络网关
命令语法:neutron router-gateway-clear < ROUTER_ID/NAME >
[root@10-0-192-18 ~]# neutron router-gateway-clear ebabff61-010d-43fa-839d-13ae31afe0e1 Removed gateway from router ebabff61-010d-43fa-839d-13ae31afe0e1
router-interface-add子命令相关属性:
参数
|
描述
|
---|---|
ROUTER | ROUTER_ID/NAME |
INTERFACE | 指定subnet/port |
示例:添加一个路由接口
命令语法;neutron router-interface-add < ROUTER_ID/NAME > < subnet_ID | port >
[root@10-0-192-18 ~]# neutron router-interface-add ebabff61-010d-43fa-839d-13ae31afe0e1 b55e65d2-f9f2-4549-8c87-cfb3813fe2de Added interface f151e719-0936-46a5-9149-4c3773f5e104 to router ebabff61-010d-43fa-839d-13ae31afe0e1.
router-interface-delete子命令相关属性:
参数
|
描述
|
---|---|
ROUTER | ROUTER_ID/NAME |
INTERFACE | 指定subnet/port |
示例:删除一个路由接口
命令语法:neutron router-interface-delete < ROUTER_ID/NAME > { <subnet_ID> or < port= port_id> or < subnet_ID | port=port_id> }
[root@10-0-192-18 ~]# neutron router-interface-delete ebabff61-010d-43fa-839d-13ae31afe0e1 9dce6e23-310d-432c-9e56-6924e148cd3f ## <subnet_ID> Removed interface from router ebabff61-010d-43fa-839d-13ae31afe0e1. [root@10-0-192-18 ~]# neutron router-interface-delete ebabff61-010d-43fa-839d-13ae31afe0e1 port=9d9ce848-351d-4389-b0dd-963c0eabf433 ## < port= port_id> Removed interface from router ebabff61-010d-43fa-839d-13ae31afe0e1. [root@10-0-192-18 ~]# neutron router-interface-delete ebabff61-010d-43fa-839d-13ae31afe0e1 9dce6e23-310d-432c-9e56-6924e148cd3f|port=ffd8ece1-12ef-4df4-99c1-e191477ee896 ## < subnet_ID | port=port_id>
router-delete子命令相关属性:
参数
|
描述
|
---|---|
ROUTER | 要删除路由的ID(s) or name(s) |
示例:删除一个或多个路由(确保floatingIP已解绑,路由上的接口已全部删除)
命令语法:neutron router-delete < ROUTER_ID/NAME >
[root@10-0-192-18 ~]# neutron router-delete ebabff61-010d-43fa-839d-13ae31afe0e1 Deleted router(s): ebabff61-010d-43fa-839d-13ae31afe0e1