openstack之安全性群組管理

來源:互聯網
上載者:User

標籤:creat   rip   格式   roo   delete   The   let   not found   bsp   

命令概覽

(nova-api)[[email protected] /]# 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-default-rule   Add a rule to the set of rules that will be    secgroup-add-group-rule     Add a source group rule to a security group.    secgroup-add-rule           Add a rule to a security group.    secgroup-create             Create a security group.    secgroup-delete             Delete a security group.    secgroup-delete-default-rule    secgroup-delete-group-rule  Delete a source group rule from a security    secgroup-delete-rule        Delete a rule from a security group.    secgroup-list               List security groups for the current tenant.    secgroup-list-default-rules    secgroup-list-rules         List rules for a security group.    secgroup-update             Update a security group.

列出安全性群組

(nova-api)[[email protected] /]# nova secgroup-list+--------------------------------------+---------+------------------------+| Id                                   | Name    | Description            |+--------------------------------------+---------+------------------------+| 6a5dd6bb-600f-49bb-b37b-91059ff4074b | default | Default security group || fdbffd7a-5f5e-413a-8d78-5f26bdc23c4e | hzb-sg  |                        |+--------------------------------------+---------+------------------------+

列出某個安全性群組下的規則

(nova-api)[[email protected] /]# nova  secgroup-list-rules default+-------------+-----------+---------+----------+--------------+| IP Protocol | From Port | To Port | IP Range | Source Group |+-------------+-----------+---------+----------+--------------+|             |           |         |          | default      ||             |           |         |          | default      |+-------------+-----------+---------+----------+--------------+

建立安全性群組

(nova-api)[[email protected] /]# nova secgroup-create boshen-sg "allow ping and ssh"+--------------------------------------+-----------+--------------------+| Id                                   | Name      | Description        |+--------------------------------------+-----------+--------------------+| db7599e0-be38-4955-93d9-ed20f2a8a298 | boshen-sg | allow ping and ssh |+--------------------------------------+-----------+--------------------+(nova-api)[[email protected] /]# nova secgroup-list+--------------------------------------+-----------+------------------------+| Id                                   | Name      | Description            |+--------------------------------------+-----------+------------------------+| db7599e0-be38-4955-93d9-ed20f2a8a298 | boshen-sg | allow ping and ssh     || 6a5dd6bb-600f-49bb-b37b-91059ff4074b | default   | Default security group |+--------------------------------------+-----------+------------------------+

增加規則 (icmp:允許 ping)

usage: nova secgroup-add-rule <secgroup> <ip-proto> <from-port> <to-port> <cidr>
(nova-api)[[email protected] /]# nova secgroup-add-rule boshen-sg 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 |              |+-------------+-----------+---------+-----------+--------------+

(nova-api)[[email protected] /]# nova secgroup-list-rules boshen-sg+-------------+-----------+---------+-----------+--------------+| IP Protocol | From Port | To Port | IP Range | Source Group |+-------------+-----------+---------+-----------+--------------+| icmp | -1 | -1 | 0.0.0.0/0 | |+-------------+-----------+---------+-----------+--------------+

 

增加規則 (tcp:允許 ssh)

(nova-api)[[email protected] /]# nova secgroup-add-rule boshen-sg 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 |              |+-------------+-----------+---------+-----------+--------------+(nova-api)[[email protected] /]# nova  secgroup-list-rules boshen-sg+-------------+-----------+---------+-----------+--------------+| IP Protocol | From Port | To Port | IP Range  | Source Group |+-------------+-----------+---------+-----------+--------------+| tcp         | 22        | 22      | 0.0.0.0/0 |              || icmp        | -1        | -1      | 0.0.0.0/0 |              |+-------------+-----------+---------+-----------+--------------+

增加規則(udp:廣播)

(nova-api)[[email protected] /]# nova secgroup-add-rule boshen-sg udp 1 65535 0.0.0.0/0+-------------+-----------+---------+-----------+--------------+| IP Protocol | From Port | To Port | IP Range  | Source Group |+-------------+-----------+---------+-----------+--------------+| udp         | 1         | 65535   | 0.0.0.0/0 |              |+-------------+-----------+---------+-----------+--------------+(nova-api)[[email protected] /]# nova  secgroup-list-rules boshen-sg+-------------+-----------+---------+-----------+--------------+| IP Protocol | From Port | To Port | IP Range  | Source Group |+-------------+-----------+---------+-----------+--------------+| tcp         | 22        | 22      | 0.0.0.0/0 |              || udp         | 1         | 65535   | 0.0.0.0/0 |              || icmp        | -1        | -1      | 0.0.0.0/0 |              |+-------------+-----------+---------+-----------+--------------+

刪除安全性群組中的規則

格式:

usage: nova secgroup-delete-rule <secgroup> <ip-proto> <from-port> <to-port> <cidr>
(nova-api)[[email protected] /]# nova secgroup-delete-rule boshen-sg udp 1 65535 0.0.0.0/0+-------------+-----------+---------+-----------+--------------+| IP Protocol | From Port | To Port | IP Range  | Source Group |+-------------+-----------+---------+-----------+--------------+| udp         | 1         | 65535   | 0.0.0.0/0 |              |+-------------+-----------+---------+-----------+--------------+(nova-api)[[email protected] /]# nova  secgroup-list-rules boshen-sg+-------------+-----------+---------+-----------+--------------+| IP Protocol | From Port | To Port | IP Range  | Source Group |+-------------+-----------+---------+-----------+--------------+| tcp         | 22        | 22      | 0.0.0.0/0 |              || icmp        | -1        | -1      | 0.0.0.0/0 |              |+-------------+-----------+---------+-----------+--------------+

 

更新安全性群組(只能更新名字和描述)

格式:

usage: nova secgroup-update <secgroup> <name> <description>
(nova-api)[[email protected] /]# nova secgroup-update boshen-sg boshen-sg2 xxxxxxxxx+--------------------------------------+------------+-------------+| Id                                   | Name       | Description |+--------------------------------------+------------+-------------+| db7599e0-be38-4955-93d9-ed20f2a8a298 | boshen-sg2 | xxxxxxxxx   |+--------------------------------------+------------+-------------+(nova-api)[[email protected] /]# nova  secgroup-list-rules boshen-sgERROR (CommandError): Secgroup ID or name ‘boshen-sg‘ not found.(nova-api)[[email protected] /]# nova  secgroup-list-rules boshen-sg2+-------------+-----------+---------+-----------+--------------+| IP Protocol | From Port | To Port | IP Range  | Source Group |+-------------+-----------+---------+-----------+--------------+| tcp         | 22        | 22      | 0.0.0.0/0 |              || icmp        | -1        | -1      | 0.0.0.0/0 |              |+-------------+-----------+---------+-----------+--------------+

 

刪除安全性群組

(nova-api)[[email protected] /]# nova secgroup-delete hzb-sg+--------------------------------------+--------+-------------+| Id                                   | Name   | Description |+--------------------------------------+--------+-------------+| fdbffd7a-5f5e-413a-8d78-5f26bdc23c4e | hzb-sg |             |+--------------------------------------+--------+-------------+
(nova-api)[[email protected] /]# nova secgroup-list+--------------------------------------+---------+------------------------+| Id                                   | Name    | Description            |+--------------------------------------+---------+------------------------+| 6a5dd6bb-600f-49bb-b37b-91059ff4074b | default | Default security group |+--------------------------------------+---------+------------------------+

 

openstack之安全性群組管理

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.