Bobcares

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 *

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

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF