GTP APN Filtering
Learn how to filter GTP traffic using access point names (APNs), selection modes, and IMSI prefixes to control roaming access to external networks.
An APN is an information element (IE) included in the header of a GTP packet that provides information about how to reach a network. An APN comprises two elements:
-
Network ID—Identifies the name of an external network such as example.com.
-
Operator ID—Uniquely identifies the operators’ public land mobile network (PLMN) such as mnc123.mcc456.
By default, the device permits all APNs. However, you can configure the device to perform APN filtering to restrict access to roaming subscribers to external networks.
To enable APN filtering, you must specify one or more APNs. To specify an APN, you need to know the domain name of the network (for example, example.com) and, optionally, the operator ID. Because the domain name (network ID) portion of an APN can potentially be very long and contain many characters, you can use the wildcard (*) as the first character of the APN. The wildcard indicates that the APN is not limited only to example.com but also includes all the characters that might precede it.
You might also set a selection mode for the APN. The selection mode indicates the origin of the APN and whether or if the Home Location Register (HLR) has verified the user subscription. You set the selection mode according to the security needs of your network. Possible selection modes include the following:
-
Mobile Station—Mobile station-provided APN, subscription not verified.
This selection mode indicates that the mobile station (MS) provided the APN and that the HLR did not verify the user’s subscription to the network.
-
Network—Network-provided APN, subscription not verified.
This selection mode indicates that the network provided a default APN because the MS did not specify one, and that the HLR did not verify the user’s subscription to the network.
-
Verified—MS or network-provided APN, subscription verified.
This selection mode indicates that the MS or the network provided the APN and that the HLR verified the user’s subscription to the network.
APN filtering applies only to create-pdp-request messages. When performing APN filtering, the device inspects GTP packets to—look for APNs that match APNs that you set. If the APN of a GTP packet matches an APN that you specified, the device then verifies the selection mode. The GTP packets are only forwarded if both the APN and the selection mode match the APN and the selection mode that you specified. Because APN filtering is based on perfect matches, using the wildcard (*) when setting an APN suffix can prevent the inadvertent exclusion of APNs that you would otherwise authorize.
Additionally, the device can filter GTP packets based on the combination of an IMSI prefix and an APN. When you filter GTP packets based on an IMSI prefix, you must also specify an APN.
An APN string is case-insensitive. For example, in the following example you set two APN strings, WWW.EXAMPLE.COM and www.example.com, with the same IMSI prefix value. In this configuration, the lowercase string will display after the uppercase string, and the packet will be dropped.
user@host# show configuration security gtp | display set
set security gtp profile test apn WWW.EXAMPLE.COM imsi-prefix * action pass
set security gtp profile test apn www.example.com imsi-prefix * action drop
If an APN is configured with two IMSI prefix entries, then the IMSI prefix with the longest match takes priority. For example, see the following configuration:
user@host# show configuration security gtp | display set
set security gtp profile test apn WWW.EXAMPLE.COM imsi-prefix 12345678 action pass
set security gtp profile test apn www.example.com imsi-prefix 12345 action drop
If an incoming packet value matches the IMSI prefix value 12345678, then the packet will pass. The IMSI prefix value 12345678 takes precedence over the IMSI prefix value 12345, as the longest matched IMSI prefix takes priority.
GTPv2 IMSI Prefix and APN Filtering
A GPRS support node (GSN) identifies a Mobile Station (MS) by its International Mobile Subscriber Identity (IMSI). An IMSI comprises three elements: the mobile country code (MCC), the mobile network code (MNC), and the Mobile Subscriber Identification Number (MSIN). The MCC is a three-digit number, and the MNC is a two-digit or three-digit number. The MCC and MNC combined constitute the IMSI prefix and identify the mobile subscriber’s home network or public land mobile network (PLMN). Therefore, the IMSI prefix acts as the PLMN identifier and is used to identify valid roaming partners.
By default, a device does not perform IMSI prefix filtering on GPRS tunneling protocol version 2 (GTPv2) packets. By setting IMSI prefixes, you configure the device to filter create-session-request messages and permit only GTPv2 packets with IMSI prefixes that match the ones you set.
For example, example.com.mnc123.mcc789.gprs is an APN for reaching the example.com network through the mnc123.mcc789.gprs operator.
You can use the set security gtp profile profile name apn
pattern-string imsi-prefix imsi-prefix-digits action (pass
|drop |selection)
configuration statement to filter packets based on the combination of
an IMSI prefix and an APN.
To specify an APN, you need to know the network ID or the domain name of the network (for example, example.com) and, optionally, the operator ID. Because the network ID portion of an APN can be very long, you can use the wildcard (*) as the first character of the APN string. For example, if you use *.example.com as the network ID, the wildcard indicates that the APN is not limited only to example.com but also includes all the characters that might precede it.
Example: Set a GTP APN and a Selection Mode
This example shows how to set a GTP APN and a selection mode.
Requirements
No special configuration beyond device initialization is required before configuring this feature.
Overview
In this example, you set a GTP APN as example.com.mnc123.mcc456.gprs and use the wildcard (*) character. You also set the IMSI prefix and set the selection mode as network.
Configuration
Step-by-Step Procedure
To configure a GTP APN and a selection mode:
Specify the GTP profile.
[edit] user@host# set security gtp profile gtp1
Set a selection mode for the APN.
[edit] user@host# set security gtp profile gtp1 apn *example.com.mnc123.mcc456.gprs imsi-prefix * action selection net
If you are done configuring the device, commit the configuration.
[edit] user@host# commit
Verification
To verify the configuration is working properly, enter the show security gtp
command.
IMSI Prefix Filtering of GTP Packets
GSN identifies a mobile station by its International Mobile Station Identity (IMSI). An IMSI consists of three elements: the mobile country code (MCC), the mobile network code (MNC), and the Mobile Subscriber Identification Number (MSIN). The MCC and MNC combined constitute the IMSI prefix and identify the mobile subscriber’s home network, or PLMN.
By setting IMSI prefixes, you can configure the device to deny GTP traffic coming from nonroaming partners. By default, a device does not perform IMSI prefix filtering on GTP packets. By setting IMSI prefixes, you configure the device to filter create-pdp-request messages and permit only GTP packets with IMSI prefixes that match the ones you set. The device allows GTP packets with IMSI prefixes that do not match any of the IMSI prefixes that you set. To block GTP packets with IMSI prefixes that do not match any of the IMSI prefixes set, use an explicit wildcard for the IMSI filter, and the drop action should be the last IMSI prefix filtering policy.
When you filter GTP packets based on an IMSI prefix, you must also specify an APN.
Example: Set a Combined IMSI Prefix and APN Filter
This example shows how to set and combine IMSI prefix and APN filter.
Requirements
No special configuration beyond device initialization is required before configuring this feature.
Overview
In this example, you set example.com.mnc123.mcc456.gprs as an APN and use the wildcard(*). You permit all selection modes for this APN. You also set the IMSI prefix for a known PLMN, which is 246565. The MCC-MNC pair can be five or six digits.
Configuration
Step-by-Step Procedure
To set and combine IMSI prefix and APN filter:
Set the GTP profile.
[edit] user@host# set security gtp profile gtp1
Set the selection mode for APN.
[edit] user@host# set security gtp profile gtp1 apn *example.com.mnc123.mcc456.gprs imsi-prefix 246565* action pass
If you are done configuring the device, commit the configuration.
[edit] user@host# commit
Verification
To verify the configuration is working properly, enter the show security gtp
command.