Answers: <p>As described in Jenkins documentation <a href="https://jenkins.io/doc/book/managing/security/#jnlp-tcp-port" rel="nofollow noreferrer">https://jenkins.io/doc/book/managing/security/#jnlp-tcp-port</a>, you need to configure:</p>
  
  <ol>
  <li>Jenkins to use fixed TCP port for JNLP agent, for instance 39057</li>
  <li>AWS loadbalancer to listen on port 39057 and forward it to Jenkins on same port</li>
  </ol>
  
Answers: CC BY-SA 4.0
Answers: 2019-11-14T22:38:18.863Z
Answers: 2019-11-14T22:38:18.863Z
Answers: n4rmo
Body: <p>We've got a Linux Jenkins master node  set up in AWS behind a load balancer and I'm attempting to connect to Windows slave nodes in private subnets.  Is this possible?  The Jenkins URL is accessible when I RDP into each server, but when I attempt to configure the node using "Launch agent from browser" an error occurs.</p>
  
  <pre><code>hudson.remoting.jnlp.Main$CuiListener status
  INFO: Connecting to &lt;JenkinsURL&gt;:39057 (retrying:4)
  java.io.IOException: Failed to connect to gpa-jenkins- 
  prod.aws.baxter.com:39057
      at org.jenkinsci.remoting.engine.JnlpAgentEndpoint.open(JnlpAgentEndpoint.java:242)
      at hudson.remoting.Engine.connect(Engine.java:686)
      at hudson.remoting.Engine.innerRun(Engine.java:547)
      at hudson.remoting.Engine.run(Engine.java:469)
  Caused by: java.net.ConnectException: Connection refused: connect
      at sun.nio.ch.Net.connect0(Native Method)
      at sun.nio.ch.Net.connect(Unknown Source)
      at sun.nio.ch.Net.connect(Unknown Source)
      at sun.nio.ch.SocketChannelImpl.connect(Unknown Source)
      at java.nio.channels.SocketChannel.open(Unknown Source)
      at org.jenkinsci.remoting.engine.JnlpAgentEndpoint.open(JnlpAgentEndpoint.java:203)
      ... 3 more
  </code></pre>
  
  <p>What could be the source for this refusal? </p>
  
Comments: CC BY-SA 4.0
Comments: 2019-11-15T09:11:23.603Z
Comments: Could you explain why the jenkins-master does not reside in the same private subnet as well?
Comments: 030
Tags: <jenkins><amazon-web-services>
Title: Can Jenkins master connect to a slave node in a private subnet?
UserDisplayName: Franchise
ThreadText: # Can Jenkins master connect to a slave node in a private subnet?
  
  (Asked by: username_0 on 2019-11-14)
  
  We've got a Linux Jenkins master node set up in AWS behind a load balancer and I'm attempting to connect to Windows slave nodes in private subnets. Is this possible? The Jenkins URL is accessible when I RDP into each server, but when I attempt to configure the node using "Launch agent from browser" an error occurs.
  
  ```
  hudson.remoting.jnlp.Main$CuiListener status
  INFO: Connecting to <JenkinsURL>:39057 (retrying:4)
  java.io.IOException: Failed to connect to gpa-jenkins- 
  prod.aws.baxter.com:39057
      at org.jenkinsci.remoting.engine.JnlpAgentEndpoint.open(JnlpAgentEndpoint.java:242)
      at hudson.remoting.Engine.connect(Engine.java:686)
      at hudson.remoting.Engine.innerRun(Engine.java:547)
      at hudson.remoting.Engine.run(Engine.java:469)
  Caused by: java.net.ConnectException: Connection refused: connect
      at sun.nio.ch.Net.connect0(Native Method)
      at sun.nio.ch.Net.connect(Unknown Source)
      at sun.nio.ch.Net.connect(Unknown Source)
      at sun.nio.ch.SocketChannelImpl.connect(Unknown Source)
      at java.nio.channels.SocketChannel.open(Unknown Source)
      at org.jenkinsci.remoting.engine.JnlpAgentEndpoint.open(JnlpAgentEndpoint.java:203)
      ... 3 more
  
  ```
  
  What could be the source for this refusal?
  
  **Tags:** jenkins, amazon-web-services
  
  > **Comments:**
  > **username_1**: Could you explain why the jenkins-master does not reside in the same private subnet as well?  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2019-11-14. Score: 1
  
  As described in Jenkins documentation <https://jenkins.io/doc/book/managing/security/#jnlp-tcp-port>, you need to configure:
  
  1. Jenkins to use fixed TCP port for JNLP agent, for instance 39057
  2. AWS loadbalancer to listen on port 39057 and forward it to Jenkins on same port
  
  
  ---
  
  