Search Our Database

How to Setup a Private IP on Openstack Instances

Last updated on |
by

Newly generated instances on Openstack are not connected to each other on a private network. After setting up the private network on the portal, a new network interface must be configured on the Openstack instance. This will allow the instances to connect to each other using a private IP.

This guide is applicable for Linux instances created on Openstack.

Windows instances do not require any further configurations after after the Network interface is attached to the instance, and will be connected to the private network automatically.

 

Setting up a Network Interface on RHEL Based Distros

Check the existing network interfaces:

ip addr

 

In this example, we have attached our private network interface to the instance before hand. Upon running ip addr, we can see that the private network interface has been added as eth1.

Create a new network interface for the private IP.

cd /etc/sysconfig/network-scripts
sudo vi ifcfg-eth1

Configure the network interface to use DHCP by adding the following config into the network interface script.

BOOTPROTO=dhcp
DEVICE=eth1
MTU=1500
NETMASK=255.255.255.0
ONBOOT=yes
STARTMODE=auto
TYPE=Ethernet
USERCTL=no

 

Restart the network service.

sudo service network restart

 

Confirm that the new network interface has been configured.

ip addr

 

In our example below, the new network interface, eth1 is up and running with a private IP address.

Setting up a Network Interface on Debian Based Distros

Check the existing network interfaces:

ip addr

 

In this example, we have attached our private network interface to the instance before hand. Upon running ip addr, we can see that the private network interface has been added as ens6.

We will configure a new network interface for the private network setup by editing the existing netplan configuration in the file /etc/netplan/50-cloud-init.yaml. Add in the following configuration.

ens6:
# If your network interface is different from ens6, add the correct interface name instead.
dhcp4: true
mtu: 1500

 

Your netplan configuration file should look like this after the changes:

Apply the netplan configuration.

sudo netplan apply

 

Confirm that the new network interface has been configured.

ip addr

 

Our example shows that the private network interface, ens6, has been assigned the private IP address 192.168.10.9.