Chapter 6: Neutron - Basic Commands - Part 2

Floating IPs, Routers,Security Groups


Commands :

1. Floating IP :

Floating IP is the external network IP(routable IP). It will be associated with the Port, for accessing(ssh to) the VMs from the external network.

Create a Floating IP:

Simple Syntax:

neutron floatingip-create <external network>

Example:

neutron floatingip-create  public

List the Floating IPs:

neutron floatingip-list

Delete the floating ip :

Syntax:

neutron floatingip-delete <floatingip id or name>

Example:

neutron floatingip-delete  67297a3e-ed5c-43d4-9cfb-215926acdaf7

Associate the Floatingip to the port :

Syntax:

neutron floatingip-associate <floatingip id> <port id>

Note: Get the Port ID for the fixed ip from the "neutron port-list" output

Example:

neutron floatingip-associate dcb48f7f-cb4c-4289-a27b-62b4e3399647 022e917f-3f04-4825-817b-8820b8e754f9

DisAssociate the Floatingip from the port:

Syntax:

neutron floatingip-disassociate <fip id>

Example:

neutron floatingip-disassociate dcb48f7f-cb4c-4289-a27b-62b4e3399647

2. Routers:

To List the routers:

neutron router-list

To show the router:

syntax:

neutron router-show <id or name>

Example:

neutron router-show router1

To delete the router:

syntax:

neutron router-delete <id or name>

Example:

neutron router-delete router1

Set the Gateway to the router:

syntax:

neutron router-gateway-set <router name or id> <external network name or id>

Example:

neutron router-gateway-set router1 public

Remove the gateway from the router:

syntax:

neutron router-gateway-clear <router name id> <gateway nw name>

Example:

neutron router-gateway-clear router1 public

Add the interface to the router

Simple Syntax:

neutron router-interface-add <router name or ID> <SUBNET|subnet=SUBNET|port=PORT>

Example:

neutron router-interface-add router1 S2
neutron router-interface-add router1 port=4ff4aaca-3b24-4a22-883f-ea218196ff6d
neutron router-interface-add router1 subnet=91c773a1-a4e2-4f14-946d-401c1f7ee627

List the interfaces or ports of the router:

neutron router-port-list

Remove the interface from the router

neutron router-interface-delete <router name> <subnet name/id>

Update the Router parameters

Syntax:

neutron router-update [parameters] <Router Name or ID>

Parametes:

--route destination=CIDR,nexthop=IP_ADDR

The above parameter is used for adding static route in the Router.

Example:

neutron router-update --route destination=192.168.101.0/24,nexthop=10.10.10.254 Office-Router

3. Security Groups :

To List the security groups

neutron security-group-list

To List the security group rules

neutron security-group-rule-list

To Create a secruity group

syntax:

neutron security-group-create <name>

neutron security-group-create test1

To delete the security group

syntax:

neutron secuirty-group-delete <name or id>

neutron security-group-delete test1

Create a rule to the secuirty group

Simple Syntax:

neutron security-group-rule-create --direction <ingress | egress > --protocol <tcp | udp | icmp> --remote-ip-prefix <cidr> <security-group name>

Example:

neutron security-group-rule-create --direction egress --protocol icmp --remote-ip-prefix 0.0.0.0/0 default

Delete the security group rule

Syntax:

neutron security-group-rule-delete <id or name>

neutron security-group-rule-delete d8ea344b-6bff-4c16-a67b-f588d33c6b49

Execution Logs:

1. Floating IP :

neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
Created a new floatingip:
+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| created_at          | 2017-08-15T15:49:56Z                 |
| description         |                                      |
| fixed_ip_address    |                                      |
| floating_ip_address | 172.24.4.12                          |
| floating_network_id | 975dd3d1-3576-4c34-991e-eaf24f45295e |
| id                  | dcb48f7f-cb4c-4289-a27b-62b4e3399647 |
| port_id             |                                      |
| project_id          | bccf45eee4544264a526c4bca56fdb3c     |
| revision_number     | 1                                    |
| router_id           |                                      |
| status              | DOWN                                 |
| tenant_id           | bccf45eee4544264a526c4bca56fdb3c     |
| updated_at          | 2017-08-15T15:49:56Z                 |
+---------------------+--------------------------------------+
(osclient)cloud@db:~/osclient$ 
(osclient)cloud@db:~/osclient$ 
neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
+--------------------------------------+------------------+---------------------+---------+
| id                                   | fixed_ip_address | floating_ip_address | port_id |
+--------------------------------------+------------------+---------------------+---------+
| dcb48f7f-cb4c-4289-a27b-62b4e3399647 |                  | 172.24.4.12         |         |
+--------------------------------------+------------------+---------------------+---------+
(osclient)cloud@db:~/osclient$
(osclient)cloud@db:~/osclient$ neutron floatingip-associate dcb48f7f-cb4c-4289-a27b-62b4e3399647 022e917f-3f04-4825-817b-8820b8e754f9
neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
Associated floating IP dcb48f7f-cb4c-4289-a27b-62b4e3399647
(osclient)cloud@db:~/osclient$
(osclient)cloud@db:~/osclient$ neutron floatingip-list
neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
+--------------------------------------+------------------+---------------------+--------------------------------------+
| id                                   | fixed_ip_address | floating_ip_address | port_id                              |
+--------------------------------------+------------------+---------------------+--------------------------------------+
| dcb48f7f-cb4c-4289-a27b-62b4e3399647 | 10.10.10.9       | 172.24.4.12         | 022e917f-3f04-4825-817b-8820b8e754f9 |
+--------------------------------------+------------------+---------------------+--------------------------------------+
(osclient)cloud@db:~/osclient$ neutron floatingip-disassociate dcb48f7f-cb4c-4289-a27b-62b4e3399647
neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
Disassociated floating IP dcb48f7f-cb4c-4289-a27b-62b4e3399647
(osclient)cloud@db:~/osclient$ neutron floatingip-list
neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
+--------------------------------------+------------------+---------------------+---------+
| id                                   | fixed_ip_address | floating_ip_address | port_id |
+--------------------------------------+------------------+---------------------+---------+
| dcb48f7f-cb4c-4289-a27b-62b4e3399647 |                  | 172.24.4.12         |         |
+--------------------------------------+------------------+---------------------+---------+
(osclient)cloud@db:~/osclient$

2. Routers:

Todo

3. Security Groups :

Todo

results matching ""

    No results matching ""