Windows agents are unable to connect to Jenkins

he Windows VMS connected earlier to Jenkins as an agent are in offline now and unable to connect again with error “port:49187 is not reachable”.
Jenkins version - 2.164.2
JDK - jdk1.8

Feb 20, 2024 6:02:46 PM org.jenkinsci.remoting.engine.WorkDirManager initializeWorkDir
INFO: Using C:\Jenkins\remoting as a remoting work directory
Both error and output logs will be printed to C:\Jenkins\remoting
Feb 20, 2024 6:02:46 PM hudson.remoting.jnlp.Main createEngine
INFO: Setting up agent: DPVMNLDEV1
Feb 20, 2024 6:02:46 PM hudson.remoting.jnlp.Main$CuiListener
INFO: Jenkins agent is running in headless mode.
Feb 20, 2024 6:02:46 PM hudson.remoting.Engine startEngine
INFO: Using Remoting version: 3.29
Feb 20, 2024 6:02:46 PM org.jenkinsci.remoting.engine.WorkDirManager initializeWorkDir
INFO: Using C:\Jenkins\remoting as a remoting work directory
Feb 20, 2024 6:02:47 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Locating server among [
https://jenkins.devops.com/
,

Feb 20, 2024 6:02:47 PM org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver resolve
INFO: Remoting server accepts the following protocols: [JNLP4-connect, Ping, JNLP3-connect]
Feb 20, 2024 6:02:52 PM org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver isPortVisible
WARNING: connect timed out
Feb 20, 2024 6:02:52 PM org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver resolve
INFO: Remoting server accepts the following protocols: [JNLP4-connect, Ping, JNLP3-connect]
Feb 20, 2024 6:02:53 PM org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver isPortVisible
WARNING: Connection refused: connect
Feb 20, 2024 6:02:53 PM hudson.remoting.jnlp.Main$CuiListener error
SEVERE:
https://jenkins.devops.com/
provided port:49187 is not reachable
java.io.IOException:
https://jenkins.devops.com/
provided port:49187 is not reachable
at org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver.resolve(JnlpAgentEndpointResolver.java:287)
at hudson.remoting.Engine.innerRun(Engine.java:523)
at hudson.remoting.Engine.run(Engine.java:474)
Suppressed: java.io.IOException:
https://jenkins.devops/com:8080/
provided port:49187 is not reachable
… 3 more

We have checked with network and infosec team, no changes from their end and no changes made in Jenkins or Windows VMs recently .

Few agents in same network are able to connect and few are giving above error .

Welcome back @hanuman.bandhu .

From the Jenkins controller, can you see the 49187 port of the disconnected agent (thanks to telnet or another tool)?
On the Windows Jenkins agent, is the port marked as listening?
In Windows, you can use the netstat command to check if a specific port is listening. However, this command needs to be run in the Command Prompt or PowerShell. Here’s how you can do it:

  1. Open Command Prompt or PowerShell on the agent machine.
  2. Type the following command and press Enter: netstat -ano | findstr :49187