我想在Bluemix Secure Gateway中使用主机名而不是IP地址作为目标主机。我使用docker Secure Gateway客户端。我试图通过编辑安装了Docker Secure Gateway客户端的主机的/ etc / hosts并通过--net =“host”或--add-host = hosname:IP地址运行SG Client来实现这一点。关于以下问答,安全网关服务似乎不使用DNS,因此我尝试使用/ etc / hosts。
How to resolve SG Client's ENOTFOUND error
但是我无法成功,SG客户获得了ENOTFOUND。您能否教我如何使Secure Gateway Client解析目标主机的主机名。
[--net =“host”的结果]
#ping httpserver1 PING httpserver1 (192.168.56.1) 56(84) bytes of data. 64 bytes from httpserver1 (192.168.56.1): icmp_seq=1 ttl=128 time=7.10 ms 64 bytes from httpserver1 (192.168.56.1): icmp_seq=2 ttl=128 time=6.89 ms
# docker run -it ibmcom/secure-gateway-client XXXXXXXXXX --net=“host“
IBM Bluemix Secure Gateway Client Version 1.2.1
[2015-07-08 15:47:01.097] [INFO] The Secure Gateway tunnel is connected
#[2015-07-08 15:47:01.097] [INFO] The Secure Gateway tunnel is connected
[2015-07-08 15:57:08.588] [INFO] Connection #3 is being established to httpserver1:3000
[2015-07-08 15:57:16.602] [ERROR] Connection #3 to destination httpserver1:3000 had error: ENOTFOUND
[2015-07-08 15:57:16.603] [INFO] Connection #3 to httpserver1:3000 was closed
* SG似乎支持SG文档的--net =“host”,但似乎不能很好地工作。
https://www.ng.bluemix.net/docs/troubleshoot/SecureGateway/ts_index.html#ts_sg
[--add-host = httpserver1:192.168.56.1的结果]
#docker run -it ibmcom/secure-gateway-client XXXXXXXXXX --add-host="httpserver1:192 .168.56.1" IBM Bluemix Secure Gateway Client Version 1.2.1 [2015-07-08 16:09:20.028] [INFO] The Secure Gateway tunnel is connected
[2015-07-08 16:09:37.214] [INFO] Connection #5 is being established to httpserver1:3000 [2015-07-08 16:09:45.231] [ERROR] Connection #5 to destination httpserver1:3000 had error: ENOTFOUND [2015-07-08 16:09:45.232] [INFO] Connection #5 to httpserver1:3000 was closed
最佳答案
我认为,使它在本地工作的唯一方法是让内部IT小组将该主机的名称添加到DNS。请记住,对/ etc / hosts文件的更新在本地范围内,没有其他机器会使用该信息将您的主机名解析为该IP。在这种情况下,您要让Bluemix中的Secure Gateway服务器查找您在自己的类C / D子网中本地定义的内容,如果没有DNS更改,它将无法做到这一点。
另一种选择是尝试使用docker'--dns'参数,提供可访问的DNS的IP地址。
关于docker - 如何使Secure Gateway Client解析目标主机的主机名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31303259/