Technical Tip: How to close port TCP/UDP 5060 and TCP 2000
| Description | This article describes how to close ports TCP/UDP 5060 and TCP 2000. |
| Scope | FortiGate. |
| Solution | Port 2000 is the default port used by the Cisco SCCP protocol for VoIP calls. Port 5060 is the default port used by the SIP protocol for VoIP calls. Both of these ports can be changed from their defaults in their corresponding application. FortiGate needs these ports open if it is expected to pass VoIP calls to the clients.
There are two situations treated in this article. Case A: When FortiGate does not handle VoIP, and both 5060 and 2000 need to be closed. Case B: When FortiGate handles SIP (port 5060), and only port 2000 needs to be closed.
Case A: In an environment where VoIP traffic does not need to be processed by FortiGate (no SIP/SCCP calls through FortiGate), the admin would like to close these ports on FortiGate for security reasons. Closing these ports on FortiGate may also prevent calls from establishing correctly. To make FortiGate stop listening to ports TCP/UDP 5060 and TCP 2000, follow the following guide:
Disable SIP-ALG (disables port 2000 and port 5060 in proxy-mode), and delete SIP session-helper (disables port 5060 in flow mode):
config system settings config sys session-helper
In multi-VDOM FortiGates, SIP-ALG can be disabled per VDOM:
config vdom
Either clear the sessions or reboot the FortiGate to ensure that the changes take effect.
diagnose sys session filter dport 5060
Then clear the filtered sessions:
diagnose sys session clear
Note that 'diagnose sys session clear' will clear all sessions unless a session filter is applied beforehand. Clearing all sessions may interrupt live traffic.
execute reboot
Rebooting the FortiGate is often recommended by TAC, as stale sessions may occasionally remain on the device.
Case B: If the FortiGate passes SIP traffic and needs to process it (for example, on another port), the recommended action is to disable SCCP by altering the default VOIP profile (previous commands not to be used):
config voip profile config sccp end
Verification: To verify if the FortiGate stopped listening on those ports, the following commands are used.
Before:
diagnose sys tcpsock | grep 5060
diagnose sys tcpsock | grep 2000
diagnose sys udpsock | grep 5060
After:
diagnose sys tcpsock | grep 5060
If active connections are still present when filtering any tcpsock connection, verify the port number as below:
diagnose sys tcpsock | grep 5060
In this case, the open port is 2060, but this result is listed because the 'grep' command matches the 5060 value from a different field (inode=506089).
This command can improve the filtering results, limiting them to the port number:
diagnose sys tcpsock | grep ':5060'
Note: These ports will remain active on secondary IPs (if configured), unless SIP-ALG is disabled. |
