http://www.aboutyun.com/thread-8964-1-1.html
参考官方资料
You must modify the rules for the default security group because users cannot access instances that use the default group from
any IP address outside the cloud.
You can modify the rules in a security group to allow access to instances through different ports and protocols. For example,
you can modify rules to allow access to instances through SSH, to ping them, or to allow UDP traffic – for example, for a DNS
server running on an instance. You specify the following parameters for rules:
Source of traffic. Enable traffic to instances from either IP addresses inside the cloud from other group members or from all IP addresses.
Protocol. Choose TCP for SSH, ICMP for pings, or UDP.
Destination port on virtual machine. Defines a port range. To open a single port only, enter the same value twice. ICMP does not support ports: Enter values to define the codes and types of ICMP traffic to be allowed.
Rules are automatically enforced as soon as you create or modify them.
注: 已通过测试, 修改默认 secgroup 或自定义 secgroup 都可以完成数据访问测试
帮助
- [root@station140 ~(keystone_admin)]# nova help | grep secgroup
- add-secgroup Add a Security Group to a server.
- list-secgroup List Security Group(s) of a server.
- remove-secgroup Remove a Security Group from a server.
- secgroup-add-group-rule
- secgroup-add-rule Add a rule to a security group.
- secgroup-create Create a security group.
- secgroup-delete Delete a security group.
- secgroup-delete-group-rule
- secgroup-delete-rule
- secgroup-list List security groups for the current tenant.
- secgroup-list-rules
- secgroup-update Update a security group.
创建自定义安全组
- [root@station140 ~(keystone_admin)]# nova secgroup-create terry "allow ping and ssh"
- +--------------------------------------+-------+--------------------+
- | Id | Name | Description |
- +--------------------------------------+-------+--------------------+
- | 6966a8e4-0980-40ad-a409-baac65b60287 | terry | allow ping and ssh |
- +--------------------------------------+-------+--------------------+
列出当前所有安全组
- [root@station140 ~(keystone_admin)]# nova secgroup-list
- +--------------------------------------+---------+--------------------+
- | Id | Name | Description |
- +--------------------------------------+---------+--------------------+
- | 91a191a6-b89e-4f87-99c0-0fb985985978 | default | default |
- | 6966a8e4-0980-40ad-a409-baac65b60287 | terry | allow ping and ssh |
- +--------------------------------------+---------+--------------------+
列出某个组中的安全规则
- [root@station140 ~(keystone_admin)]# nova secgroup-list-rules default
- +-------------+-----------+---------+----------+--------------+
- | IP Protocol | From Port | To Port | IP Range | Source Group |
- +-------------+-----------+---------+----------+--------------+
- | | | | | default |
- | | | | | default |
- +-------------+-----------+---------+----------+--------------+
增加规则方法 (允许 ping)
- [root@station140 ~(keystone_admin)]# nova secgroup-add-rule terry icmp -1 -1 0.0.0.0/0
- +-------------+-----------+---------+-----------+--------------+
- | IP Protocol | From Port | To Port | IP Range | Source Group |
- +-------------+-----------+---------+-----------+--------------+
- | icmp | -1 | -1 | 0.0.0.0/0 | |
- +-------------+-----------+---------+-----------+--------------+
增加规则方法 (允许 ssh)
- [root@station140 ~(keystone_admin)]# nova secgroup-add-rule terry tcp 22 22 0.0.0.0/0
- +-------------+-----------+---------+-----------+--------------+
- | IP Protocol | From Port | To Port | IP Range | Source Group |
- +-------------+-----------+---------+-----------+--------------+
- | tcp | 22 | 22 | 0.0.0.0/0 | |
- +-------------+-----------+---------+-----------+--------------+
增加规则方法 (允许 dns 外部访问)
- [root@station140 ~(keystone_admin)]# nova secgroup-add-rule terry udp 53 53 0.0.0.0/0
- +-------------+-----------+---------+-----------+--------------+
- | IP Protocol | From Port | To Port | IP Range | Source Group |
- +-------------+-----------+---------+-----------+--------------+
- | udp | 53 | 53 | 0.0.0.0/0 | |
- +-------------+-----------+---------+-----------+--------------+
列出自定义组规则
- [root@station140 ~(keystone_admin)]# nova secgroup-list-rules terry
- +-------------+-----------+---------+-----------+--------------+
- | IP Protocol | From Port | To Port | IP Range | Source Group |
- +-------------+-----------+---------+-----------+--------------+
- | tcp | 22 | 22 | 0.0.0.0/0 | |
- | udp | 53 | 53 | 0.0.0.0/0 | |
- | icmp | -1 | -1 | 0.0.0.0/0 | |
- +-------------+-----------+---------+-----------+--------------+
尝试修改 default secgroup
列出 default secgroup 规则
- [root@station140 ~(keystone_admin)]# nova secgroup-list-rules default
- +-------------+-----------+---------+----------+--------------+
- | IP Protocol | From Port | To Port | IP Range | Source Group |
- +-------------+-----------+---------+----------+--------------+
- | | | | | default |
- | | | | | default |
- +-------------+-----------+---------+----------+--------------+
添加规则 (允许 ping)
- [root@station140 ~(keystone_admin)]# nova secgroup-add-rule default icmp -1 -1 0.0.0.0/0
- +-------------+-----------+---------+-----------+--------------+
- | IP Protocol | From Port | To Port | IP Range | Source Group |
- +-------------+-----------+---------+-----------+--------------+
- | icmp | -1 | -1 | 0.0.0.0/0 | |
- +-------------+-----------+---------+-----------+--------------+
添加规则 (允许 ssh)
- [root@station140 ~(keystone_admin)]# nova secgroup-add-rule default tcp 22 22 0.0.0.0/0
- +-------------+-----------+---------+-----------+--------------+
- | IP Protocol | From Port | To Port | IP Range | Source Group |
- +-------------+-----------+---------+-----------+--------------+
- | tcp | 22 | 22 | 0.0.0.0/0 | |
- +-------------+-----------+---------+-----------+--------------+
添加规则 (允许 dns外部访问)
- [root@station140 ~(keystone_admin)]# nova secgroup-add-rule default udp 53 53 0.0.0.0/0
- +-------------+-----------+---------+-----------+--------------+
- | IP Protocol | From Port | To Port | IP Range | Source Group |
- +-------------+-----------+---------+-----------+--------------+
- | udp | 53 | 53 | 0.0.0.0/0 | |
- +-------------+-----------+---------+-----------+--------------+
列出默认组规则
- [root@station140 ~(keystone_admin)]# nova secgroup-list-rules default
- +-------------+-----------+---------+-----------+--------------+
- | IP Protocol | From Port | To Port | IP Range | Source Group |
- +-------------+-----------+---------+-----------+--------------+
- | | | | | default |
- | icmp | -1 | -1 | 0.0.0.0/0 | |
- | tcp | 22 | 22 | 0.0.0.0/0 | |
- | | | | | default |
- | udp | 53 | 53 | 0.0.0.0/0 | |
- +-------------+-----------+---------+-----------+--------------+
删除某个实例, 使用中的规则
- nova remove-secgroup terry_instance1 terry
注: 在虚拟机启动后, 无法在增加其他规则
openstack 命令行管理:内部网络[instance专用]管理
ip 帮助
- [root@station140 ~(keystone_admin)]# nova help | grep ip
- add-fixed-ip Add new IP address on a network to server.
- add-floating-ip Add a floating IP address to a server.
- cloudpipe-configure
- Update the VPN IP/port of a cloudpipe instance.
- cloudpipe-create Create a cloudpipe instance for the given project.
- cloudpipe-list Print a list of all cloudpipe instances.
- dns-create Create a DNS entry for domain, name and ip.
- dns-list List current DNS entries for domain and ip or domain
- fixed-ip-get Retrieve info on a fixed ip.
- fixed-ip-reserve Reserve a fixed IP.
- fixed-ip-unreserve Unreserve a fixed IP.
- floating-ip-bulk-create
- Bulk create floating ips by range.
- floating-ip-bulk-delete
- Bulk delete floating ips by range.
- floating-ip-bulk-list
- List all floating ips.
- floating-ip-create Allocate a floating IP for the current tenant.
- floating-ip-delete De-allocate a floating IP.
- floating-ip-list List floating ips for this tenant.
- floating-ip-pool-list
- List all floating ip pools.
- remove-fixed-ip Remove an IP address from a server.
- remove-floating-ip Remove a floating IP address from a server.
网络管理帮助
- [root@station140 ~(keystone_admin)]# nova help | grep network
- interface-attach Attach a network interface to an instance.
- interface-detach Detach a network interface from an instance.
- network-associate-host
- Associate host with network.
- network-associate-project
- Associate project with network.
- network-create Create a network.
- network-disassociate
- network.
- network-list Print a list of available networks.
- network-show Show details about the given network.
- reset-network Reset network of an instance.
- Add a network interface to a baremetal node.
- List network interfaces associated with a baremetal
- Remove a network interface from a baremetal node.
- net Show a network
- net-create Create a network
- net-delete Delete a network
- net-list List networks
显示当前 openstack 网络方法
- [root@station140 ~(keystone_admin)]# nova network-list
- +--------------------------------------+---------+------+
- | ID | Label | Cidr |
- +--------------------------------------+---------+------+
- | 68a1d874-e7bd-42e2-9f86-8eb0b0b4b8fd | public | None |
- | e8e14001-44d9-4ab1-a462-ea621b8a4746 | private | None |
- +--------------------------------------+---------+------+
参考 openstack 官方文档, 在某些旧版本中, 需要利用下面方法创建网络, 当前 H 版本可以不使用下面变量
- export OS_USERNAME=admin
- export OS_PASSWORD=password
- export OS_TENANT_NAME=admin
- export OS_AUTH_URL=http://localhost:5000/v2.0
另外一种列出网络方法
- [root@station140 ~(network_admin)]# neutron net-list
- +--------------------------------------+---------+------------------------------------------------------+
- | id | name | subnets |
- +--------------------------------------+---------+------------------------------------------------------+
- | 68a1d874-e7bd-42e2-9f86-8eb0b0b4b8fd | public | ce0a4a92-5c23-4557-ad67-97560ab5afa1 172.24.4.224/28 |
- | e8e14001-44d9-4ab1-a462-ea621b8a4746 | private | 79fdeabd-7f8a-4619-a17d-87864ccdfa80 10.0.0.0/24 |
- +--------------------------------------+---------+------------------------------------------------------+
显示某个网络详细信息
- [root@station140 ~(network_admin)]# neutron net-show public
- +---------------------------+--------------------------------------+
- | Field | Value |
- +---------------------------+--------------------------------------+
- | admin_state_up | True |
- | id | 68a1d874-e7bd-42e2-9f86-8eb0b0b4b8fd |
- | name | public |
- | provider:network_type | local |
- | provider:physical_network | |
- | provider:segmentation_id | |
- | router:external | True |
- | shared | False |
- | status | ACTIVE |
- | subnets | ce0a4a92-5c23-4557-ad67-97560ab5afa1 |
- | tenant_id | e3a71a59840c4e88b8740b789c3afb9c |
- +---------------------------+--------------------------------------+
显示网络 extension 详细信息
- [root@station140 ~(keystone_admin)]# neutron ext-list
- +-----------------------+-----------------------------------------------+
- | alias | name |
- +-----------------------+-----------------------------------------------+
- | ext-gw-mode | Neutron L3 Configurable external gateway mode |
- | security-group | security-group |
- | l3_agent_scheduler | L3 Agent Scheduler |
- | provider | Provider Network |
- | binding | Port Binding |
- | quotas | Quota management support |
- | agent | agent |
- | dhcp_agent_scheduler | DHCP Agent Scheduler |
- | external-net | Neutron external network |
- | router | Neutron L3 Router |
- | allowed-address-pairs | Allowed Address Pairs |
- | extra_dhcp_opt | Neutron Extra DHCP opts |
- | extraroute | Neutron Extra Route |
- +-----------------------+-----------------------------------------------+
创建私有网络
- [root@station140 ~(network_admin)]# neutron net-create net1
- Created a new network:
- +---------------------------+--------------------------------------+
- | Field | Value |
- +---------------------------+--------------------------------------+
- | admin_state_up | True |
- | id | d0e3f988-d62f-4f95-ab21-b73f4dae326b |
- | name | net1 |
- | provider:network_type | local |
- | provider:physical_network | |
- | provider:segmentation_id | |
- | shared | False |
- | status | ACTIVE |
- | subnets | |
- | tenant_id | e3a71a59840c4e88b8740b789c3afb9c |
- +---------------------------+--------------------------------------+
显示 net1 网络详细信息
- [root@station140 ~(keystone_admin)]# neutron net-show net1
- +---------------------------+--------------------------------------+
- | Field | Value |
- +---------------------------+--------------------------------------+
- | admin_state_up | True |
- | id | d0e3f988-d62f-4f95-ab21-b73f4dae326b |
- | name | net1 |
- | provider:network_type | local |
- | provider:physical_network | |
- | provider:segmentation_id | |
- | router:external | False |
- | shared | False |
- | status | ACTIVE |
- | subnets | |
- | tenant_id | e3a71a59840c4e88b8740b789c3afb9c |
- +---------------------------+--------------------------------------+
创建私网络 net1 的子网
- [root@station140 ~(network_admin)]# neutron subnet-create --name terry_pri_net1 --allocation-pool start=10.0.0.50,end=10.0.0.100 --no-gateway --ip-version 4 net1 10.0.0.0/24
- Created a new subnet:
- +------------------+---------------------------------------------+
- | Field | Value |
- +------------------+---------------------------------------------+
- | allocation_pools | {"start": "10.0.0.50", "end": "10.0.0.100"} |
- | cidr | 10.0.0.0/24 |
- | dns_nameservers | |
- | enable_dhcp | True |
- | gateway_ip | |
- | host_routes | |
- | id | 3066c397-bccf-4473-8a94-72b09a97a70a |
- | ip_version | 4 |
- | name | terry_pri_net1 |
- | network_id | d0e3f988-d62f-4f95-ab21-b73f4dae326b |
- | tenant_id | e3a71a59840c4e88b8740b789c3afb9c |
- +------------------+---------------------------------------------+
显示 net1 网络详细信息
- [root@station140 ~(keystone_admin)]# neutron net-show net1
- +---------------------------+--------------------------------------+
- | Field | Value |
- +---------------------------+--------------------------------------+
- | admin_state_up | True |
- | id | d0e3f988-d62f-4f95-ab21-b73f4dae326b |
- | name | net1 |
- | provider:network_type | local |
- | provider:physical_network | |
- | provider:segmentation_id | |
- | router:external | False |
- | shared | False |
- | status | ACTIVE |
- | subnets | 3066c397-bccf-4473-8a94-72b09a97a70a |
- | tenant_id | e3a71a59840c4e88b8740b789c3afb9c |
- +---------------------------+--------------------------------------+
注意 net1 中的 subnets values 部分 3066c397-bccf-4473-8a94-72b09a97a70a 显示为 terry_pri_net1 中的 ID 值
相关推荐
(平台搭建版本:Queen版本,安全部署主要包括https安全传输、服务组件日志集中收收集、云主机迁移、VxLAN网络、配置用户密码策略、流量监控、防火墙即服务FwaaS、安全组规则、浮动IP、iptables防火墙、KVM热添加...
另外,对平台安全性进行配置,包括https传输加密、存储加密、云主机迁移、防火墙即服务、安全组规则、浮动IP、iptables防火墙、用户登录密码策略、VxLAN网络、KVM热添加硬盘、openstack服务组件日志集中收集、DDoS...
读者还将学习如何创建和管理虚拟机实例、网络配置、存储分配以及安全组规则设定,这些都是OpenStack日常运维的基础。 OpenStack的扩展性和灵活性是其一大亮点,因此,了解如何添加自定义插件或集成第三方服务也是...
12. OpenStack安全组创建后默认为空,需手动添加规则,保护云主机安全。 13. Swift组件提供对象存储服务,而不是块存储服务,Cinder负责块存储。 14. Keystone提供令牌、目录和策略服务,不提供调度服务。 15. ...
安全组是 OpenStack 中的一种网络安全策略,你可以添加规则来控制进出虚拟机的流量。默认的安全组允许同一 VXLAN 子网内的端口全开放,但你也可以自定义规则,例如添加 ICMP 规则以允许 PING,添加 SSH 规则以允许...
3. 网络和认证管理:Nova处理与网络相关的工作,如IP地址分配、安全组规则实施和网络配置等,以及认证用户和授权操作。 4. REST风格的API:Nova通过与AWS EC2兼容的Web服务API提供服务,方便用户通过HTTP请求进行...
5. **安全组规则**:学习如何通过Neutron的安全组功能设置网络访问规则,保护你的虚拟机。 6. **云存储**:理解Swift的工作原理,以及如何存储和检索对象。 7. **自动化部署**:了解Heat模板,学习如何用模板快速...
此外,OpenStack拥有Dashboard界面,可以设置安全组规则,并通过iptables来定义和实现防火墙规则,允许管理员设置用户安全组,规定哪些端口可以访问虚拟机。授权服务方面,OpenStack提供了两套API,分别为ECSAPI和OS...
为了能够通过SSH访问虚拟机实例,还需要在安全组中添加相应的规则,允许SSH连接。具体步骤如下: 1. 进入 Security Groups 页面,找到你的虚拟机实例所关联的安全组。 2. 添加新的规则,允许TCP协议的SSH端口22访问...
使用neutron命令行,我们可以创建网络、子网、端口,并配置安全组规则,如`neutron net-create`来创建网络,`neutron subnet-create`创建子网,`neutron security-group-rule-create`添加安全组规则。 3. **Cinder*...
设置实例的名称、Flavor和其他配置,如安全组规则。然后,点击“创建服务器”以启动实例。 启动实例后,OpenStack会使用ISO镜像进行网络引导,并开始安装过程。你可以通过连接VNC或SPICE客户端来监视安装进度,或者...
- 安全组是一种基于规则的安全策略,用于控制进出虚拟机实例的流量。 - 说明了如何通过安全组来增强网络安全性。 **6. 高级配置选项** - **OpenStack Networking Server with Plugin** - 描述了如何选择合适的...
5. 安全组设定:安全组(Security Group)是OpenStack中的一个虚拟防火墙,用于定义虚拟机的入站和出站规则。在文件中需要为市场部门设定安全组,允许外部的ping、web访问和SSH访问。 6. 密钥对管理:密钥对(Key ...
为了允许特定类型的网络访问,如ping和SSH,我们需要自定义安全组规则。有两种方法实现这一目标:修改默认安全组或创建新的安全组。这里我们将重点放在第二种方法,即为cirros-vm1添加一个新的安全组。 1. 创建新...
- `securityGroup`:指定实例的安全组,定义了网络访问规则。 2. **OpenStack 服务端点**: - `openstackUrl`:OpenStack Identity(Keystone)服务的URL,用于验证和获取其他服务的端点。格式通常是 `...
* 列出当前安全组或默认安全规则信息:`nova secgroup-list` NEUTRON 客户端工具的使用 NEUTRON 客户端工具提供了多种命令来管理网络资源,包括: * 列出当前用户的网络:`neutron net-list` * 列出当前用户的...
这包括但不限于设置防火墙规则、管理安全组、分配IP地址等。 ##### 2.4 启动和管理实例 用户可以使用仪表板轻松地启动新的计算实例。在启动实例时,可以选择不同的镜像、规格以及其他配置选项。启动后的实例可以在...
检查Neutron配置文件,确保安全组规则允许必要的流量,排查DHCP服务状态,验证路由功能。 2. 隧道网络问题:OpenStack支持VXLAN、GRE等隧道技术,如果隧道网络出现错误,检查网络设备是否支持隧道模式,配置是否...
默认情况下,安全组不会为空,至少包含一些基本规则。安全组分为入口方向和出口方向,外网访问云主机必须经过安全组过滤。 #### 二、OpenStack组件详解 - **Neutron**: Neutron组件提供网络连接服务,支持二层VLAN...
2. **Neutron**:Neutron提供网络服务,允许用户自定义虚拟网络拓扑,包括子网、路由器和安全组规则。它支持多种网络模型,如Flat、VLAN、VXLAN等,以满足不同环境的需求。 3. **Swift**:Swift是一个分布式对象...