- Restrict management and monitoring protocols to the monitoring network.
- Replace community strings and default credentials.
- Send logs over TLS.
Port 4020: TRAP Port
Port 4020 is assigned by IANA to trap (TRAP Port).
How trap works
Monitoring & loggingThe monitoring server collects metrics, alerts or logs from devices over port 4020.
- Transport
- TCP · UDP
- Exposure risk
- not rated depends on the program listening
- Encryption
- Unknownnot stated by the registry
- IANA status
- Assigned1 registered service
- Range
- Registered (1024-49151)
- Category
- Monitoring & logging
Is port 4020 dangerous?
We have no specific security note for port 4020. Its risk depends on the program actually listening on it. General advice for monitoring & logging services:
IANA registry entries for port 4020
| Service | Port | Transport | Description | Reference | Updated |
|---|---|---|---|---|---|
| trap | 4020 | TCP, UDP | TRAP Port | - | - |
// source: IANA service name and port number registry
Which program uses port 4020, and is it reachable?
Linux
sudo ss -ltnup 'sport = :4020' # process listening on 4020
sudo lsof -nP -i :4020macOS
sudo lsof -nP -i :4020
Windows (PowerShell)
Get-NetTCPConnection -LocalPort 4020 -State Listen | Select LocalAddress, OwningProcess Get-NetUDPEndpoint -LocalPort 4020 netstat -ano | findstr :4020
From another machine
nmap -p 4020 -sV <host> sudo nmap -sU -p 4020 <host> nc -zv <host> 4020
Block it in the firewall
sudo ufw deny 4020/tcp # Linux (ufw) New-NetFirewallRule -DisplayName "Block 4020" -Direction Inbound -LocalPort 4020 -Protocol TCP -Action Block # Windows
What is port 4020 used for?
Port 4020 is assigned by IANA to trap (TRAP Port).
Is port 4020 TCP or UDP?
Port 4020 is registered for TCP and UDP.
Is it safe to open port 4020?
It depends on the program that listens on it. Open it only for a service you know and only to the networks that need it. Restrict management and monitoring protocols to the monitoring network.
How do I check if port 4020 is open?
On Linux run "ss -ltnup 'sport = :4020'", on macOS "lsof -nP -i :4020", and on Windows "netstat -ano | findstr :4020" to see the local process. From another machine, "nmap -p 4020 <host>" shows whether it is reachable.