Our openstack clouds are set up with addressing-resources allowing us to assign IPv6-prefixes to openstack-internal networks. The IPv6-addresses assigned will be globally unique, and also globally reachable. The following page guides you through the steps needed to get globally routed IPv6-addresses on your openstack network.

Using the web interface

As there are services within openstack which requires IPv4 to work (cloud-init) it is a good idea to dual-stack when you need IPv6. The first steps would thus be to create a network with an IPv4 subnet.

Create a network with an IPv4 subnet

In horizon, navigate to "Network" → "Networks" and click the "Create Network" button.

Give the network a sensible name in the "Network" tab, and navigate to the "Subnet" tab to give the subnet a name and some IP-addresses.

After the network is created, it should be visible in the "Networks" list

Create an IPv6 subnet

To add an IPv6 subnetyou first need to open the networks-page (picture above) and click on the network-name of the network where you want IPv6. Select the "Subnet" tab, and click the "create subnet" button.

Give the new subnet a sensible name. In the "Network ADdress Source" you would need to select "Allocate Network ADdress from a pool". After selecting that you are able to select the "selfservice-ipv6" pool. At the "Subnet Details" tab you should make sure to select the "SLAAC: ADdress discovered from Openstack Routers" address configuration mode, as most of our images expects to be able to use SLAAC.

After creating the second subnet you should see both the IPv4 and IPv6 subnet at the Network page.


Connect the subnetworks to the rest of the world.

To actually use the recently created networks you would need to connect them to the world. This can be acheved through creating a router. Navigate to "Network" → "Routers" and click the "Create Router" button.

Give the router a sensible name, select an External network, and click the "Create Router" button.

After the router is created, it is visible in horizon. Click the router's name to open its configuration-page.

Use the "Add Interface" button to connect the router to a subnet.

Make sure to connect the router to both the ipv4 and the ipv6 subnet.

When the status-screen shows both the interfaces as "Active" you are finished.

At that point it is possible for you to ping the routers IP within your subnet.

VM's in this subnet will now get an IPv6 address. If the security-group of the VM allows IPv6-access you should be able to reach it through IPv6.

Using the command line clients

Creating an IPv4 subnet, and give it external access

When creating a network in openstack using the cli clients; it is common to do something like so:

Create network and IPv4 subnet
$ openstack network create DemoNet
$ openstack subnet create --subnet-range 192.168.1.0/24 --network DemoNet DemoNet-v4
$ openstack router create DemoRouter
$ openstack router set --external-gateway ntnu-internal DemoRouter
$ openstack router add subnet DemoRouter DemoNet-v4

The essence is that we create a network (DemoNet), and to this network we create a subnet (DemoNet-v4) for IPv4 addresses. This subnet is using local RFC 1918 addresses. We then create a router (DemoRouter), which we use to connect the subnet to the rest of the world (ext-net). To "hide" our local addresses, the router would run NAT.

Creating an IPv6 subnet

There are one important key difference between the IPv4 and the IPv6 subnets; IPv4 uses local addresses which allows you to select whichever addresses you like while still being able to route traffic externally using NAT. In IPv6 we use global addresses; which means that each virtual network in the cloud needs unique addresses. This allows the virtual machines to get global addresses directly, and it removes the need for NAT.

As the IPv6 addresses are globally unique you cannot assign them manually; but you will need to get then assigned to you by openstack. To see if your openstack-platform have addresses for assignment you can use the following command:

Show IPv6 subnet pool
$ openstack subnet pool list
+--------------------------------------+------------------+-------------------------+
| ID                                   | Name             | Prefixes                |
+--------------------------------------+------------------+-------------------------+
| 776f3d48-f65c-40fc-8eeb-115f2d060195 | selfservice-ipv6 | 2001:700:1d00:ea00::/55 |
+--------------------------------------+------------------+-------------------------+

To create a IPv6 subnet named "DemoNet-v6" attached to the network "DemoNet" with addresses from the subnet-pool "selfservice-ipv6"  you would use the following command:

Create an IPv6 subnet
$ openstack subnet create --subnet-pool selfservice-ipv6 --ip-version 6 --ipv6-ra-mode slaac --ipv6-address-mode slaac --network DemoNet DemoNet-v6
+----------------------+-----------------------------------------------------------------------------------------------------+
| Field                | Value                                                                                               |
+----------------------+-----------------------------------------------------------------------------------------------------+
| allocation_pools     | 2001:700:1d00:ea07::2-2001:700:1d00:ea07:ffff:ffff:ffff:ffff                                        |
| cidr                 | 2001:700:1d00:ea07::/64                                                                             |
 ...
| gateway_ip           | 2001:700:1d00:ea07::1                                                                               |
 ...
| id                   | 97c4f25a-0765-4d55-918c-39b762500264                                                                |
| ip_version           | 6                                                                                                   |
| ipv6_address_mode    | slaac                                                                                               |
| ipv6_ra_mode         | slaac                                                                                               |
 ...
| name                 | DemoNet-v6                                                                                          |
| network_id           | 24722854-3af0-45f7-b562-d5c1174f51d6                                                                |
 ...
+----------------------+-----------------------------------------------------------------------------------------------------+

At this point you have an IPv6 subnet which is addressed using an assigned IPv6 prefix.

Connecting an IPv6 subnet to the world.

The IPv6 subnet is connected to the world using a router; the same way as IPv4 subnets. When an IPv6 network is connected to a router (which has an external gateway set), the router will make sure to announce the connected IPv6 subnet to the rest of the NTNU Network.

Add external routing to IPv6 subnet
$ openstack router add subnet DemoRouter DemoNet-v6

Verify the configuration

After connecting the IPv6 subnet to an external router the network should be globally reachable quite quickly. You can verify that the network is reachable by pinging the first address in the subnet:

Verify the configuration
$ ping 2001:700:1d00:ea07::1
PING 2001:700:1d00:ea07::1(2001:700:1d00:ea07::1) 56 data bytes
64 bytes from 2001:700:1d00:ea07::1: icmp_seq=1 ttl=60 time=19.9 ms

Configuring incoming access over IPv6

After an IPv6 subnet is created it is important to update the access groups if one wants to allow external access to the virtual machines over IPv6.

Allow incoming SSH

To allow any host at NTNU in Gjøvik to log in to your virtual machines over SSH you would need to add the following rule to the security-group assigned to the VM (The examples adds the rule to the group 'default'):

Allow incoming SSH
 $ openstack security group rule create --src-ip '2001:700:1d00::/48'  --dst-port 22 --ethertype IPv6 --protocol tcp default

It is important to emphasize that the IPv6 addresses are global routable. This means that they are "directly" connected to the internet. It is thus important with proper firewalling. You should therfore ONLY open what is needed trough the security groups, to the addresses needed. For example should SSH (TCP port 22) only be opened for networks which needs to log in to your VM's.

IPv6 address prefixes

NTNU uses the following IPv6 prefixes:

  • 2001:700:300::/46 - NTNU i Trondheim
  • 2001:700:b00::/48 - NTNU i Trondheim (Gamle HiST)
  • 2001:700:1d00::/48 - NTNU i Gjøvik
  • 2001:700:1200::/48 - NTNU i Ålesund
  • No labels