连接拒绝Azure Linux虚拟机中的API响应 [英] Connection Refused API Response in Azure Linux Virtual Machine

查看:107
本文介绍了连接拒绝Azure Linux虚拟机中的API响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力从基于Azure的CentOs虚拟机中运行的docker容器获取API响应。我正在运行一个正在侦听端口14265的docker应用程序,我已经使用以下命令验证了它们:

I am struggling to get an API response from a docker container running in my Azure based CentOs Virtual machine. I am running a docker application that is listening to port 14265, which I have verified to be listening using the commands:

sudo lsof -i -P -n | grep LISTEN

lsof:没有UID 101的pwd条目
docker-pr 77061     根    4U  IPv6 571800      0t0  TCP *:14265(听到)

lsof: no pwd entry for UID 101
docker-pr 77061     root    4u  IPv6 571800      0t0  TCP *:14265 (LISTEN)

sudo netstat -tnlp | grep:14265
tcp6        0      0 ::: 14265                ::: *                    LISTEN      96593 / docker-proxy

sudo netstat -tnlp | grep :14265
tcp6       0      0 :::14265                :::*                    LISTEN      96593/docker-proxy

在连接到虚拟机的网络安全组中,我创建了一些入站端口规则来打开端口14265,80和443。在VM本身我也更新了防火墙,所以它返回这个(编辑其他端口):

In the Network Security Group attached to the Virtual Machine I have created a few Inbound port rules to open Port 14265, 80 and 443. On the VM itself I also updated the firewall so it returns this (redacting other ports):

sudo firewall-cmd --list-all
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: eth0
  sources:
  services: ssh dhcpv6-client
  ports: 80/tcp 443/tcp 14265/tcp
  protocols:
  masquerade: no
  forward-ports:
  source-ports:
  icmp-blocks:
  rich rules:

但是当我发送POST请求时,我得到以下回复:

However when I send a POST request I get the following response:

Rebuilt URL to: https://[DOMAIN]:14265/
  Trying [PUBLIC IP]...
Name '0.0.0.0' family 2 resolved to '0.0.0.0' family 2
Local port: 0
connect to [PUBLIC IP] port 14265 failed: Connection refused
Failed to connect to [DOMAIN] port 14265: Connection refused
Closing connection 0


我还必须打开其他端口来访问Web界面,这些界面在不同的端口上运行良好。有没有人知道下一步要做什么来解决这个问题? 

I also had to open other ports to access web interfaces, which are working perfectly fine on different ports. Does anyone have an idea what to do next in order to fix this? 




推荐答案

 

Hi, 

我会开始通过以下故障排除步骤:

I would start with the following troubleshooting steps:


  1. 使用  https://ping.eu/port-chk/  (使用IP和端口代替域名进行测试)
  2. 如果是,那么请小提琴手检查你得到的回复是什么,我们可以从那里拿走。 
  3. 如果否,那么请确保你在网卡和子网上都打开了NSG
  1. Check whether port is open from Internet using https://ping.eu/port-chk/ (Use IP and port instead of domain name for testing purpose)
  2. If yes, then take a fiddler to check what is the response you are getting and we can take it from there. 
  3. If No, then make sure you opened NSG on both NIC as well as Subnet

如果您有任何问题,请告诉我。

Let me know if you have any questions.

问候,

Msrini


这篇关于连接拒绝Azure Linux虚拟机中的API响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