无法绑定到0.0.0.0内AWS VPC [英] Unable to bind to 0.0.0.0 inside AWS VPC

查看:640
本文介绍了无法绑定到0.0.0.0内AWS VPC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想建立一个香草的Jboss(Wildfly-8.0.0.Final)的EC2,但我相信,任何应用程序中会出现这个问题。

I am trying to set up a vanilla Jboss (Wildfly-8.0.0.Final) in EC2, although I believe any application would have this problem.

在香草Ubuntu的值得信赖的虚拟机在默认的空间,我解压,并configureit对地址,任何运行:0.0.0.0

On a vanilla ubuntu trusty VM in the default space, I unpack, and configureit to run on addr-any: 0.0.0.0.

在运行时,它成功地解决了该实例的本地IP:

At runtime, this is successfully resolved to the instance's local IP:

15:26:43167 INFO [org.hornetq.jms.server](Server服务线程池 - 59)HQ121005:无效的主机值0.0.0.0检测到HTTP连接器连接器。切换到IP-123-45-67-8.us-MY-zone.compute.internal。如果这个新的地址不正确,请手动配置连接器使用正确的。

15:26:43,167 INFO [org.hornetq.jms.server] (ServerService Thread Pool -- 59) HQ121005: Invalid "host" value "0.0.0.0" detected for "http-connector" connector. Switching to "ip-123-45-67-8.us-my-zone.compute.internal". If this new address is incorrect please manually configure the connector to use the proper one.

现在,我开球在同一台机器的AMI图像,里面一个VPC。该VPC设置了公网IP和公共DNS。路由表/安全组/等连接和配置,使得它能够ssh到使用公共DNS新的VPC实例。揭开序幕的JBoss,并不能连接到0.0.0.0:

Now, I kick off an AMI image of the same machine, inside a VPC. The VPC is set up with public IPs and public DNS. The routing table/security groups/etc are attached and configured such that it is possible to ssh to the new VPC instance using the public DNS. Kick off the jboss, and it can't connect to 0.0.0.0 :

16:28:47,603 WARN  [org.hornetq.jms.server] (ServerService Thread Pool -- 58) HQ122017: Tried to correct invalid "host" value "0.0.0.0" for "http-connector" connector, but received an exception.: java.net.UnknownHostException: ip-123-45-67-8: ip-123-45-67-8
    at java.net.InetAddress.getLocalHost(InetAddress.java:1473) [rt.jar:1.7.0_65]
    at org.hornetq.jms.server.impl.JMSServerManagerImpl.correctInvalidNettyConnectorHost(JMSServerManagerImpl.java:1883) [hornetq-jms-server-2.4.1.Final.jar:]
    at org.hornetq.jms.server.impl.JMSServerManagerImpl.internalCreateCFPOJO(JMSServerManagerImpl.java:1379) [hornetq-jms-server-2.4.1.Final.jar:]
    at org.hornetq.jms.server.impl.JMSServerManagerImpl.internalCreateCF(JMSServerManagerImpl.java:1324) [hornetq-jms-server-2.4.1.Final.jar:]
    at org.hornetq.jms.server.impl.JMSServerManagerImpl.access$1300(JMSServerManagerImpl.java:103) [hornetq-jms-server-2.4.1.Final.jar:]
    at org.hornetq.jms.server.impl.JMSServerManagerImpl$5.runException(JMSServerManagerImpl.java:1187) [hornetq-jms-server-2.4.1.Final.jar:]
    at org.hornetq.jms.server.impl.JMSServerManagerImpl.runAfterActive(JMSServerManagerImpl.java:1845) [hornetq-jms-server-2.4.1.Final.jar:]
    at org.hornetq.jms.server.impl.JMSServerManagerImpl.createConnectionFactory(JMSServerManagerImpl.java:1173) [hornetq-jms-server-2.4.1.Final.jar:]
    at org.jboss.as.messaging.jms.ConnectionFactoryService$1.run(ConnectionFactoryService.java:66) [wildfly-messaging-8.0.0.Final.jar:8.0.0.Final]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_65]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_65]
    at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_65]
    at org.jboss.threads.JBossThread.run(JBossThread.java:122) [jboss-threads-2.1.1.Final.jar:2.1.1.Final]

