Skip to content

Create Networks and Subnets

Before going into details it is important to understand the following terms :

Network and Subnet

They are linked each other. A network with a subnet is required in order to connect resources in the infomaniak public cloud. The network manages the physical attributes (vlan, vxlan...) while the subnet manages the IP addresses (Pool range, dhcp...). Infomaniak provides ready to use public networks that you can choose to boot your VM. You can also create your own private network or use allocation pools.

Floating IPs

Floating IPs are not automatically allocated to instances by default (they need to be attached to instances manually).

A Floating IP (FIP) is an extra public IP address that is associated to an instance. The VM instance itself isn't aware of this FIP and won't be visible in the network interfaces. Connectivity is achieved via NAT rules which manage the routing from the internet to the VM and vice versa. If a VM instance is deleted, the user can reuse the floating IP by attaching it to another instance.

Provider Network

Provider networks are created by infomaniak and rely directly on the physical networks of the datacenters. This network can not be selected when you boot a VM instance.

Their usecases are very specific. One of them applies to customers whom want direct access to their platform resources by bringing their own CIDR to the infomaniak datacenter.

Another usecase is reserving a pool of public asdresses

You can list the Provider networks using :

openstack network list --external

Tenant network (Project/Private network)

It can be more understandable to replace the term Tenant by Project. Tenant networks are created by customers for use by their instances and cannot be shared accross projects/customers. Each tenant network is fully isolated from another (Based on default policy). A Tenant network is therefore private and has no external connectivity. A typical usecase is having VMs acting as backend VMs isolated from the internet and in front of them a single VM instance (or loadbalancer) having a second network interface with internet connectivity. This way only one VM is exposed to the internet.

Allocation Pool

Allocation pool allows users to choose a range IP addresses from an existing pool of addresses that will be served by the DHCP server.

Subnet Pool

Similar to an Allocation Pool, a Subnet pool contains IP addresses that will be used to define automatically a subnet. For example, instead of manually creating a subnet and defining the CIDR, Openstack will create a subnet autimatically by picking up addresses from this subnet pool. It is usefull if you want to ensure there is no overlap in your subnets.

Tip

To use infomaniak recursive DNS Servers when creating your subnets, specify these IPs : 83.166.143.51 and 83.166.143.52

Example 1: Create a network and a subnet

This use case provides the steps to create a network and subnet from the CLI with an allocation pool for IP addresses for virtual machines.

  • Create the network
    openstack network create <network name>
    

Example, we create the network called mynetwork

$ openstack network create mynetwork
+---------------------------+--------------------------------------+
| Field                     | Value                                |
+---------------------------+--------------------------------------+
| admin_state_up            | UP                                   |
| availability_zone_hints   |                                      |
| availability_zones        |                                      |
| created_at                | 2021-03-17T09:08:22Z                 |
| description               |                                      |
| dns_domain                | None                                 |
| id                        | 822278a6-2488-4fa9-acc8-03152240078a |
| ipv4_address_scope        | None                                 |
| ipv6_address_scope        | None                                 |
| is_default                | False                                |
| is_vlan_transparent       | None                                 |
| mtu                       | 1500                                 |
| name                      | mynetwork                            |
| port_security_enabled     | True                                 |
| project_id                | ac4fafd60021431585bbb23470119557     |
| provider:network_type     | None                                 |
| provider:physical_network | None                                 |
| provider:segmentation_id  | None                                 |
| qos_policy_id             | None                                 |
| revision_number           | 1                                    |
| router:external           | Internal                             |
| segments                  | None                                 |
| shared                    | False                                |
| status                    | ACTIVE                               |
| subnets                   |                                      |
| tags                      |                                      |
| updated_at                | 2021-03-17T09:08:22Z                 |
+---------------------------+--------------------------------------+
  • Create the subnet
openstack subnet create <subnet name> --network <network name> --dhcp \
--subnet-range <CIDR> --gateway <gateway IP> --dns-nameserver <DNS IP> \
--dns-nameserver <DNS IP> --allocation-pool start=<IP start>,end=<IP end>

Example, we create the subnet called mysubnet with DHCP enabled with range 10.10.10.100->10.10.10.200 and Infomaniak's dns nameservers.

