blob: c46a23c1885d6a562d4c7a939dffabd7617fc12e [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
10explicit configuration of all each PCU connecting to the SGSN. The
11administrator 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
20When a MS requests establishment of a PDP context, it specifies the APN
21(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
103.Example: Assign or change authorization policy:
104----
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
Philipp Maiered171062017-03-08 17:50:33 +0100119.Example: Access control list:
120----
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,
156which uses the standard MILEAGE algorithm for mutual authentication
157between 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
178.Example: CDR configuration
179----
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
188[[sgsn-cdr]]
Jonathan Brielmaier5530c912016-05-25 15:01:11 +0200189.Description of CSV fields in OsmoSGSN CDR file
Harald Welte9f1331b2016-02-20 10:56:10 +0100190[options="header",cols="15%,85%"]
191|===
Harald Welte36dea392016-02-20 18:35:37 +0100192|Field Name|Description
Harald Welte9f1331b2016-02-20 10:56:10 +0100193|timestamp|Timestamp in YYYYMMDDhhmmssXXX where XXX are milli-seconds
194|imsi|IMSI causing this CDR
195|imei|IMEI causing this CDR
196|msisdn|MSISDN causing this CDR (if known)
197|cell_id|Cell ID in which the MS was registered last
198|lac|Location Area Code in which the MS was registered last
199|hlr|HLR of the subscriber
Harald Welte36dea392016-02-20 18:35:37 +0100200|event|Possible events are explained below in <<sgsn-cdr-event>>
Pau Espin Pedrol817911f2017-12-01 11:56:54 +0100201|===
202
203If the _event_ field describes a pdp context related action (starts with
204_pdp-_), then the following extra CSV fields are appended to the line:
205
206[[sgsn-cdr-pdp]]
207.Description of extra CSV fields for pdp context related events
208[options="header",cols="15%,85%"]
209|===
210|Field Name|Description
Harald Welte9f1331b2016-02-20 10:56:10 +0100211|pdp_duration|duration of the PDP context so far
212|ggsn_addr|GGSN related to the PDP context
213|sgsn_addr|SGSN related to the PDP context
214|apni|APN identifier of the PDP context
215|eua_addr|IP address allocated to the PDP context
216|vol_in|Number of bytes in MO direction
217|vol_out|Number of bytes in MT direction
218|charging_id|Related charging ID
219|===
220
221[[sgsn-cdr-event]]
222.Description of OsmoSGSN CDR Events
223[options="header",cols="15%,85%"]
224|===
225|Event|Description
226|attach|GMM ATTACH COMPLETE about to be sent to MS
227|update|GMM ROUTING AREA UPDATE COMPLETE about to be sent to MS
228|detach|GMM DETACH REQUEST received from MS
229|free|Release of the MM context memory
230|pdp-act|GTP CREATE PDP CONTEXT CONFIRM received from GGSN
231|pdp-deact|GTP DELETE PDP CONTEXT CONFIRM received from GGSN
232|pdp-terminate|Forced PDP context termination during MM context release
233|pdp-free|Release of the PDP context memory
234|===
Philipp Maiere4e90112017-03-09 12:28:44 +0100235
236
237=== User traffic compression
238
239In order to save optimize GPRS bandwith, OsmoSGSN implements header and data
240compression schemes. The compression will reduce the packet length in order
241to save radio bandwith.
242
243==== Header compression
244
245On TCP/IP connections, each packet is prepended with a fairly long TCP/IP
246header. The header contains a lot of static information that never changes
247throughout the connection. (source and destination address, port numbers etc.)
248OsmoSGSN implements a TCP/IP header compression scheme called RFC1144, also
249known as SLHC. This type of header compression removes the TCP/IP header
250entirely and replaces it with a shorter version, that only contains the
251information that is absolutely necessary to identify and check the packet.
252The receiving part then restores the original header and forwards it to higher
253layers.
254
255*compression rfc1144 passive*::
256TCP/IP header compression has to be actively requested by the modem. The
257network will not promote compression by itself. This is the recommended mode
258of operation.
259
260*compression rfc1144 active slots <1-256>*::
261TCP/IP header compression is actively promoted by the network. Modems may still
262actively request different compression parameters or reject the offered
263compression parameters entirely. The number of slots is the maximum number
264of packet headers per subscriber that can be stored in the codebook.
265
266.Example: Accept compression if requested:
267----
268sgsn
269 compression rfc1144 passive
270----
271
272.Example: Actively promote compression:
273----
274sgsn
275 compression rfc1144 active slots 8
276----
277
278NOTE: The usage of TCP/IP options may disturb the RFC1144 header compression
279scheme. TCP/IP options may render RFC1144 ineffective if variable data is
280encoded into the option section of the TCP/IP packet. (e.g. TCP option 8,
281Timestamp)
282
283
284==== Data compression
285
286Data compression works on the raw packet data, including the header part of the
287packet. If enabled, header compression is applied before first data compression
288is applied. OsmoSGSN implements the V.42bis data compression scheme.
289
290*compression rfc1144 passive*::
291V42bis data compression has to be actively requested by the modem. The network
292will not promote compression by itself. This is the recommended mode of
293operation.
294
295*compression v42bis active direction (ms|sgsn|both) codewords <512-65535> strlen <6-250>*::
296V42bis data compression is actively promoted by the network. Modems may still
297actively request different compression parameters or reject the offered
298compression parameters entirely. The direction configures which sides are
299allowed to send compressed packets. For most cases, compressing 'both'
300directions will be the preferred option. The following to parameters configure
301the codebook size by the maxium number ('codewords') and size ('strlen') of
302entries.
303
304.Example: Accept compression if requested:
305----
306sgsn
307 compression v42bis passive
308----
309
310.Example: Actively promote compression:
311----
312sgsn
313 compression v42bis active direction both codewords 512 strlen 20
314----