OpenStack的网络管理指南第四部分
对云租户公开OpenStack的网络API,使他们能够建立丰富的网络拓扑结构。
由云管理员或自动化的管理工具,为租户建立网络连接。
Attribute | Type | Default value | Description |
---|---|---|---|
admin_state_up | bool | True | 网络的管理状态。如果指定为False (down) ,该网络不转发报文。 |
id | uuid-str | Generated | 网络的UUID |
name | string | None | 网络名字,这个字段不必是唯一的 |
shared | bool | False | 指定是否任何租户可以访问该网络资源。默认策略设置限制使用该属性只有管理用户。 |
status | string | N/A | 指示这个网络目前是否正在运作 |
subnets | list(uuid-str) | Empty list | 这个网络的子网列表 |
tenant_id | uuid-str | N/A |
网络的拥有者。只有管理员用户可以设置租户标识,这不能通过
使用授权机制来改变。
|
Attribute | Type | Default Value | Description |
---|---|---|---|
allocation_pools | list(dict) | Every address incidr , excludinggateway_ip (if configured). |
CIDR子范围
列表,可用于动态分配端口。语法:
: [ { "start":"10.0.0.2", "end": "10.0.0.254"} ] |
cidr | string | N/A | 基于IP版本的子网的IP地址范围。 |
dns_nameservers | list(string) | Empty list | 该子网中的主机所使用的DNS名称服务器列表。 |
enable_dhcp | bool | True | 指定该子网是否启用DHCP。 |
gateway_ip | string | First address in cidr | 该子网中设备使用的默认网关。 |
host_routes | list(dict) | Empty list | 从这个子网的IP地址(不包括本地子网的路由)的设备应该使用的路由。 |
id | uuid-string | Generated | 代表这个子网的UUID |
ip_version | int | 4 | IP 版本. |
name | string | None | 子网的名字 |
network_id | uuid-string | N/A | 子网所依附的网络 |
tenant_id | uuid-string | N/A |
网络的所有者。只有管理员用户可以设置租户标识,
这不能通过
使用授权机制来
改变。
|
Attribute | Type | Default Value | Description |
---|---|---|---|
admin_state_up | bool | true | 此端口的管理状态。如果指定为false(down) ,该端口不转发报文。 |
device_id | string | None |
标识使用此端口的
设备(例如,一个虚拟服务器的ID )。
|
device_owner | string | None | 标识使用此端口的实体(例如, DHCP代理)。 |
fixed_ips | list(dict) | Automatically allocated from pool | 指定此端口的ip地址,将端口关联子网 |
id | uuid-string | Generated | 端口的UUID |
mac_address | string | Generated | 使用这个端口的mac地址 |
name | string | None | 端口名字 |
network_id | uuid-string | N/A | 端口所在的网络 |
status | string | N/A | 指示网络目前是否在工作 |
tenant_id | uuid-string | N/A | 网络的拥有者。只有管理员用户可以设置租户标识,这不能通过使用授权机制来改变。 |
Action | Command |
---|---|
创建一个网络. | $ neutron net-create net1 |
创建net1的一个子网 | $ neutron subnet-create net1 10.0.0.0/24 |
列出租户的端口列表 | $ neutron port-list |
列出租户的端口列表,同时显示id , fixed_ips , device_owner | $ neutron port-list -c id -c fixed_ips -c device_owner |
显示一个特定的端口的详细信息 | $ neutron port-show |
Note |
---|
|
$ neutron net-create --tenant-id=tenant-id
network-name
比如:
$ neutron net-create --tenant-id=5e4bbe24b67a4410bc4d9fae29ec394e net1
![]() | Note |
---|---|
要查看所有租户ID在OpenStack身份服务中的情况,作为管理员用户运行以下命令:
$ keystone tenant-list |
Table 4.5. Advanced OpenStack Networking operations | |
Action | Command |
创建一个共享网络(可以被所有租户所使用) | $ neutron net-create --shared public-net |
创建一个指定网关的子网 | $ neutron subnet-create --gateway 10.0.0.254 net1 10.0.0.0/24 |
创建一个没有网关的子网 | $ neutron subnet-create --no-gateway net1 10.0.0.0/24 |
创建一个禁用DHCP的子网 | $ neutron subnet-create net1 10.0.0.0/24 --enable_dhcp False |
创建有一组特定主机路由的子网 | $ neutron subnet-create test-net1 40.0.0.0/24 --host_routes type=dict list=true destination=40.0.1.0/24,nexthop=40.0.0.2 |
创建有一组特定DNS域名服务器的子网 | $ neutron subnet-create test-net1 40.0.0.0/24 --dns_nameservers list=true 8.8.8.7 8.8.8.8 |
显示网络上的所有端口/ip分配 | $ neutron port-list --network_id net-id |
Action | Command |
---|---|
检查可以网络 | $ neutron net-list |
选定一个Openstack网络来创建一个单网卡虚拟机。 | $ nova boot --image |
搜索一个OpenStack计算实例所有端口。 | $ neutron port-list --device_id= |
搜索端口,但只显示端口的mac地址 | $ neutron port-list -c mac_address --device_id= |
暂时禁止端口发送流量。 | $ neutron port-update |
删除一个虚拟机 | $ nova delete --device_id= |
![]() | Note |
---|---|
当你:
|
Action | Command |
---|---|
创建一个多网卡虚拟机 | $ nova boot --image |
创建一个指定IP地址的虚拟机:首先创建一个特定ip地址的Openstack网络端口 然后指定port-id而不是net-id来创建一个虚拟机 | $ neutron port-create --fixed-ip subnet_id= |
创建一个可以连接所有网络的虚拟机,它可以允许没有网卡配置的租户提交请求 | $ nova boot --image |
![]() | Note |
---|---|
OpenStack网络当前不支持网卡选项中的v4-fixed-ip |
-
实现OpenStack的网络安全组,您可以直接利用neutron security-group-rule-create来创建安全组规则。下面的示例允许ping和ssh访问你的虚拟机。
$ neutron security-group-rule-create --protocol icmp --direction ingress default $ neutron security-group-rule-create --protocol tcp --port-range-min 22 --port-range-max 22 --direction ingress default
-
不实现OpenStack网络安全组,你可以使用nova secgroup-add-rule或者euca-authorize命令来配置Openstack网络的安全组。以下nova命令允许ping和ssh访问你的虚拟机。
$ nova secgroup-add-rule default icmp -1 -1 0.0.0.0/0 $ nova secgroup-add-rule default tcp 22 22 0.0.0.0/0
![]() | Note |
---|---|
如果你的插件实现了OpenStack的网络安全组,你也可以利用计算安全组设置security_group_api =neutron在配置文件nova.conf中。设置此选项后,所有计算安全组命令由OpenStack的网络代理。 |