$ openstack subnet create mysubnet --network mynetwork --dhcp --subnet-range 10.10.10.0/24 --dns-nameserver 83.166.143.51 --dns-nameserver 83.166.143.52 --allocation-pool start=10.10.10.100,end=10.10.10.200 
+----------------------+--------------------------------------+
| Field                | Value                                |
+----------------------+--------------------------------------+
| allocation_pools     | 10.10.10.100-10.10.10.200            |
| cidr                 | 10.10.10.0/24                        |
| created_at           | 2021-03-17T09:15:00Z                 |
| description          |                                      |
| dns_nameservers      | 83.166.143.51, 83.166.143.52         |
| dns_publish_fixed_ip | None                                 |
| enable_dhcp          | True                                 |
| gateway_ip           | 10.10.10.1                           |
| host_routes          |                                      |
| id                   | 04f0e0a0-66c6-40fb-88f5-402097c0afd0 |
| ip_version           | 4                                    |
| ipv6_address_mode    | None                                 |
| ipv6_ra_mode         | None                                 |
| name                 | mysubnet                             |
| network_id           | 822278a6-2488-4fa9-acc8-03152240078a |
| prefix_length        | None                                 |
| project_id           | ac4fafd60021431585bbb23470119557     |
| revision_number      | 0                                    |
| segment_id           | None                                 |
| service_types        |                                      |
| subnetpool_id        | None                                 |
| tags                 |                                      |
| updated_at           | 2021-03-17T09:15:00Z                 |
+----------------------+--------------------------------------+

Example 2: Create a network and a subnet using a subnet pool

This use case provides the steps to create a second subnet from the CLI with a subnet pool.

  • Create the network
    openstack network create <network name>
    

Example, we create the network called mynetwork2

$ openstack network create mynetwork2
  • Create a subnet pool
    openstack subnet pool create <name for subnet pool> --pool-prefix <CIDR> \
    --min-prefix-length <value> --max-prefix-length <value> --default-prefix-lengthi <value>
    

Example, we create the subnet pool called mysubnetpool allowing subnet sizes from /30 to /22 with a default to /26

$ openstack subnet pool create mysubnetpool --pool-prefix 10.10.0.0/16 --min-prefix-length 22 --max-prefix-length 30 --default-prefix-length 26
+-------------------+--------------------------------------+
| Field             | Value                                |
+-------------------+--------------------------------------+
| address_scope_id  | None                                 |
| created_at        | 2021-03-17T09:25:34Z                 |
| default_prefixlen | 26                                   |
| default_quota     | None                                 |
| description       |                                      |
| id                | 58417028-a833-409c-86fb-a8e6e9dba514 |
| ip_version        | 4                                    |
| is_default        | False                                |
| max_prefixlen     | 30                                   |
| min_prefixlen     | 22                                   |
| name              | mysubnetpool                         |
| prefixes          | 10.10.0.0/16                         |
| project_id        | ac4fafd60021431585bbb23470119557     |
| revision_number   | 0                                    |
| shared            | False                                |
| tags              |                                      |
| updated_at        | 2021-03-17T09:25:34Z                 |
+-------------------+--------------------------------------+
  • Create the subnet with the subnet pool
    openstack subnet create <subnet name> --network <network name> --subnet-pool \
    <subnet pool name> --dhcp --dns-nameserver <DNS IP> --dns-nameserver <DNS IP> --prefix-length <value>
    

Example, we create the subnet called mysubnet2 with a /29 prefix-length.

$ openstack subnet create mysubnet2 --network mynetwork2 --dhcp --subnet-pool mysubnetpool --dhcp --dns-ameserver 83.166.143.51 --dns-nameserver 83.166.143.52 --prefix-length 29
+----------------------+--------------------------------------+
| Field                | Value                                |
+----------------------+--------------------------------------+
| allocation_pools     | 10.10.0.2-10.10.0.6                  |
| cidr                 | 10.10.0.0/29                         |
| created_at           | 2021-03-17T09:31:52Z                 |
| description          |                                      |
| dns_nameservers      | 83.166.143.51, 83.166.143.52         |
| dns_publish_fixed_ip | None                                 |
| enable_dhcp          | True                                 |
| gateway_ip           | 10.10.0.1                            |
| host_routes          |                                      |
| id                   | 71174183-0bb0-4301-86f8-4b2c856d5a27 |
| ip_version           | 4                                    |
| ipv6_address_mode    | None                                 |
| ipv6_ra_mode         | None                                 |
| name                 | mysubnet2                            |
| network_id           | 8b8cca4a-f4a2-464b-89e9-1651a69c1f79 |
| prefix_length        | 29                                   |
| project_id           | ac4fafd60021431585bbb23470119557     |
| revision_number      | 0                                    |
| segment_id           | None                                 |
| service_types        |                                      |
| subnetpool_id        | 58417028-a833-409c-86fb-a8e6e9dba514 |
| tags                 |                                      |
| updated_at           | 2021-03-17T09:31:52Z                 |
+----------------------+--------------------------------------+

Tip

See the help for more details openstack network create --help and openstack subnet create --help

Info

One IP of the pool will be reserved for the DHCP server. You can see details about IP allocated using the command openstack port list --network <YOUR_NETWORK_ID> --long