# List Rules in Security Group Using CLI

## Problem

* Need to view the rules present in a Security Group like open ports, CIDR block, and protocol.

## Environment

* Platform9 Managed OpenStack - All Versions

## Procedure

* To view the rules in a Security Group, run:

{% tabs %}
{% tab title="None" %}

```none
$ openstack security group rule list --long [security group UUID]
```

{% endtab %}
{% endtabs %}

* Output:

{% tabs %}
{% tab title="None" %}

```none
openstack security group rule list --long e27b4877-f2a0-42bb-ae50-8ab04f222c89
    +--------------------------------------+-------------+-----------+------------+-----------+-----------+-----------------------+
    | ID                                   | IP Protocol | IP Range  | Port Range | Direction | Ethertype | Remote Security Group |
    +--------------------------------------+-------------+-----------+------------+-----------+-----------+-----------------------+
    | 10f1df0a-098a-497c-b3b2-fbe46c676f5c | None        | 0.0.0.0/0 |            | egress    | IPv4      | None                  |
    | 74b91e24-d491-4f10-a847-94d069f9529b | None        | 0.0.0.0/0 |            | ingress   | IPv4      | None                  |
    | e81b2d9f-210c-4914-88ee-9e61441ea486 | tcp         | 0.0.0.0/0 | 22:22      | ingress   | IPv4      | None                  |
    +--------------------------------------+-------------+-----------+------------+-----------+-----------+-----------------------+
```

{% endtab %}
{% endtabs %}

## Additional Information

[OpenStack Docs: Security Group Rule](https://docs.openstack.org/python-openstackclient/pike/cli/command-objects/security-group-rule.html#security-group-rule-list)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://platform9.com/kb/pmo/how-to/list-rules-in-security-group-using-cli.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
