title: Unable to connect local slave to Jenkins master on AWS
body: <p>I've set-up a Jenkins on AWS ec2 instance. I have a few machines with me (Ubuntu, Mac) which are supposed to be the slaves.</p>
  
  <p>I've configured the nodes on my Jenkins master and I'm trying to connect the slaves using JNLP-4 protocol via random ports.</p>
  
  <p>I've enabled the Security, Selected the TCP Ports for agents as Random, Enable CLI over remoting, Enable Agent -> Master Access control.</p>
  
  <p>After doing all these, when I try to connect I get the following error:</p>
  
  <pre><code>Vighneshs-MBP:Downloads vighneshpai$ java -jar agent.jar -jnlpUrl https://my.host.name/computer/Mac/slave-agent.jnlp -secret cf400d1a4e0a1dcc75da2b361efafbce3321e17b935bdcf14350a36e
  Oct 11, 2018 8:43:50 PM hudson.remoting.jnlp.Main createEngine
  INFO: Setting up agent: Mac
  Oct 11, 2018 8:43:50 PM hudson.remoting.jnlp.Main$CuiListener &lt;init&gt;
  INFO: Jenkins agent is running in headless mode.
  Oct 11, 2018 8:43:50 PM hudson.remoting.Engine startEngine
  INFO: Using Remoting version: 3.25
  Oct 11, 2018 8:43:50 PM org.jenkinsci.remoting.engine.WorkDirManager initializeWorkDir
  INFO: Using /Users/vighneshpai/Downloads/remoting as a remoting work directory
  Both error and output logs will be printed to /Users/vighneshpai/Downloads/remoting
  Oct 11, 2018 8:43:50 PM hudson.remoting.jnlp.Main$CuiListener status
  INFO: Locating server among [https://my.host.name/]
  Oct 11, 2018 8:43:51 PM org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver resolve
  INFO: Remoting server accepts the following protocols: [JNLP4-connect, JNLP-connect, Ping, JNLP2-connect, JNLP3-connect]
  Oct 11, 2018 8:43:56 PM org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver isPortVisible
  WARNING: connect timed out
  Oct 11, 2018 8:43:56 PM hudson.remoting.jnlp.Main$CuiListener error
  SEVERE: https://my.host.name/ provided port:49187 is not reachable
  java.io.IOException: https://my.host.name/ provided port:49187 is not reachable
      at org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver.resolve(JnlpAgentEndpointResolver.java:286)
      at hudson.remoting.Engine.innerRun(Engine.java:523)
      at hudson.remoting.Engine.run(Engine.java:474)
  </code></pre>
  
  <p>I've also tried using a Fixed port and add the port to the allowed list of ports for Inbound access. Still not able to connect.</p>
  
  <p>Same machines, without any problem connected to the Jenkins running on local machine.</p>
  
  <p>What could be the problem?</p>