gohar shah
gohar shah

Reputation: 175

How to access the openstack vm instance from external network from VM

I have the following scenario, I have two file client and server file which is containerised using docker containers. Client container is residing on a VM using a virtual box (network set using NAT and host-only adapter) and server container is residing on OpenStack VM.
The IP address of the server is 192.168.160.39 and the VM machine IP address is enp0s8:192.168.56.108. I am running the docker container client as

docker run --rm -it -p 192.168.56.108:5555:5555 client bash

and running server docker container as

docker run --rm -it -p 5555:5555 server bash 

Client.py

context = zmq.Context()
#Socket to talk to server
socket = context.socket( zmq.REQ )
socket.connect( "tcp://192.168.160.39:5555" )
name = "Max"
while True:
  message = input( "Message: " )
  socket.send_pyobj( {1: [name, message]} )

Server.py

context = zmq.Context()
socket = context.socket(zmq.REP)
socket.bind("tcp://0.0.0.0:5555")
while True:
   #Wait for next request from client
   message = socket.recv_pyobj()
   print("%s: %s" % (message.get(1)[0], message.get(1)[1]))

I am able to access OpenStack VM by ssh from my VM using ssh -J proxy-server OpenStack VM. for instance ssh -J [email protected] [email protected]

My server is unable to retrieve the data from the client. Thanks, help is highly appreciated helping me in sorting out this issue.

Upvotes: 0

Views: 913

Answers (2)

Norbert_Cs
Norbert_Cs

Reputation: 136

If you have an openstack instance id, you can find the right sec. group with:

example:

openstack server show  284c39d2-79af-485d-8f63-9ac3620cf119 | grep security_groups 

Upvotes: 1

Carlos
Carlos

Reputation: 98

Have you checked the security groups? The port in which your server is listening (5555) should be opened in the VM that is in OpenStack.

Upvotes: 0

Related Questions