openstack路由管理命令
1、命令一览
[root@cc07 ~]# neutron help | grep route
bgp-speaker-advertiseroute-list List routes advertised by a given BGP speaker.
l3-agent-list-hosting-router List L3 agents hosting a router.
l3-agent-router-add Add a router to a L3 agent.
l3-agent-router-remove Remove a router from a L3 agent.
net-gateway-connect Add an internal network interface to a router.
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.
2、列表
[root@cc07 ~]# neutron router-list
+--------------------------------------+----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------+-------+
| id | name | external_gateway_info | distributed | ha |
+--------------------------------------+----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------+-------+
| 00fede5d-71cf-4c12-b694-88157a503fb5 | routerC | null | False | True |
| 2752b0c9--49ed-a044-2e960a38710a | test | null | False | False |
| 4fe00052--4ecf-bbd4-ddc28c3ed6da | routerA | null | False | True |
| 66d23d4a-472d-41e1-ba98-eee1551c40f1 | hzb-router | null | False | False |
| 6d61e9a4-76f3-4f33-90b3-21703d7fdfd9 | hzb-route-test | null | False | False |
| 75cc932a--49c3--11e50c719858 | wh-router2 | null | False | False |
| 9ef43a4b-1e96--9e14-529a90a9b87f | public_router | null | False | False |
| a7ed7a6f-efb1-4fc3-95c1-f3048230b2d5 | vpc-router | null | False | False |
| bca33800-1ddd-49dc-b6b6-313d72b97018 | wh-router | null | False | False |
| d90f3ea9-adc1-48fc-97fb-daa4a51194a8 | test123 | {"network_id": "519386bf-542a-4769-ac87-1b15ab96550c", "enable_snat": true, "external_fixed_ips": [{"subnet_id": "732a6431-e412-4db6-a5ec-bd9913699bab", "ip_address": "172.16.12.211"}]} | False | False |
| e8a2d0cb-e27e-46e1-8bef-c727d9da13bc | vpc-router | null | False | False |
| e8de4f0e-9a6e-41ba-ad5e-1fa0d215c865 | routerB | {"network_id": "519386bf-542a-4769-ac87-1b15ab96550c", "enable_snat": true, "external_fixed_ips": [{"subnet_id": "732a6431-e412-4db6-a5ec-bd9913699bab", "ip_address": "172.16.12.201"}]} | False | True |
| f9670288-6e74--a6f7-695ab8aab986 | wh-router | {"network_id": "519386bf-542a-4769-ac87-1b15ab96550c", "enable_snat": true, "external_fixed_ips": [{"subnet_id": "732a6431-e412-4db6-a5ec-bd9913699bab", "ip_address": "172.16.12.207"}]} | False | False |
+--------------------------------------+----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------+-------+
3、创建路由(可以指定tenant-id)
[root@cc07 ~]# neutron router-create hzb-route-test --tenant-id 26a8e1feb372493d831c19d4d9e28d73
Created a new router:
+-------------------------+--------------------------------------+
| Field | Value |
+-------------------------+--------------------------------------+
| admin_state_up | True |
| availability_zone_hints | |
| availability_zones | |
| description | |
| distributed | False |
| external_gateway_info | |
| ha | False |
| id | 6d61e9a4-76f3-4f33-90b3-21703d7fdfd9 |
| name | hzb-route-test |
| routes | |
| rx | - |
| status | ACTIVE |
| tenant_id | 26a8e1feb372493d831c19d4d9e28d73 |
| tx | - |
+-------------------------+--------------------------------------+
4、将路由连接到外部网络(hzb-pub1),设定外部网络网关
[root@cc07 ~]# neutron net-list --tenant-id 26a8e1feb372493d831c19d4d9e28d73
+--------------------------------------+--------------+---------------------------------------------------+
| id | name | subnets |
+--------------------------------------+--------------+---------------------------------------------------+
| 0575cad8-38b0-4d0a-833c-86779f4f43bb | hzb-pub1 | |
| 2193270e-c4c9-469c-99ae-87ebdb4ba535 | hzb-privnet1 | 0ba19972-c2f6-4cbb-80f6-a642a2f698a8 10.30.0.0/ |
+--------------------------------------+--------------+---------------------------------------------------+
[root@cc07 ~]# neutron router-gateway-set 6d61e9a4-76f3-4f33-90b3-21703d7fdfd9 0575cad8-38b0-4d0a-833c-86779f4f43bb
Set gateway for router 6d61e9a4-76f3-4f33-90b3-21703d7fdfd9
[root@cc07 ~]# neutron router-show 6d61e9a4-76f3-4f33-90b3-21703d7fdfd9
+-------------------------+-------------------------------------------------------------------------------------------------------+
| Field | Value |
+-------------------------+-------------------------------------------------------------------------------------------------------+
| admin_state_up | True |
| availability_zone_hints | |
| availability_zones | nova |
| description | |
| distributed | False |
| external_gateway_info | {"network_id": "0575cad8-38b0-4d0a-833c-86779f4f43bb", "enable_snat": true, "external_fixed_ips": []} |
| ha | False |
| id | 6d61e9a4-76f3-4f33-90b3-21703d7fdfd9 |
| name | hzb-route-test |
| routes | |
| rx | - |
| status | ACTIVE |
| tenant_id | 26a8e1feb372493d831c19d4d9e28d73 |
| tx | - |
+-------------------------+-------------------------------------------------------------------------------------------------------+
5、创建内部网络路由接口(绑定子网hzb-sub-net1)
[root@cc07 ~]# neutron subnet-list --network-id=2193270e-c4c9-469c-99ae-87ebdb4ba535
+--------------------------------------+--------------+--------------+----------------------------------------------+
| id | name | cidr | allocation_pools |
+--------------------------------------+--------------+--------------+----------------------------------------------+
| 0ba19972-c2f6-4cbb-80f6-a642a2f698a8 | hzb-sub-net1 | 10.30.0.0/ | {"start": "10.30.0.60", "end": "10.30.0.90"} |
+--------------------------------------+--------------+--------------+----------------------------------------------+
[root@cc07 ~]# neutron router-interface-add 6d61e9a4-76f3-4f33-90b3-21703d7fdfd9 0ba19972-c2f6-4cbb-80f6-a642a2f698a8
Bad router request: Subnet for router interface must have a gateway IP.
Neutron server returns request_ids: ['req-95b281ad-fe74-41f9-bc5a-0ce8d7064589']
[root@cc07 ~]#
[root@cc07 ~]#
[root@cc07 ~]# neutron subnet-show 0ba19972-c2f6-4cbb-80f6-a642a2f698a8
+-------------------+----------------------------------------------+
| Field | Value |
+-------------------+----------------------------------------------+
| allocation_pools | {"start": "10.30.0.60", "end": "10.30.0.90"} |
| cidr | 10.30.0.0/ |
| created_at | --25T06:: |
| description | |
| dns_nameservers | 8.8.8.8 |
| enable_dhcp | True |
| gateway_ip | |
| host_routes | |
| id | 0ba19972-c2f6-4cbb-80f6-a642a2f698a8 |
| ip_version | |
| ipv6_address_mode | |
| ipv6_ra_mode | |
| name | hzb-sub-net1 |
| network_id | 2193270e-c4c9-469c-99ae-87ebdb4ba535 |
| subnetpool_id | |
| tenant_id | ff2958aa964541679833ddbcc503c5d2 |
| updated_at | --25T06:: |
+-------------------+----------------------------------------------+
出现以上红色字体的错误,是因为子网没有gateway_ip,我们给设置一个
neutron subnet-update 0ba19972-c2f6-4cbb-80f6-a642a2f698a8 --gateway-ip 10.30.0.1
[root@cc07 ~]# neutron router-interface-add 6d61e9a4-76f3-4f33-90b3-21703d7fdfd9 0ba19972-c2f6-4cbb-80f6-a642a2f698a8
Added interface e5add0f4-f3c0-41e0-804a-9f4f63f6eb5e to router 6d61e9a4-76f3-4f33-90b3-21703d7fdfd9.
[root@cc07 ~]#
[root@cc07 ~]#
[root@cc07 ~]# neutron router-show 6d61e9a4-76f3-4f33-90b3-21703d7fdfd9
+-------------------------+-------------------------------------------------------------------------------------------------------+
| Field | Value |
+-------------------------+-------------------------------------------------------------------------------------------------------+
| admin_state_up | True |
| availability_zone_hints | |
| availability_zones | nova |
| description | |
| distributed | False |
| external_gateway_info | {"network_id": "0575cad8-38b0-4d0a-833c-86779f4f43bb", "enable_snat": true, "external_fixed_ips": []} |
| ha | False |
| id | 6d61e9a4-76f3-4f33-90b3-21703d7fdfd9 |
| name | hzb-route-test |
| routes | |
| rx | - |
| status | ACTIVE |
| tenant_id | 26a8e1feb372493d831c19d4d9e28d73 |
| tx | - |
+-------------------------+-------------------------------------------------------------------------------------------------------+
6、移除路由接口
[root@cc07 ~]# neutron router-interface-delete 6d61e9a4-76f3-4f33-90b3-21703d7fdfd9 0ba19972-c2f6-4cbb-80f6-a642a2f698a8
Removed interface from router 6d61e9a4-76f3-4f33-90b3-21703d7fdfd9.
7、移除路由的默认网关
移除前:
[root@cc07 ~]# neutron router-show 6d61e9a4-76f3-4f33-90b3-21703d7fdfd9
+-------------------------+-------------------------------------------------------------------------------------------------------+
| Field | Value |
+-------------------------+-------------------------------------------------------------------------------------------------------+
| admin_state_up | True |
| availability_zone_hints | |
| availability_zones | nova |
| description | |
| distributed | False |
| external_gateway_info | {"network_id": "0575cad8-38b0-4d0a-833c-86779f4f43bb", "enable_snat": true, "external_fixed_ips": []} |
| ha | False |
| id | 6d61e9a4-76f3-4f33-90b3-21703d7fdfd9 |
| name | hzb-route-test |
| routes | |
| rx | - |
| status | ACTIVE |
| tenant_id | 26a8e1feb372493d831c19d4d9e28d73 |
| tx | - |
+-------------------------+-------------------------------------------------------------------------------------------------------+
[root@cc07 ~]# neutron router-gateway-clear 6d61e9a4-76f3-4f33-90b3-21703d7fdfd9
Removed gateway from router 6d61e9a4-76f3-4f33-90b3-21703d7fdfd9
移除后:
[root@cc07 ~]# neutron router-show 6d61e9a4-76f3-4f33-90b3-21703d7fdfd9
+-------------------------+--------------------------------------+
| Field | Value |
+-------------------------+--------------------------------------+
| admin_state_up | True |
| availability_zone_hints | |
| availability_zones | nova |
| description | |
| distributed | False |
| external_gateway_info | |
| ha | False |
| id | 6d61e9a4-76f3-4f33-90b3-21703d7fdfd9 |
| name | hzb-route-test |
| routes | |
| rx | - |
| status | ACTIVE |
| tenant_id | 26a8e1feb372493d831c19d4d9e28d73 |
| tx | - |
+-------------------------+--------------------------------------+
8、删除路由
neutron router-delete 6d61e9a4-76f3-4f33-90b3-21703d7fdfd9
openstack路由管理命令的更多相关文章
- OpenStack云计算快速入门之三:OpenStack镜像管理
原文:http://blog.chinaunix.net/uid-22414998-id-3272059.html 第三部分 OpenStack镜像管理 一.简介 很多源都有为OpenStack已经编 ...
- OpenStack镜像管理3
第三部分 OpenStack镜像管理 一.简介 很多源都有为OpenStack已经编译好的各种镜像了,您可以直接下载并通过使用这些镜像来熟悉OpenStack. 不过如果是为生产环境进行部署的话,您一 ...
- openstack操作之一 命令行
在openstack环境中提供了多种操作虚拟机的方法,有最简单直接的dashborad界面,有不直观但高效的命令行,还有进阶版的postman调用openstack restfulapi和命令行中使用 ...
- Linux就业技术指导(五):Linux运维核心管理命令详解
一,Linux核心进程管理命令 1.1 ps:查看进程 1.1.1 命令解释 功能说明 ps命令用于列出执行ps命令的那个时刻的进程快照,就像用手机给进程照了一张照片.如果想要动态地显示进程,就需要使 ...
- UNIX 系统常用管理命令
一. 引言 UNIX系统作为一种强大的多用户分时操作系统,在越来越多的场合受到了应用,同时,对UNIX的系统管理的要求也随之越来越多,但目前的书籍对UNIX系统管理命令介绍的并不是很多.本文主要是针对 ...
- 云计算:Linux运维核心管理命令详解
云计算:Linux运维核心管理命令详解 想做好运维工作,人先要学会勤快: 居安而思危,勤记而补拙,方可不断提高: 别人资料不论你用着再如何爽那也是别人的: 自己总结东西是你自身特有的一种思想与理念的展 ...
- Linux 系统常用管理命令(精简笔记)
Linux是一套免费使用和自由传播的类Unix操作系统,下面的笔记是我从鸟菜中摘抄出来的重要命令,并进行了一定的排版,摒弃了一些用不到的乱七八糟的命令,目的是在生产环境中能够快速的定位并查询需要命令的 ...
- vue(17)vue-route路由管理的安装与配置
介绍 Vue Router 是 Vue.js官方的路由管理器.它和 Vue.js 的核心深度集成,让构建单页面应用变得易如反掌.包含的功能有: 嵌套的路由/视图表 模块化的.基于组件的路由配置 路由参 ...
- (转)CentOS下开机启动查看管理命令:chkconfig用法
CentOS下开机启动查看管理命令:chkconfig用法 CentOS下开机启动查看管理的命令是:chkconfig 1. 开机启动列表查看: chkconfig --list 说明 ...
随机推荐
- leetcode 443. String Compression
下面反向遍历,还是正向好. void left(vector<char>& v, bool p(int)) { ; ; ; while (del < max_index) { ...
- Delphi: Class Static Methods
在Delphi中,自Delphi 2007之后,支持static形式的class方法,样式比如: type TMyClass = class strict private class var FX: ...
- Springboot学习02-webjars和静态资源映射规则
Springboot学习01-webjars和静态资源映射规则 前言 1-以前我们在IDEA中创建一个项目,添加web依赖包,我们现在是一个web应用,应该在man目录下面有一个webapp文件夹,将 ...
- bbs项目中的零碎点记录
一.切换django的语言 在settings中修改django默认的语言 # LANGUAGE_CODE = 'en-us' # 切换django的语言,默认是英语的,我们把他修改为中文 LANGU ...
- EasyUI Dialog 对话框默认不弹出和关闭清空对话框内容
EasyUI中文网: http://www.jeasyui.net/plugins/181.html 默认不弹出:closed:true 模式化窗口(有遮罩):modal:true <div c ...
- Java_1简介
1.Java版本 JavaSE 基础标准版 J2ME 小型版 JavaEE 企业版(主要针对Javaweb程序进行开发) 2.Java特点 开源跨平台 跨平台的原因:Java必须先只能装 ...
- 微信小程序基础架构
一个微信小程序界面由一个页面描述文件,一个页面逻辑文件,一个样式表文件来进行描述 在主目录中的三个以app开头的文件就是微信小程序的主描述文件 app.js :主逻辑文件,用来注册小程序 app.js ...
- 微信小程序解密
获取OpenId和SessionKey private string GetOpenIdAndSessionKeyString(string code) { string wxUrl = " ...
- Http方式下载文件
代码: using System; using System.Collections.Generic; using System.IO; using System.Linq; using System ...
- webstorm 打包angular Module build failed: Error: No PostCSS Config found
angular创建项目后,在webstorm中启动时,报出如题错误,奇怪的是我从命令行启动(ng server)是没有问题的,多方寻求无果,在网上看到过说要加一个配置文件,我不信.我觉得是我配置哪里有 ...