SIP pinholes
When SIP ALG processes a SIP call, it usually opens pinholes for SIP signaling and RTP/RTCP packets. NAT usually takes place during the process at both the network and SIP application layers. SIP ALG ensures that, with NAT happening, corresponding SIP and RTP/RTCP pinholes are created during the process when it is necessary for call sessions to be established through FortiOS devices.
By default, SIP ALG manages pinholes automatically, but some special configurations can be used to restrict the pinholes if required.
SIP pinhole restriction
The strict-register
attribute is enabled by default. When enabled, after a SIP endpoint registers to the SIP server through a firewall policy on the FortiGate, only the SIP messages sent from the same IP address as the SIP server are allowed to pass through the SIP pinhole that is created in the FortiGate to reach the SIP endpoints. If the attribute is disabled, SIP messages from any IP addresses can pass through the pinhole created after the registration.
SIP pinhole restriction is only supported by SIP ALG and in proxy mode. |
To configure registrar connection ability:
config voip profile edit <name> config sip set strict-register {enable | disable} end next end
RTP/RTCP pinhole restriction
The nat-port-range
setting is used to specify a port range in the VoIP profile to restrict the NAT port range for Real-time Transport Protocol/Real-time Transport Control Protocol (RTP/RTCP) packets in a Session Initiation Protocol (SIP) call session that is handled by the SIP application layer gateway (ALG) in a FortiGate.
When NAT is enabled, or VIP is used in a firewall policy for SIP ALG to handle a SIP call session established through a FortiGate, the SIP ALG can perform NAT to translate the ports used for the RTP/RTCP packets when they are flowing through the device between the external and internal networks.
To edit the translated port range for RTP/RTCP packets:
config voip profile edit <name> config sip set nat-port-range <start_port_number>-<end_port_number> end next end
nat-port-range <start_port_number>-<end_port_number> |
Enter the NAT port range (minimum port number = 5117, default = 5117-65535). |
Example
In this example, Phone 1 is in Subnet 1, and the SIP server and Phone 2 are in Subnet 2. All SIP signaling messages and RTP/RTCP packets go through the SIP server. The RTP/RTCP ports on Phone 1 are configured as 17078/17079.
The FortiGate administrator wants to use NAT for the port 17078/17079 to 30000/30001. If Phone 1 and Phone 2 are registered to the SIP server, and they establish a call session between them through the FortiGate and the SIP server, then the RTP/RTCP ports 17078/17079 of Phone 1 will be translated to ports 30000/30001. All RTP/RTCP packets going out of port2 have source ports of 30000/30001, and all RTP/RTCP packets going into port2 also have destination ports of 30000/30001.
To configure the custom port range:
- Edit the VoIP profile:
config voip profile edit "natPortRange" config sip set nat-port-range 30000-30001 end next end
It is best practice to configure the starting port as an even number and the ending port as an odd number.
- Configure the firewall policy:
config firewall policy edit 1 set srcintf port1 set dstintf port2 set srcaddr all set dstaddr all set service SIP set action accept set schedule always set voip-profile natPortRange set nat enable next end