[英]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.我有以下场景,我有两个文件客户端和服务器文件,它们使用 docker 容器进行容器化。 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.
客户端容器驻留在使用虚拟机(使用 NAT 和仅主机适配器的网络集)的 VM 上,而服务器容器驻留在 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.服务器的IP地址为192.168.160.39,VM机器IP地址为enp0s8:192.168.56.108。 I am running the docker container client as
我正在运行 docker 容器客户端
docker run --rm -it -p 192.168.56.108:5555:5555 client bash
and running server docker container as并将服务器 docker 容器作为
docker run --rm -it -p 5555:5555 server bash
Client.py客户端.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服务器.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.我可以使用 ssh -J 代理服务器 OpenStack VM 通过 ssh 从我的 VM 访问 OpenStack VM。 for instance ssh -J 4020343@hpdc.xxx.xx ubuntu@192.168.160.39
例如 ssh -J 4020343@hpdc.xxx.xx ubuntu@192.168.160.39
My server is unable to retrieve the data from the client.我的服务器无法从客户端检索数据。 Thanks, help is highly appreciated helping me in sorting out this issue.
谢谢,非常感谢帮助我解决这个问题。
If you have an openstack instance id, you can find the right sec.如果你有一个 openstack 实例 ID,你可以找到正确的秒。 group with:
分组:
example:例子:
openstack server show 284c39d2-79af-485d-8f63-9ac3620cf119 | grep security_groups
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.
服务器正在侦听的端口 (5555) 应该在 OpenStack 中的 VM 中打开。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.