OpenStack删除路由和网络的命令操作实例

42 篇文章 1 订阅

1.列出所有路由设备

# neutron router-list

neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
+--------------------------------------+------------+----------------------------------+-----------------------+-------------+-------+
| id                                   | name       | tenant_id                        | external_gateway_info | distributed | ha    |
+--------------------------------------+------------+----------------------------------+-----------------------+-------------+-------+
| 9ce1f2d5-5a81-4052-b4d8-18f3d7c69d1b | ts-router | 935ed74e0ad847dca043e95acf82f4ff | null                  | False       | False |
+--------------------------------------+------------+----------------------------------+-----------------------+-------------+-------+

2.根据路由器id,删除其网关端口

# neutron router-gateway-clear <router_id>

root@controller:~# neutron router-gateway-clear 9ce1f2d5-5a81-4052-b4d8-18f3d7c69d1b
neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
Removed gateway from router 9ce1f2d5-5a81-4052-b4d8-18f3d7c69d1b
root@controller:~# 

3.根据路由id,列出其其他端口

# neutron router-port-list <router_id>

root@controller:~# neutron router-port-list 9ce1f2d5-5a81-4052-b4d8-18f3d7c69d1b
neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
+--------------------------------------+------+----------------------------------+-------------------+---------------------------------------------------------------------------------+
| id                                   | name | tenant_id                        | mac_address       | fixed_ips                                                                       |
+--------------------------------------+------+----------------------------------+-------------------+---------------------------------------------------------------------------------+
| 96be1ff0-7336-4f39-91f4-15546e99dc45 |      | 935ed74e0ad847dca043e95acf82f4ff | fa:16:3e:81:d4:38 | {"subnet_id": "5d8bcb08-0daa-4436-baf4-d6dacb7f9b74", "ip_address": "10.0.0.1"} |
+--------------------------------------+------+----------------------------------+-------------------+---------------------------------------------------------------------------------+

4.根据路由器id与subnet_id删除路由器其他端口

# neutron router-interface-delete <router-id> <subnet-id>

root@controller:~# neutron router-interface-delete 9ce1f2d5-5a81-4052-b4d8-18f3d7c69d1b 5d8bcb08-0daa-4436-baf4-d6dacb7f9b74
neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
Removed interface from router 9ce1f2d5-5a81-4052-b4d8-18f3d7c69d1b.
root@controller:~# 

5.删除路由

# neutron router-delete <router-id>

root@controller:~# neutron router-delete  ts-router
neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
Deleted router(s): ts-router
root@controller:~# 

6.列出所有使用网络的端口

# neutron port-list

root@controller:~# neutron port-list
neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
+--------------------------------------+------+----------------------------------+-------------------+-------------------------------------------------------------------------------------+
| id                                   | name | tenant_id                        | mac_address       | fixed_ips                                                                           |
+--------------------------------------+------+----------------------------------+-------------------+-------------------------------------------------------------------------------------+
| 4871b55c-106e-4a86-8d94-90f756c625f0 |      | 935ed74e0ad847dca043e95acf82f4ff | fa:16:3e:db:2d:fe | {"subnet_id": "5d8bcb08-0daa-4436-baf4-d6dacb7f9b74", "ip_address": "10.0.0.2"}     |
| 77ad5a46-9865-4fa3-9b23-82da39585d9d |      | 935ed74e0ad847dca043e95acf82f4ff | fa:16:3e:e4:da:ac | {"subnet_id": "4c449c4a-265f-4a97-8247-172b997d5ee3", "ip_address": "192.168.8.20"} |
+--------------------------------------+------+----------------------------------+-------------------+-------------------------------------------------------------------------------------+

7.删除端口

neutron port-delete <port_id>

root@controller:~# neutron port-delete 4871b55c-106e-4a86-8d94-90f756c625f0
neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
Deleted port(s): 4871b55c-106e-4a86-8d94-90f756c625f0
root@controller:~# neutron port-delete 77ad5a46-9865-4fa3-9b23-82da39585d9d
neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
Deleted port(s): 77ad5a46-9865-4fa3-9b23-82da39585d9d

8.删除子网

8.1.列出所有子网,获得要删除子网的subnet_id

# neutron subnet-list

root@controller:~# neutron subnet-list
neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
+--------------------------------------+----------------+----------------------------------+----------------+--------------------------------------------------+
| id                                   | name           | tenant_id                        | cidr           | allocation_pools                                 |
+--------------------------------------+----------------+----------------------------------+----------------+--------------------------------------------------+
| 4c449c4a-265f-4a97-8247-172b997d5ee3 | public_subnet  | 935ed74e0ad847dca043e95acf82f4ff | 192.168.8.0/24 | {"start": "192.168.8.20", "end": "192.168.8.80"} |
| 5d8bcb08-0daa-4436-baf4-d6dacb7f9b74 | private_subnet | 935ed74e0ad847dca043e95acf82f4ff | 10.0.0.0/24    | {"start": "10.0.0.2", "end": "10.0.0.254"}       |
+--------------------------------------+----------------+----------------------------------+----------------+--------------------------------------------------+

8.2.删除子网

neutron subnet-delete <subnet-id>

root@controller:~# neutron subnet-delete 4c449c4a-265f-4a97-8247-172b997d5ee3
neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
Deleted subnet(s): 4c449c4a-265f-4a97-8247-172b997d5ee3
root@controller:~# neutron subnet-delete 5d8bcb08-0daa-4436-baf4-d6dacb7f9b74
neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
Deleted subnet(s): 5d8bcb08-0daa-4436-baf4-d6dacb7f9b74

9.列出网络,获得要删除的网络id

 neutron net-list

 root@controller:~# neutron net-list
neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
+--------------------------------------+------------------+----------------------------------+---------+
| id                                   | name             | tenant_id                        | subnets |
+--------------------------------------+------------------+----------------------------------+---------+
| 3dd9fd91-d315-4880-a262-fd1c21ed178b | priv_net      | 935ed74e0ad847dca043e95acf82f4ff |         |
| 53633bec-9859-4061-9f68-183b13c6abe5 | pub_net       | 935ed74e0ad847dca043e95acf82f4ff |         |
+--------------------------------------+------------------+----------------------------------+---------+

10.根据获得的网络id,删除网络

# neutron net-delete <net-id>

root@controller:~# neutron net-delete 3dd9fd91-d315-4880-a262-fd1c21ed178b
neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
Deleted network(s): 3dd9fd91-d315-4880-a262-fd1c21ed178b
root@controller:~# neutron net-delete 53633bec-9859-4061-9f68-183b13c6abe5
neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
Deleted network(s): 53633bec-9859-4061-9f68-183b13c6abe5
  • 2
    点赞
  • 21
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值