wesupport

25% off on first invoice for all services*

SPRING SALE

Use coupon

*Offer valid for new customers only

25% off on first invoice for all services*

SPRING SALE

Use coupon

*Offer valid for new customers only

Need help?

Our experts have had an average response time of 11.43 minutes in March 2024 to fix urgent issues.

We will keep your servers stable, secure, and fast at all times for one fixed price.

Steps to create OpenStack instance with a Fixed/Static IP address

by | Oct 28, 2020

Webmasters can create an instance with a fixed static IP address in OpenStack by using network ports.

As a part of our Server Management Services, we help our Customers with OpenStack related requests regularly.

Let us today discuss the steps to create an OpenStack instance with a Fixed or Static IP address.

How to create OpenStack instance with a Fixed/Static IP address?

In an OpenStack Cloud environment, the default IP assignment mechanism is through DHCP. We can assign a fixed static IP address in OpenStack by creating ports and adding them to the instance.

A port is a connection point for attaching a single device, such as the NIC of a server, to a network.

The port also describes the associated network configuration, such as the MAC and IP addresses to be used on that port.

Let us now discuss the steps to perform this task.

 

Create a network port

Use the command openstack port create to create a new port on the specified network.

Let us see all available command arguments.

$ openstack port create --help
.....
openstack port create --help
usage: openstack port create [-h] [-f {json,shell,table,value,yaml}]
[-c COLUMN] [--noindent] [--prefix PREFIX]
[--max-width <integer>] [--fit-width]
[--print-empty] --network <network>
[--description <description>]
[--device <device-id>]
[--mac-address <mac-address>]
[--device-owner <device-owner>]
[--vnic-type <vnic-type>] [--host <host-id>]
[--dns-name dns-name]
[--fixed-ip subnet=<subnet>,ip-address=<ip-address> | --no-fixed-ip]
[--binding-profile <binding-profile>]
[--enable | --disable] [--project <project>]
[--project-domain <project-domain>]
[--security-group <security-group> | --no-security-group]
[--qos-policy <qos-policy>]
[--enable-port-security | --disable-port-security]
[--allowed-address ip-address=<ip-address>[,mac-address=<mac-address>]]
[--tag <tag> | --no-tag]
<name>
......

Further to list available networks and subnets use the command below:

$ openstack network list
+--------------------------------------+---------+--------------------------------------+
| ID | Name | Subnets |
+--------------------------------------+---------+--------------------------------------+
| b94431cb-08cf-42ea-be61-55f5cf459276 | private | 57601b99-ea64-41a8-a927-fbd591ae3f2b |
| f7ccac3b-73eb-49bf-a4ec-af750216b819 | public | 7536e4a8-6aa8-45dc-aed6-1a98afcf416d |
+--------------------------------------+---------+--------------------------------------+

$ openstack subnet list --network private
+--------------------------------------+----------------+--------------------------------------+--------------+
| ID | Name | Network | Subnet |
+--------------------------------------+----------------+--------------------------------------+--------------+
| 57601b99-ea64-41a8-a927-fbd591ae3f2b | private_subnet | b94431cb-08cf-42ea-be61-55f5cf459276 | 10.10.1.0/24 |
+--------------------------------------+----------------+--------------------------------------+--------------+

Now, create a port with a fixed IP address on the private network.

openstack port create --network private --fixed-ip \
subnet=private_subnet,ip-address=10.10.1.20 server1-port0

Confirm port creation:

$ openstack port list
$ openstack port show server1-port0

 

Create a Server with fixed IP in OpenStack

Now that the port is created, we can boot a new instance with a preserved IP address.

openstack server create \
--image CentOS-7 \
--flavor m1.small \
--security-group 7fffea2a-b756-473a-a13a-219dd0f1913a \
--port server1-port0 \
server1

After creation, we may receive output as below:

create OpenStack instance

Now, check server status with the command below:

$ openstack server show server1

We should be able to reach the new server that we created with a fixed IP.

$ ping -c 2 10.10.1.20
PING 10.10.1.20 (10.10.1.20) 56(84) bytes of data.
64 bytes from 10.10.1.20: icmp_seq=1 ttl=64 time=0.768 ms
64 bytes from 10.10.1.20: icmp_seq=2 ttl=64 time=0.491 ms
--- 10.10.1.20 ping statistics ---

$ ssh centos@10.10.1.20
Warning: Permanently added '10.10.1.20' (ECDSA) to the list of known hosts.
Enter passphrase for key '/home/centos/.ssh/id_rsa':
[centos@server1 ~]$ ip ad
1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: mtu 1450 qdisc pfifo_fast state UP group default qlen 1000
link/ether fa:16:3e:a3:fd:ce brd ff:ff:ff:ff:ff:ff
inet 10.10.1.20/24 brd 10.10.1.255 scope global dynamic eth0
valid_lft 86035sec preferred_lft 86035sec
inet6 fe80::f816:3eff:fea3:fdce/64 scope link
valid_lft forever preferred_lft forever

[Need any further assistance to create OpenStack instance? – We’re available 24*7]

Conclusion

In short, we can assign a fixed static IP address in OpenStack by creating ports and adding them to the instance. Today, we saw how our Support Engineers create OpenStack instances with fixed IP.

 

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Categories

Tags