> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xloud.tech/llms.txt
> Use this file to discover all available pages before exploring further.

# Networking CLI Reference

> Complete openstack network CLI commands for managing Xloud Networking — networks, subnets, routers, floating IPs, security groups, and ports.

## Overview

The `openstack network` command group manages software-defined networks, subnets, routers, ports, floating IPs, and security group rules.

<Note>
  **Prerequisites**

  * CLI installed and authenticated — see [CLI Setup](/cli-setup)
  * Python neutronclient installed: `pip install python-neutronclient`
</Note>

***

## Networks

<CodeGroup>
  ```bash title="List networks" theme={null}
  openstack network list
  openstack network list --internal
  openstack network list --external
  ```

  ```bash title="Create private network" theme={null}
  openstack network create private-net
  ```

  ```bash title="Create with provider type (admin)" theme={null}
  openstack network create \
    --provider-network-type vlan \
    --provider-physical-network physnet1 \
    --provider-segment 100 \
    vlan-100
  ```

  ```bash title="Show network" theme={null}
  openstack network show private-net
  ```

  ```bash title="Delete network" theme={null}
  openstack network delete private-net
  ```
</CodeGroup>

***

## Subnets

<CodeGroup>
  ```bash title="List subnets" theme={null}
  openstack subnet list
  ```

  ```bash title="Create subnet" theme={null}
  openstack subnet create \
    --network private-net \
    --subnet-range 10.0.1.0/24 \
    --dns-nameserver 8.8.8.8 \
    private-subnet
  ```

  ```bash title="Create with DHCP disabled" theme={null}
  openstack subnet create \
    --network private-net \
    --subnet-range 10.0.2.0/24 \
    --no-dhcp \
    static-subnet
  ```

  ```bash title="Show subnet" theme={null}
  openstack subnet show private-subnet
  ```

  ```bash title="Delete subnet" theme={null}
  openstack subnet delete private-subnet
  ```
</CodeGroup>

***

## Routers

<CodeGroup>
  ```bash title="List routers" theme={null}
  openstack router list
  ```

  ```bash title="Create router with external gateway" theme={null}
  openstack router create my-router
  openstack router set --external-gateway external my-router
  ```

  ```bash title="Add subnet interface" theme={null}
  openstack router add subnet my-router private-subnet
  ```

  ```bash title="Remove subnet interface" theme={null}
  openstack router remove subnet my-router private-subnet
  ```

  ```bash title="Show router details" theme={null}
  openstack router show my-router
  ```

  ```bash title="Delete router" theme={null}
  openstack router delete my-router
  ```
</CodeGroup>

***

## Floating IPs

<CodeGroup>
  ```bash title="List floating IPs" theme={null}
  openstack floating ip list
  ```

  ```bash title="Allocate floating IP" theme={null}
  openstack floating ip create external
  ```

  ```bash title="Associate to instance" theme={null}
  openstack server add floating ip <server> <floating-ip>
  ```

  ```bash title="Disassociate" theme={null}
  openstack server remove floating ip <server> <floating-ip>
  ```

  ```bash title="Release floating IP" theme={null}
  openstack floating ip delete <floating-ip>
  ```
</CodeGroup>

***

## Security Groups

<CodeGroup>
  ```bash title="List security groups" theme={null}
  openstack security group list
  ```

  ```bash title="Create security group" theme={null}
  openstack security group create web-servers \
    --description "Allow HTTP and SSH"
  ```

  ```bash title="Add inbound rules" theme={null}
  openstack security group rule create \
    --protocol tcp --dst-port 22 --remote-ip 0.0.0.0/0 \
    web-servers

  openstack security group rule create \
    --protocol tcp --dst-port 80 --remote-ip 0.0.0.0/0 \
    web-servers

  openstack security group rule create \
    --protocol tcp --dst-port 443 --remote-ip 0.0.0.0/0 \
    web-servers
  ```

  ```bash title="Allow ICMP (ping)" theme={null}
  openstack security group rule create \
    --protocol icmp \
    web-servers
  ```

  ```bash title="List rules in a group" theme={null}
  openstack security group rule list web-servers
  ```

  ```bash title="Delete rule" theme={null}
  openstack security group rule delete <rule-id>
  ```
</CodeGroup>

***

## Ports

<CodeGroup>
  ```bash title="List ports" theme={null}
  openstack port list
  openstack port list --network private-net
  ```

  ```bash title="Create port with fixed IP" theme={null}
  openstack port create \
    --network private-net \
    --fixed-ip subnet=private-subnet,ip-address=10.0.1.50 \
    my-port
  ```

  ```bash title="Show port" theme={null}
  openstack port show <port>
  ```

  ```bash title="Disable port security" theme={null}
  openstack port set --disable-port-security <port>
  ```

  ```bash title="Delete port" theme={null}
  openstack port delete <port>
  ```
</CodeGroup>

***

## Next Steps

<CardGroup cols={2}>
  <Card title="Network User Guide" href="/services/networking/create-network" color="#197560">
    Step-by-step network and subnet creation walkthrough
  </Card>

  <Card title="Compute CLI" href="/services/compute/cli-reference" color="#197560">
    Attach floating IPs and security groups to instances
  </Card>
</CardGroup>
