blob: fd2d7edaec39b2ded0d6735bed21eabe162dfc26 [file] [log] [blame]
Harald Welte9f1331b2016-02-20 10:56:10 +01001== Configuring OsmoSGSN
2
3Contrary to other network elements (like OsmoBSC, OsmoNITB), the
4OsmoSGSN has a relatively simple configuration.
5
6On the one hand, this is primary because the PCU configuration happens
7from the BSC side.
8
9On the other hand, it is because the Gb interface does not need an
Daniel Willmannd2badb32019-07-29 18:10:08 +020010explicit configuration of each PCU connecting to the SGSN. The
Harald Welte9f1331b2016-02-20 10:56:10 +010011administrator only has to ensure that the NS and BSSGP layer identities
12(NSEI, NSVCI, BVCI) are unique for each PCU connecting to the SGSN.
13
14=== Configuring the Gp interface
15
16The Gp interface is the GTP-C and GTP-U based interface between the SGSN
17and the GGSNs. It is implemented via UDP on well-known source and
18destination ports.
19
Daniel Willmannd2badb32019-07-29 18:10:08 +020020When an MS requests establishment of a PDP context, it specifies the APN
Harald Welte9f1331b2016-02-20 10:56:10 +010021(Access Point Name) to which the context shall be established. This APN
22determines which GGSN shall be used, and that in turn determines which
23external IP network the MS will be connected to.
24
25There are two modes in which GGSNs can be configured:
26
27. static GGSN/APN configuration
28. dynamic GGSN/APN configuration
29
30==== Static GGSN/APN configuration
31
32In this mode, there is a static list of GGSNs and APNs configured in
33OsmoSGSN via the VTY / config file.
34
35This is a non-standard method outside of the 3GPP specifications for the
36SGSN, and is typically only used in private/small GPRS networks without
37any access to a GRX.
38
39.Example: Static GGSN/APN configuration (single catch-all GGSN)
40----
41OsmoSGSN(config-sgsn)# gtp local-ip 172.0.0.1 <1>
42OsmoSGSN(config-sgsn)# ggsn 0 remote-ip 127.0.0.2 <2>
43OsmoSGSN(config-sgsn)# ggsn 0 gtp-version 1 <3>
44OsmoSGSN(config-sgsn)# apn * ggsn 0 <4>
45----
46<1> Configure the local IP address at the SGSN used for Gp/GTP
47<2> Specify the remote IP address of the GGSN (for GGSN 0)
48<3> Specify the GTP protocol version used for GGSN 0
49<4> Route all APN names to GGSN 0
50
51
52==== Dynamic GGSN/APN configuration
53
54In this mode, the SGSN will use a DNS-based method to perform the lookup
55from the APN (as specified by the MS) towards the GGSN IP address.
56
57This is the official method as per the 3GPP specifications for the SGSN,
58and what is used on GRX.
59
60.Example: Dynamic GGSN/APN configuration
61----
62OsmoSGSN(config-sgsn)# gtp local-ip 192.168.0.11 <1>
63OsmoSGSN(config-sgsn)# ggsn dynamic <2>
64OsmoSGSN(config-sgsn)# grx-dns-add 1.2.3.4 <3>
65----
66<1> Configure the local IP address at the SGSN used for Gp/GTP
67<2> Enable the dynamic GGSN resolving mode
68<3> Specify the IP address of a DNS server for APN resolution
69
ikostovaa6629f2017-01-06 14:34:45 +010070[[auth-pol]]
71=== Authorization Policy
72
Philipp Maiered171062017-03-08 17:50:33 +010073The authorization policy controls by which rules a subscriber is accepted or
74rejected. The possible options range from accepting just all subscribers without
75further checking, to a fine grained access-control, handled by an external HLR.
ikostovaa6629f2017-01-06 14:34:45 +010076
Philipp Maiered171062017-03-08 17:50:33 +010077accept-all:: All subscribers that attempt to attach to the GPRS network are
78accepted without further checking. This option is intended to be used for
79testing in a controlled environment only. A wide-open network may attract
80subscribers from foreign networks and disrupt their service. It is highly
81recommended to pick one of the options below.
ikostovaa6629f2017-01-06 14:34:45 +010082
Philipp Maiered171062017-03-08 17:50:33 +010083remote:: This option allows to connect OsmoSGSN to an external HLR via the
84GSUP protocol. This will be the preferred option in larger networks.
ikostovaa6629f2017-01-06 14:34:45 +010085
Philipp Maiered171062017-03-08 17:50:33 +010086acl-only:: If no external HLR is available, the network operator has the
87option to control the access using an access control list. The access control
88list contains the IMSI numbers of the allowed subscribers. This method offers
89fine grained access control and is ideal for small networks and lab test
90environments.
ikostovaa6629f2017-01-06 14:34:45 +010091
Philipp Maiered171062017-03-08 17:50:33 +010092closed:: This policy mode softens the strict *acl-only* only mode by also
93implicitly accepting home network subscribers. The decision is made by the MCC
94and MNC part of the IMSI number. The combination of MCC and MNC fully identifies
95a subscribers home network, also known as a Home Network Identity (HNI, i.e.
96MCC and MNC found at the start of the IMSI, e.g. MCC 901 and MNC 700 with
97IMSI 901700000003080).
ikostovaa6629f2017-01-06 14:34:45 +010098
Philipp Maiered171062017-03-08 17:50:33 +010099NOTE: The policy mode *closed* must not be confused with the equally named
100policy that is defined for osmo-nitb!
101
ikostovaa6629f2017-01-06 14:34:45 +0100102
Daniel Willmannd2badb32019-07-29 18:10:08 +0200103.Example: Assign or change authorization policy
ikostovaa6629f2017-01-06 14:34:45 +0100104----
105OsmoSGSN> enable
106OsmoSGSN# configure terminal
107OsmoSGSN(config)# sgsn
108OsmoSGSN(config-sgsn)# auth-policy acl-only <1>
109OsmoSGSN(config-sgsn)# write <2>
110Configuration saved to sgsn.cfg
111OsmoSGSN(config-sgsn)# end
112OsmoSGSN# disable
113OsmoSGSN>
114----
115<1> 'acl-only' is selected as authorization policy
116<2> Saves current changes to cofiguration to make this policy
117persistent
Harald Welte9f1331b2016-02-20 10:56:10 +0100118
Daniel Willmannd2badb32019-07-29 18:10:08 +0200119.Example: Access control list
Philipp Maiered171062017-03-08 17:50:33 +0100120----
121sgsn
122 auth-policy acl-only <1>
123 imsi-acl add 001010000000003
124 imsi-acl add 001010000000002
125 imsi-acl add 001010000000001
126 imsi-acl add 901700000000068 <2>
127----
128<1> Set the authorization policy
129<2> Add as many subscribers as required
130
Harald Welte9f1331b2016-02-20 10:56:10 +0100131=== Subscriber Configuration
132
133As opposed to OsmoNITB, OsmoSGSN does not feature a built-in HLR.
134
135It can thus operate only in the following two modes:
136
137. Accessing an external HLR (or HLR gateway) via the GSUP protocol
Philipp Maiered171062017-03-08 17:50:33 +0100138. Accepting subscribers based on internal ACL (access control list),
139 see also <<auth-pol>>
Harald Welte9f1331b2016-02-20 10:56:10 +0100140
141==== Accessing an external HLR via GSUP
142
143The non-standard GSUP protocol was created to provide OsmoSGSN with
144access to an external HLR while avoiding the complexities of the
145TCAP/MAP protocol stack commonly used by HLRs.
146
147A custom HLR could either directly implement GSUP, or an external gateway
148can be used to convert GSUP to the respective MAP operations.
149
150The primitives/operations of GSUP are modelled to have a 1:1
151correspondence to their MAP counterparts. However, the encoding is much
152simplified by use of a binary TLV encoding similar to Layer 3 of
153GSM/GPRS.
154
155GSUP performs a challenge-response authentication protocol called OAP,
Daniel Willmannd2badb32019-07-29 18:10:08 +0200156which uses the standard MILENAGE algorithm for mutual authentication
Harald Welte9f1331b2016-02-20 10:56:10 +0100157between OsmoSGSN and the HLR/HLR-GW.
158
159[[sgsn-ex-gsup]]
160.Example: Using an external HLR via GSUP
161----
162OsmoSGSN(config-sgsn)# gsup remote-ip 2.3.4.5 <1>
163OsmoSGSN(config-sgsn)# gsup remote-port 10000 <2>
164OsmoSGSN(config-sgsn)# gsup oap-k 000102030405060708090a0b0c0d0e0f <3>
165OsmoSGSN(config-sgsn)# gsup oap-opc 101112131415161718191a1b1c1d1e1f <4>
166----
167<1> Configure the IP address of the (remote) HLR or HLR-GW
168<2> Configure the TCP port of the (remote) HLR or HLR-GW
169<3> Specify the OAP shared key
170<4> Specify the OAP shared OPC
171
172
173=== CDR configuration
174
175OsmoSGSN can write a text log file containing CDR (call data records),
176which are commonly used for accounting/billing purpose.
177
Pau Espin Pedrol54828cd2017-12-01 12:22:00 +0100178.Example: CDR log file configuration
Harald Welte9f1331b2016-02-20 10:56:10 +0100179----
180OsmoSGSN(config-sgsn)# cdr filename /var/log/osmosgsn.cdr
181OsmoSGSN(config-sgsn)# cdr interval 600 <1>
182----
183<1> Periodically log existing PDP contexts every 600 seconds (10 min)
184
185The CDR file is a simple CSV file including a header line naming the
186individual fields of each CSV line.
187
Pau Espin Pedrol54828cd2017-12-01 12:22:00 +0100188==== CDR CTRL interface
189
190Independently of whether logging CDR to a file is enabled or not, OsmoSGSN can
191also provide delivery of CDR through the CTRL interface. CDR are sent by means
192of TRAP messages with variable name _cdr-v1_, and its value is filled using the
193same CSV line format as in the log file, but without CSV header line.
194
195.Example: CDR delivery through CTRL TRAP messages
196----
197OsmoSGSN(config-sgsn)# cdr trap
198----
199
200==== CDR Format
201
Harald Welte9f1331b2016-02-20 10:56:10 +0100202[[sgsn-cdr]]
Jonathan Brielmaier5530c912016-05-25 15:01:11 +0200203.Description of CSV fields in OsmoSGSN CDR file
Harald Welte9f1331b2016-02-20 10:56:10 +0100204[options="header",cols="15%,85%"]
205|===
Harald Welte36dea392016-02-20 18:35:37 +0100206|Field Name|Description
Harald Welte9f1331b2016-02-20 10:56:10 +0100207|timestamp|Timestamp in YYYYMMDDhhmmssXXX where XXX are milli-seconds
208|imsi|IMSI causing this CDR
209|imei|IMEI causing this CDR
210|msisdn|MSISDN causing this CDR (if known)
211|cell_id|Cell ID in which the MS was registered last
212|lac|Location Area Code in which the MS was registered last
213|hlr|HLR of the subscriber
Harald Welte36dea392016-02-20 18:35:37 +0100214|event|Possible events are explained below in <<sgsn-cdr-event>>
Pau Espin Pedrol817911f2017-12-01 11:56:54 +0100215|===
216
217If the _event_ field describes a pdp context related action (starts with
218_pdp-_), then the following extra CSV fields are appended to the line:
219
220[[sgsn-cdr-pdp]]
221.Description of extra CSV fields for pdp context related events
222[options="header",cols="15%,85%"]
223|===
224|Field Name|Description
Harald Welte9f1331b2016-02-20 10:56:10 +0100225|pdp_duration|duration of the PDP context so far
226|ggsn_addr|GGSN related to the PDP context
227|sgsn_addr|SGSN related to the PDP context
228|apni|APN identifier of the PDP context
229|eua_addr|IP address allocated to the PDP context
230|vol_in|Number of bytes in MO direction
231|vol_out|Number of bytes in MT direction
232|charging_id|Related charging ID
233|===
234
235[[sgsn-cdr-event]]
236.Description of OsmoSGSN CDR Events
237[options="header",cols="15%,85%"]
238|===
239|Event|Description
240|attach|GMM ATTACH COMPLETE about to be sent to MS
241|update|GMM ROUTING AREA UPDATE COMPLETE about to be sent to MS
242|detach|GMM DETACH REQUEST received from MS
243|free|Release of the MM context memory
244|pdp-act|GTP CREATE PDP CONTEXT CONFIRM received from GGSN
245|pdp-deact|GTP DELETE PDP CONTEXT CONFIRM received from GGSN
246|pdp-terminate|Forced PDP context termination during MM context release
247|pdp-free|Release of the PDP context memory
Pau Espin Pedrol04da5fe2017-12-01 12:21:23 +0100248|pdp-periodic|Triggered by periodic timer, see VTY cmd _cdr interval_
Harald Welte9f1331b2016-02-20 10:56:10 +0100249|===
Philipp Maiere4e90112017-03-09 12:28:44 +0100250
251
252=== User traffic compression
253
Daniel Willmannd2badb32019-07-29 18:10:08 +0200254In order to save GPRS bandwith, OsmoSGSN implements header and data
255compression schemes which will reduce the packet length.
Philipp Maiere4e90112017-03-09 12:28:44 +0100256
257==== Header compression
258
259On TCP/IP connections, each packet is prepended with a fairly long TCP/IP
260header. The header contains a lot of static information that never changes
261throughout the connection. (source and destination address, port numbers etc.)
262OsmoSGSN implements a TCP/IP header compression scheme called RFC1144, also
263known as SLHC. This type of header compression removes the TCP/IP header
264entirely and replaces it with a shorter version, that only contains the
265information that is absolutely necessary to identify and check the packet.
266The receiving part then restores the original header and forwards it to higher
267layers.
268
269*compression rfc1144 passive*::
270TCP/IP header compression has to be actively requested by the modem. The
271network will not promote compression by itself. This is the recommended mode
272of operation.
273
274*compression rfc1144 active slots <1-256>*::
275TCP/IP header compression is actively promoted by the network. Modems may still
276actively request different compression parameters or reject the offered
277compression parameters entirely. The number of slots is the maximum number
278of packet headers per subscriber that can be stored in the codebook.
279
Daniel Willmannd2badb32019-07-29 18:10:08 +0200280.Example: Accept compression if requested
Philipp Maiere4e90112017-03-09 12:28:44 +0100281----
282sgsn
283 compression rfc1144 passive
284----
285
Daniel Willmannd2badb32019-07-29 18:10:08 +0200286.Example: Actively promote compression
Philipp Maiere4e90112017-03-09 12:28:44 +0100287----
288sgsn
289 compression rfc1144 active slots 8
290----
291
Daniel Willmannd2badb32019-07-29 18:10:08 +0200292.Example: Turn off compression
293----
294sgsn
295 no compression rfc1144
296----
297
Philipp Maiere4e90112017-03-09 12:28:44 +0100298NOTE: The usage of TCP/IP options may disturb the RFC1144 header compression
299scheme. TCP/IP options may render RFC1144 ineffective if variable data is
300encoded into the option section of the TCP/IP packet. (e.g. TCP option 8,
301Timestamp)
302
303
304==== Data compression
305
306Data compression works on the raw packet data, including the header part of the
Daniel Willmannd2badb32019-07-29 18:10:08 +0200307packet. If enabled, header compression is applied first before data compression
Philipp Maiere4e90112017-03-09 12:28:44 +0100308is applied. OsmoSGSN implements the V.42bis data compression scheme.
309
Daniel Willmannd2badb32019-07-29 18:10:08 +0200310*compression v42bis passive*::
Philipp Maiere4e90112017-03-09 12:28:44 +0100311V42bis data compression has to be actively requested by the modem. The network
312will not promote compression by itself. This is the recommended mode of
313operation.
314
315*compression v42bis active direction (ms|sgsn|both) codewords <512-65535> strlen <6-250>*::
316V42bis data compression is actively promoted by the network. Modems may still
317actively request different compression parameters or reject the offered
318compression parameters entirely. The direction configures which sides are
319allowed to send compressed packets. For most cases, compressing 'both'
320directions will be the preferred option. The following to parameters configure
321the codebook size by the maxium number ('codewords') and size ('strlen') of
322entries.
323
Daniel Willmannd2badb32019-07-29 18:10:08 +0200324.Example: Accept compression if requested
Philipp Maiere4e90112017-03-09 12:28:44 +0100325----
326sgsn
327 compression v42bis passive
328----
329
Daniel Willmannd2badb32019-07-29 18:10:08 +0200330.Example: Actively promote compression
Philipp Maiere4e90112017-03-09 12:28:44 +0100331----
332sgsn
333 compression v42bis active direction both codewords 512 strlen 20
334----
Daniel Willmannd2badb32019-07-29 18:10:08 +0200335
336.Example: Turn off compression
337----
338sgsn
339 no compression v42bis
340----
Daniel Willmannc1ccf662019-07-29 18:12:13 +0200341
342=== Encryption
343
344Encryption can be enabled if the auth-policy is set to remote and the
345HLR subscriber entries contain the keys of the SIM card. See
346<<sgsn-ex-gsup>> on how to connect to an external HLR.
347
348.Example: Turn on encryption (GEA3)
349----
350sgsn
351 encryption GEA3
352----
353
354.Example: Turn off encryption (GEA0)
355----
356sgsn
357 encryption GEA0
358----