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 參數, 則代表網絡為內部網絡 +--------+
最後更新:2017-04-03 12:55:09