5432/TCPPostgreSQL
Databases · Registered port · OSI layer 7
Connections to PostgreSQL. If the application runs on the same server, the port does not need to be open.
IANA: officially registered as postgresql
You decide which services we may enable for analytics, personalization, and external content.
We use cookies and similar technologies on our website to personalize content, embed external media, and better understand how individual areas are used.
Necessary cookies
These entries support essential functions such as security, stability, and form processing.
Optional sections
Your data may be processed with your consent or on the basis of legitimate interests. In the cookie settings, you can reject or explicitly allow each optional category.
Some services process personal data in third countries. By consenting, you also agree to this transfer. You can find more information in our Privacy Policy.
You can reopen and change your selection at any time. · 1.0.2
Port 5432 is the default port for PostgreSQL and uses TCP. This tool shows you the port details and generates firewall commands to restrict access to specific IP addresses.
Built by Justin Schuessler
Try the commands on your own VPS, with root access and your own firewall.
Add multiple ports one at a time, up to 12.
Databases · Registered port · OSI layer 7
Connections to PostgreSQL. If the application runs on the same server, the port does not need to be open.
IANA: officially registered as postgresql
Firewall commands
Open port
sudo ufw allow 5432/tcpFor Ubuntu and Debian. ufw creates the rule for both IPv4 and IPv6. If ufw is disabled, allow SSH first (sudo ufw allow 22/tcp), then enable it with sudo ufw enable, or you'll lock yourself out.
On a ZAP-Hosting VPS with an active network firewall, you also need to allow the port in the Customer Panel.
Port 5432 explained
Applications, ORMs, and clients such as psql, pgAdmin, and DBeaver connect to a PostgreSQL server over port 5432. PostgreSQL is a widely used open-source database for web applications, backends, and data analysis. If the application runs on the same system, it usually connects locally via 127.0.0.1 or a Unix socket. You only need network access to port 5432 when the database and application run on separate servers or replicas need to connect.
PostgreSQL originated from the POSTGRES research project at the University of California, Berkeley. After SQL was added as a query language, the project received its current name and has since been developed by an open community. IANA has assigned port 5432 to the “postgresql” service. It falls within the registered port range of 1024 to 49151.
Port 5432 should never be open to the entire Internet: open database ports are continually scanned and targeted with password lists. By default, PostgreSQL listens only on localhost, as specified by listen_addresses in postgresql.conf. The pg_hba.conf also controls who can log in and from where; add only your app server's IP there, using a secure method such as scram-sha-256. Allow access to port 5432 only from that address in the firewall too. An SSH tunnel is the safer choice for administration from your own computer.
More ports
These ports are often part of the same setup. Click one to see its explanation and firewall commands.
View all well-known ports and the complete IANA list
Port list source: IANA Service Name and Transport Protocol Port Number Registry, as of October 22, 2026. iana.org
Discover more
Calculate the network address, broadcast address, subnet mask, and usable host range from a CIDR address, and convert between CIDR and IP ranges (IPv4 and IPv6).
Built by Jakub Martyniak
Interactively learn the 7 layers of the OSI model: click layers, assign terms such as switch, ARP, or port 443, and explore animated encapsulation, a quiz, and a cheat sheet for the IHK exam.
Built by Justin Schuessler
Interactively learn the 4 layers of the TCP/IP model (DoD model) according to RFC 1122, with OSI model mapping, animated encapsulation, a port quiz, and a cheat sheet.
Built by Justin Schuessler
Check whether specific ports are open on an IP or hostname—select a protocol or game instead of scanning all ports at once.
Built by Sebastian Rademacher
FAQ
Quick answers about port 5432.
Only if an application on another server accesses PostgreSQL directly. If everything runs on one system, keep the port closed and connect locally. An SSH tunnel is a better option for administration from your PC.
With ufw, you can allow access specifically for your app server: sudo ufw allow from 203.0.113.10 to any port 5432 proto tcp. Add the same IP to pg_hba.conf and set listen_addresses to a reachable address. The connection will work only when all three settings are correct.
listen_addresses determines which network addresses PostgreSQL accepts connections on. The pg_hba.conf then determines which user can log in to which database, from which IP, and using which method. Both complement the firewall but do not replace it.
The connection reaches PostgreSQL, but there's no matching entry in pg_hba.conf for your combination of source IP, user and database. Add a line for that specific IP and reload the configuration. In this case, the firewall and port are already configured correctly.
Any more questions?
Contact SupportWith a ZAP-Hosting VPS, you have root access, can set up services and firewall rules yourself, and can immediately see which ports are open.
No setup. No risk. Online in seconds.
Looking for more tools? View all network tools