简体   繁体   English

如果使用公共IP,为什么Rundeck会重定向到AWS上的EC2专用IP?

[英]Why Rundeck redirect to ec2 private ip on aws if using public ip?

  • Public ip is: 12.34.56.78 (fake). 公用ip是: 12.34.56.78 (fake)。
  • Private ip is: 21.43.65.87 (fake). 专用ip是: 21.43.65.87 (fake)。
  • Hostname is ip-21.43.65.87 (fake). 主机名是ip-21.43.65.87 (fake)。

When access: 何时访问:

http://12.34.56.78:4440 http://12.34.56.78:4440

Redirected to: 重定向到:

http://ip-21-34-65-87:4440/menu/home HTTP:// IP-21-34-65-87:4440 /菜单/家

From the official document , there is a notice: 官方文档中 ,有一个通知:

server.http.host Address/hostname to listen on, default is all addresses "0.0.0.0"

So I tried to start rundeck using that option: 所以我尝试使用该选项启动rundeck:

java -XX:MaxPermSize=256m -Xmx1024m -jar -Dserver.http.host="12.34.56.78" rundeck-launcher-2.0.0.jar

It said can't use that address. 它说不能使用那个地址。 Why? 为什么?


Edit 编辑

After ran start command: 运行启动命令后:

        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:69)
        at com.dtolabs.rundeck.RunServer.run(RunServer.java:128)
        at com.dtolabs.rundeck.RunServer.main(RunServer.java:81)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at com.dtolabs.rundeck.ExpandRunServer.invokeMain(ExpandRunServer.java:758)
        at com.dtolabs.rundeck.ExpandRunServer.execute(ExpandRunServer.java:715)
        at com.dtolabs.rundeck.ExpandRunServer.run(ExpandRunServer.java:313)
        at com.dtolabs.rundeck.ExpandRunServer.main(ExpandRunServer.java:117)
2018-06-08 03:53:11.824:WARN:oejuc.AbstractLifeCycle:main: FAILED org.eclipse.jetty.server.Server@6fc26fb1: java.net.BindException: Cannot assign requested address
java.net.BindException: Cannot assign requested address
        at sun.nio.ch.Net.bind0(Native Method)
        at sun.nio.ch.Net.bind(Net.java:433)
        at sun.nio.ch.Net.bind(Net.java:425)
        at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
        at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
        at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:264)
        at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:69)
        at org.eclipse.jetty.server.Server.doStart(Server.java:303)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:69)
        at com.dtolabs.rundeck.RunServer.run(RunServer.java:128)
        at com.dtolabs.rundeck.RunServer.main(RunServer.java:81)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at com.dtolabs.rundeck.ExpandRunServer.invokeMain(ExpandRunServer.java:758)
        at com.dtolabs.rundeck.ExpandRunServer.execute(ExpandRunServer.java:715)
        at com.dtolabs.rundeck.ExpandRunServer.run(ExpandRunServer.java:313)
        at com.dtolabs.rundeck.ExpandRunServer.main(ExpandRunServer.java:117)
java.net.BindException: Cannot assign requested address
        at sun.nio.ch.Net.bind0(Native Method)
        at sun.nio.ch.Net.bind(Net.java:433)
        at sun.nio.ch.Net.bind(Net.java:425)
        at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
        at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
        at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:264)
        at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:69)
        at org.eclipse.jetty.server.Server.doStart(Server.java:303)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:69)
        at com.dtolabs.rundeck.RunServer.run(RunServer.java:128)
        at com.dtolabs.rundeck.RunServer.main(RunServer.java:81)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at com.dtolabs.rundeck.ExpandRunServer.invokeMain(ExpandRunServer.java:758)
        at com.dtolabs.rundeck.ExpandRunServer.execute(ExpandRunServer.java:715)
        at com.dtolabs.rundeck.ExpandRunServer.run(ExpandRunServer.java:313)
        at com.dtolabs.rundeck.ExpandRunServer.main(ExpandRunServer.java:117)

This can be due to public IPv4 addressing in AWS EC2 instances : 这可能是由于AWS EC2实例中的公共IPv4寻址

"Each instance that receives a public IP address is also given an external DNS hostname; for example, ec2-203-0-113-25.compute-1.amazonaws.com. We resolve an external DNS hostname to the public IP address of the instance outside the network of the instance, and to the private IPv4 address of the instance from within the network of the instance. The public IP address is mapped to the primary private IP address through network address translation (NAT)" “每个接收到公共IP地址的实例也将获得一个外部DNS主机名;例如ec2-203-0-113-25.compute-1.amazonaws.com。我们将外部DNS主机名解析为实例网络外部的实例,以及从实例网络内部实例的私有IPv4地址。通过网络地址转换(NAT)将公共IP地址映射到主要私有IP地址”

The IP address where Rundeck can listen are addresses configured to its network interfaces, as stated in the documentation , but not to IP addresses mapped via NAT. 文档中所述,Rundeck可以侦听的IP地址是为其网络接口配置的地址,而不是通过NAT映射的IP地址。

Furthermore, you can also force Rundeck to only use IPv4 sockets, by adding the following property when you launch the jar: -Djava.net.preferIPv4Stack=true . 此外,还可以通过在启动jar时添加以下属性来强制Rundeck仅使用IPv4套接字:-Djava.net.preferIPv4Stack = true。

Hope it helps. 希望能帮助到你。

After edit public IPs in these two config files, works well. 在这两个配置文件中编辑公共IP后,效果很好。

  • ~/rundeck/etc/framework.properties 〜/ rundeck的/ etc / framework.properties
  • ~/rundeck/server/config/rundeck-config.properties 〜/ rundeck /服务器/配置/ rundeck-config.properties

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM