openstack 命令行管理十三 - 外部网络[外部连接专用]管理 (备忘)



创建公网

[root@station140 ~(network_admin)]# neutron net-create --router:external=true  pub1
Created a new network:
+---------------------------+--------------------------------------+
| Field                     | Value                                |
+---------------------------+--------------------------------------+
| admin_state_up            | True                                 |
| id                        | aebe75f0-6013-4a5e-bbd9-cb81e1f017bc |
| name                      | pub1                                 |
| provider:network_type     | local                                |
| provider:physical_network |                                      |
| provider:segmentation_id  |                                      |
| router:external           | True                                 |
| shared                    | False                                |
| status                    | ACTIVE                               |
| subnets                   |                                      |
| tenant_id                 | e3a71a59840c4e88b8740b789c3afb9c     |
+---------------------------+--------------------------------------+
注: 参数 --router:external=true 表示创建的是公网网络

查询公网网络信息

[root@station140 ~(keystone_admin)]# nova network-list | grep pub1
+--------------------------------------+---------+------+
| ID                                   | Label   | Cidr |
+--------------------------------------+---------+------+
| aebe75f0-6013-4a5e-bbd9-cb81e1f017bc | pub1    | None |
+--------------------------------------+---------+------+


############ 注意 ##########
把该 id (aebe75f0-6013-4a5e-bbd9-cb81e1f017bc) 定义到  /etc/neutron/l3_agent.ini

gateway_external_network_id = aebe75f0-6013-4a5e-bbd9-cb81e1f017bc
handle_internal_only_routers = True
external_network_id = aebe75f0-6013-4a5e-bbd9-cb81e1f017bc
external_network_bridge = br-ex

重启服务

/etc/init.d/neutron-l3-agent restart

注: 上述问题可解决 内部网络 中 ROUTE 显示为 DOWN 状态

############ 注意 ##########

创建子网

neutron subnet-create --name terry_pub_net1 --allocation-pool start=192.168.48.142,end=192.168.48.148 --gateway 192.168.48.1 --dns-nameserver 192.168.86.37 --enable_dhcp=False --ip-version 4  pub1 192.168.48.0/24
Created a new subnet:
+------------------+------------------------------------------------------+
| Field            | Value                                                |
+------------------+------------------------------------------------------+
| allocation_pools | {"start": "192.168.48.142", "end": "192.168.48.148"} |
| cidr             | 192.168.48.0/24                                      |
| dns_nameservers  | 192.168.86.37                                        |
| enable_dhcp      | False                                                |
| gateway_ip       | 192.168.48.1                                         |
| host_routes      |                                                      |
| id               | 59cc431b-498e-49a0-bc60-4a8ca1ca6f48                 |
| ip_version       | 4                                                    |
| name             | terry_pub_net1                                       |
| network_id       | aebe75f0-6013-4a5e-bbd9-cb81e1f017bc                 |
| tenant_id        | e3a71a59840c4e88b8740b789c3afb9c                     |
+------------------+------------------------------------------------------+


删除网络方法

neutron net-delete pub1

查询外部网络

[root@station140 ~(network_admin)]# nova floating-ip-pool-list
+--------+
| name   |
+--------+
| public |
| pub1   | <- 注: 假如 neutron net-create 不带 --router:external=true 参数, 则代表网络为内部网络
+--------+



  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Terry_Tsang

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值