简体   繁体   中英

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

  • Public ip is: 12.34.56.78 (fake).
  • Private ip is: 21.43.65.87 (fake).
  • Hostname is ip-21.43.65.87 (fake).

When access:

http://12.34.56.78:4440

Redirected to:

http://ip-21-34-65-87:4440/menu/home

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:

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 :

"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)"

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.

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 .

Hope it helps.

After edit public IPs in these two config files, works well.

  • ~/rundeck/etc/framework.properties
  • ~/rundeck/server/config/rundeck-config.properties

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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