Skip to main content

NATS Ports and Firewall Requirements

The JAMS NATS server uses two TCP ports.

PortPurposeBound toFirewall
4222Client connections from the JAMS servicesAll interfaces once TLS is configuredOpen between failover nodes. Not needed on a single server.
8222Read-only HTTP monitoring endpoint127.0.0.1 onlyLeave closed.

Port 4222 replaces MSMQ port 1801, which earlier versions needed between the nodes of a failover pair. Port 1801 is no longer used and its firewall rule can be removed.

info

These are the only ports the move to NATS adds or changes. Every other JAMS port is the same. See JAMS TCP/IP Ports for the full list.

Single-Server Installations​

No firewall change is needed. All NATS traffic stays on the machine.

Failover Installations​

Allow inbound TCP 4222 on both nodes. Each node runs its own NATS server, and each node's JAMS services connect to the other node's server, so the rule is needed in both directions.

New-NetFirewallRule -DisplayName "JAMS NATS Server" `
-Direction Inbound -Protocol TCP -LocalPort 4222 -Action Allow

Check from each node that it can reach the other:

Test-NetConnection <OtherNodeName> -Port 4222
4222 on its own is not enough

The failover control port, 4773 by default, set by Port in Failover.config, must also be open between the nodes. A passive node learns which node holds control over that channel, and it only forwards messages once it knows. If 4773 is blocked, nothing is forwarded no matter how open 4222 is.

caution

If 4222 is blocked, JAMS does not fail loudly. Each node's own messaging keeps working, but messages cannot cross between nodes. Work committed on the passive node does not reach the active Scheduler until that node is promoted. Check both ports before putting a pair into production. See NATS in a Failover Environment.

Why 4222 Is Sometimes Loopback Only​

The address NATS listens on depends on whether TLS has been set up:

  • Certificates present. NATS binds 0.0.0.0:4222, all interfaces. Every client must present a certificate signed by the JAMS root CA. This is the normal state after a successful install.
  • Certificates absent. NATS binds 127.0.0.1:4222, this machine only.

Without certificates there is no authentication, so JAMS refuses network connections rather than accepting them unauthenticated. If a failover node cannot reach its peer and the firewall is open, check that TLS was set up on the peer. See NATS TLS Certificates.

The Monitoring Port​

Port 8222 serves a read-only status endpoint on the loopback interface. Nothing can be changed through it and no message contents are exposed. You must be signed in to the machine to reach it:

Invoke-RestMethod http://127.0.0.1:8222/varz

It has no authentication, so leave it on loopback. See Monitoring the NATS Server.

Changing the Ports​

Both ports can be changed if they conflict with other software. See Configuring the NATS Server.