的变通办法是更新的/ etc / hosts文件,包括主机名: 在/ etc / hosts文件: 127.0.0.1本地主机

The work-around is to update the /etc/hosts file to include the hostname: Before /etc/hosts: 127.0.0.1 localhost

在/ etc / hosts文件: 127.0.0.1 VAL-从主机名文件本地主机

After /etc/hosts: 127.0.0.1 val-from-hostname-file localhost

什么是对内部的VPC运行不同的实例可以找到它的主机名,但没有成功绑定到它?

What is different about running inside a VPC that the instance can find its hostname, but not successfully bind to it?

推荐答案

这是最有可能的一个问题与您的VPC配置。

This is most likely an issue with your VPC configuration.

在DHCP选项设置决定了域名后缀的主机都通过DHCP给定的合格不合格的主机名时,包括自己,当他们看到他们为使用。你会看到这种配置的结果的/etc/resolv.conf

The DHCP Options Set determines the domain name suffix your hosts are given via DHCP to use when qualifying unqualified hostnames, including their own, when they look them up. You'll see the result of this configuration in /etc/resolv.conf.

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 192.0.2.2
search ec2.internal

下面, ec2.internal 在美国东-1 VPC的默认值。其他地区有不同的格式,但这些仅仅是存在于您的VPC内为目的的查找内部主机的域名。

Here, ec2.internal is the default value for VPC in US-East-1. Other regions have different formats, but these are domains that exist only within your VPC for purposes of looking up internal hosts.

在里面VPC实例(假设192.0.2.100)查找其地址的主机名,它会查找IP-192-0-2-100.ec2.internal。这是根据AWS提供的DNS服务器的一个有效的主机名,如果你有 DNS解析 DNS主机名启用VPC的配置。

When an instance inside VPC (let's say 192.0.2.100) looks up its address from its hostname, it's going to look up ip-192-0-2-100.ec2.internal. This is a valid hostname according to the AWS-provided DNS servers, if you have DNS Resolution and DNS Hostnames enabled in the VPC configuration.

如果你已经配置了设置使用自己的 example.com 域的DHCP选项,然后分配给该实例(同样的主机名,例如:IP-192-0 -2-100)必须内有效的主机名的的领域,所以ip-192-0-2-100.example.com必须是一个解析主机名,需要解析到正确的地址

If you've configured your DHCP Options set to use your own example.com domain, then the hostname assigned to the instance (again, e.g. ip-192-0-2-100) has to be a valid hostname inside that domain, so ip-192-0-2-100.example.com must be a resolvable hostname, and needs to resolve to the correct address.

http://docs.aws.amazon.com/AmazonVPC/最新/ UserGuide / VPC_DHCP_Options.html http://docs.aws.amazon.com/AmazonVPC/latest /UserGuide/vpc-dns.html

这是不是在EC2-经典的问题,因为这层基础设施配置不能更改或禁用。每个EC2经典实例可以查找自己的主机对内部 *内部域AWS提供,并得到了自己的IP。

This isn't an issue in EC2-Classic because this layer of the infrastructure configuration can't be changed or disabled. Every EC2-classic instance can look up its own hostname against the internal *.internal domain that AWS provides, and get its own IP.

当您使用此错误配置问题的另一个症状是须藤,看到须藤:无法解析主机IP-XXXX 警告。

Another symptom of this misconfiguration issue is when you use sudo and see a sudo: unable to resolve host ip-x-x-x-x warning.

这篇关于无法绑定到0.0.0.0内AWS VPC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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