Ask Your Question
0

Connecting To Instance With Private IP [closed]

asked 2014-06-19 05:49:28 -0500

rahulrajvn gravatar image

Hi ,

I was able to set up the Open-stack Environment correctly. Now I am able to make an instance, give that instance an floating IP and connect to that instance from the Public Network using that Public IP(floating IP ). One of my doubt is that, is there a way to access the instance with its Private IP from any of the nodes(controller, network , compure).

I have read that in openstack we can make same internal network for different projects. If this is the case will it be able to access the Instance using private IP.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by rahulrajvn
close date 2014-06-20 11:40:49.221017

1 answer

Sort by ยป oldest newest most voted
1

answered 2014-06-19 06:08:11 -0500

dbaxps gravatar image

updated 2014-06-19 06:15:25 -0500

Create an internal network under a tenant network
(ostenant). Source the keystone user's credentials:

  $ . keystonerc_user

Create a router attached to the external network. This router routes
traffic to the internal subnets

  $ neutron router-create router1
  Created a new router:
  +-----------------------+--------------------------------------+
  | Field                 | Value                                |
  +-----------------------+--------------------------------------+
  | admin_state_up        | True                                 |
  | external_gateway_info |                                      |
  | id                    | d72adddf-4c02-4916-ae6d-16bfdaf59d99 |
  | name                  | router1                              |
  | status                | ACTIVE                               |
  | tenant_id             | 2c845a6ad20e45ccb0b045cee27a9661     |
  +-----------------------+--------------------------------------+

Connect the router to ext by setting the gateway for the router as ext

  $ neutron router-gateway-set router1 ext
  Set gateway for router router1

Create an internal network and its associated subnet

  $ neutron net-create int
  Created a new network:
  +----------------+--------------------------------------+
  | Field          | Value                                |
  +----------------+--------------------------------------+
  | admin_state_up | True                                 |
  | id             | 1a4157a6-5cf2-46e3-bdea-1533c8f54cdf |
  | name           | int                                  |
  | shared         | False                                |
  | status         | ACTIVE                               |
  | subnets        |                                      |
  | tenant_id      | 2c845a6ad20e45ccb0b045cee27a9661     |
  +----------------+--------------------------------------+

  $ neutron subnet-create int 30.0.0.0/24 --dns_nameservers list=true  8.8.8.8

  Created a new subnet:
  +------------------+--------------------------------------------+
  | Field            | Value                                      |
  +------------------+--------------------------------------------+
  | allocation_pools | {"start": "30.0.0.2", "end": "30.0.0.254"} |
  | cidr             | 30.0.0.0/24                                |
  | dns_nameservers  | 8.8.8.8                              |
  | enable_dhcp      | True                                       |
  | gateway_ip       | 30.0.0.1                                   |
  | host_routes      |                                            |
  | id               | 04b95f13-cc77-4f9a-8206-7f6ed183461d       |
  | ip_version       | 4                                          |
  | name             |                                            |
  | network_id       | 1a4157a6-5cf2-46e3-bdea-1533c8f54cdf       |
  | tenant_id        | 2c845a6ad20e45ccb0b045cee27a9661           |
  +------------------+--------------------------------------------+

Connect the above subnet to the router by setting it as a port

  $ neutron router-interface-add router1 \
  04b95f13-cc77-4f9a-8206-7f6ed183461d
  Added interface 63ea2815-b524-4a12-931d-3e7db60ea170 to router router1.


List subnets (as keystonerc_user)

  $ neutron subnet-list
  +--------------------------------------+------+-------------+--------------------------------------------+
  | id                                   | name | cidr        | allocation_pools                           |
  +--------------------------------------+------+-------------+--------------------------------------------+
  | 04b95f13-cc77-4f9a-8206-7f6ed183461d |      | 30.0.0.0/24 | {"start": "30.0.0.2", "end": "30.0.0.254"} |
  +--------------------------------------+------+-------------+--------------------------------------------+
edit flag offensive delete link more

Comments

Next create VM sourcing same credentials . This VM is supposed to get private IP from defined subnet via DHCP.

dbaxps gravatar imagedbaxps ( 2014-06-19 06:10:32 -0500 )edit

ok, So we need to create an internal network and connect it to a router which has the gate way set to external network. Pls Correct me if I am Wrong..

rahulrajvn gravatar imagerahulrajvn ( 2014-06-19 06:23:40 -0500 )edit

You are correct. Following bellow sample just done on working multi-node system , for tenant with private network 40.0.0.0/24

[root@icehouse1 ~(keystone_boris)]# neutron net-list
+--------------------------------------+---------+-----------------------------------------------------+
| id                                   | name    | subnets                                             |
+--------------------------------------+---------+-----------------------------------------------------+
| 8b22b262-c9c1-4138-8092-0581195f0889 | private | 06530f5a-31af-4a14-a40f-808ee2e9e3ad 40.0.0.0/24    |
| 295a5bba-c219-407f-830d-911cd2214349 | public  | c8421c61-7d85-4cf8-a5c8-03c05982bff9 192.168.1.0/24 |
+--------------------------------------+---------+-----------------------------------------------------+
[root@icehouse1 ~(keystone_boris)]# ip netns | grep 8b22b262-c9c1-4138-8092-0581195f0889
qdhcp-8b22b262-c9c1-4138-8092-0581195f0889
[root@icehouse1 ~(keystone_boris)]# ps -ef | grep dnsmasq
nobody    2983     1  0 05:32 ?        00:00:00 /sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf
nobody   13774     1  0 14:52 ?        00:00:00 dnsmasq --no-hosts --no-resolv --strict-order --bind-interfaces --interface=tap707ec6ff-71 --except-interface=lo --pid-file=/var/lib/neutron/dhcp/8b22b262-c9c1-4138-8092-0581195f0889/pid --dhcp-hostsfile=/var/lib/neutron/dhcp/8b22b262-c9c1-4138-8092-0581195f0889/host --addn-hosts=/var/lib/neutron/dhcp/8b22b262-c9c1-4138-8092-0581195f0889/addn_hosts --dhcp-optsfile=/var/lib/neutron/dhcp/8b22b262-c9c1-4138-8092-0581195f0889/opts --leasefile-ro --dhcp-range=set:tag0,40.0.0.0,static,86400s --dhcp-lease-max=256 --conf-file=/etc/neutron/dnsmasq.conf --domain=openstacklocal
root     16975 15815  0 15:35 ...
(more)
dbaxps gravatar imagedbaxps ( 2014-06-19 06:38:54 -0500 )edit

Thank you. :)

rahulrajvn gravatar imagerahulrajvn ( 2014-06-19 06:45:51 -0500 )edit

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2014-06-19 05:49:28 -0500

Seen: 1,477 times

Last updated: Jun 19 '14