How to directly attach an IPv4 or IPv6 address to my instance
instance IP Networking CLI

How to directly attach an IPv4 or IPv6 address to my instance

Introduction

Fuga Cloud offers floating IPs and direct-attached IP addresses so your instances are remotely available for public networks (internet). You can choose between IPv4 and IPv6 addresses or use both at the same time. IPv4 is available as a direct-attached IP or as a floating IP and IPv6 is only available as direct-attached IP.

In this tutorial, we will show you how to add a direct-attached IPv4 or IPv6 address to your instance. The easiest way to do this is during the launch of your instance. You can add network interfaces after you launched your instance, but then you have to manually configure your network interface on your instance. Although that is possible it is not a road I do not recommend for most people.

When using IPv6 you can only connect (ping/ssh etc…) to that address if the host that you are connecting from also has an IPv6 address. The command ping6 ipv6_address will not work on most computers/laptops. This is because most internet providers do not support IPv6 yet and therefore do not give you an IPv6 address.

Prerequisites:

There are several ways of launching an instance with an IPv4 or IPv6 address on Fuga Cloud. You can either use the dashboard, the RESTful API or the OpenStack CLI tools.

We will describe how you can attach your IPv4 or IPv6 address using the Fuga Cloud dashboard and the OpenStack CLI tools.

Using the Dashboard

STEP 1 Launching an instance

  • Log in to the dashboard
  • Click on the Compute tab and select Instances
  • To create a new instance click on the Launch Instance button
  • Fill in all the required fields such as your instance name, the flavor you want, etc.
    • For a complete description on how to launch an instance check out our getting started tutorials
  • Click on the Networks tab and select public for an IPv4 address and public6 for an IPv6 address.
    • You can also choose both networks if you like.
  • Launch your instance.

Your new instance should now be visible including your direct-attached IP address(es) on your Instance tab

STEP 2 Adding a rule for SSH (port 22)

By default, all inbound traffic originating from the public internet is blocked. To allow inbound traffic we need to add additional ingress rules to your chosen security group if you haven’t added extra rules already.

Adding a rule for SSH (port 22)

  • Click on the Networking tab and select Security Groups
  • Click on the Manage rules button of the security group you would like to add the rule to
    • You can also create a new security group if you like
  • Click on the + Add Rule button
  • By Rule select SSH from the dropdown menu
  • By Remote select CIDR from the dropdown menu
  • By CIDR type 0.0.0.0/0 for IPv4 or type ::/0 for IPv6
  • Click on the Add button

Adding a rule for ICMP (ping)

  • Click on the Networking tab and select Security Groups
  • Click on the Manage rules button of the security group you would like to add the rule to
    • You can also create a new security group if you like
  • Click on the + Add Rule button
  • By Rule select All ICMP from the dropdown menu
  • By Remote select CIDR from the dropdown menu
  • By CIDR type 0.0.0.0/0 for IPv4 or type ::/0 for IPv6
  • Click on the Add button

Using the CLI tools

For launching an instance with the OpenStack CLI tools you’ll need to provide the following values: Instance flavor, image, network, security group, key, and an instance name.

To view all the flavors available use the following command:

openstack flavor list

To view all the networks available use the following command:

openstack network list

For a direct-attached IPv4 address choose public and for an IPv6 address choose public6

To view the images available use the following command:

openstack image list

To view the security groups available use the following command:

openstack security group list

To view the key available use the following command:

openstack keypair list

If there are no available key pairs in your list please view our tutorial How to add a key pair using the CLI tools.

STEP 1 Launching an instance

To launch a new instance with a direct attached IP use the following command: In this example both IPv4 and IPv6 will be attached.

$ openstack server create --flavor <flavor> --network public --network public6 --security-group <name_of_sc> --image <snapshot_name> --key-name <keypair_name> <name_your_instance>

You can see your newly created instance using the following command:

openstack server list

STEP 2 Add security group rules (optional)

By default, all inbound traffic originating from the public internet is blocked. To allow inbound traffic we need to add additional ingress rules to your chosen security group if you haven’t added extra rules already.

To add a rule to a specific security group for SSH you can use one of the following commands

For IPv4

openstack security group rule create <security_group_name> --protocol tcp --dst-port 22:22 --remote-ip 0.0.0.0/0

For IPv6

openstack security group rule create <security_group_name> --protocol tcp --dst-port 22:22 --remote-ip ::/0 --ethertype IPv6


For adding a security rule for ICMP (ping) you can use one of the following commands:

For IPv4

openstack security group rule create <security_group_name> --protocol icmp --remote-ip 0.0.0.0/0

For IPv6

openstack security group rule create <security_group_name> --protocol icmp --remote-ip ::/0 --ethertype IPv6

Conclusion

In this tutorial, you have learned how you can directly attach an IPv4 or IPv6 address to your instance during launch. We also showed you how you can add a security rule so that your instance can be reached from public networks (internet)

Was this article helpful?


Next article:

How to create a router in Horizon Dashboard

Introduction Fuga Cloud makes it easy to create and manage your own virtual Local Area Networks (vLAN) to physically separate your environments. Routers are used to connect different networks and forward the traffic between those networks. In this tutorial you learn how you can create a router and connect your local network to a public network (internet) using our user-friendly dashboard. Prerequisites Fuga Cloud Account An internal network

Improved performance and more features

BRAND NEW PLATFORM

Start NOW! More information