blob: 9a4c81b35bd990d28419eac4a28f8cf67a3424c7 [file] [log] [blame]
Harald Welte8a1e7b82017-09-06 12:35:04 +02001== Configuring OsmoGGSN
2
3All configuration of OsmoGGSN is performed using the VTY. For more
Maxa4cb0262017-09-22 14:36:51 +02004general information on the VTY interface, see <<vty>>.
Harald Welte8a1e7b82017-09-06 12:35:04 +02005
6=== Configuring a virtual GGSN instance
7
8OsmoGGSN can run multiple GGSN instances inside one program/process.
9Each GGSN instance binds to its own transport-layer GTP IP address and
10has its own set of APNs and associated IP address pools + tun/gtp
11devices.
12
13In most usage cases, yo will only have a single GGSN instance inside
14your configuration file, like in below example:
15
16.Example: Single GGSN configuration section
17----
18ggsn ggsn0
19 gtp state-dir /tmp
20 gtp bind-ip 127.0.0.6
21 apn internet
22 gtpu-mode tun
23 tun-device tun4
24 type-support v4
25 ip prefix dynamic 176.16.222.0/24
26 ip dns 0 192.168.100.1
27 ip dns 1 8.8.8.8
28 ip ifconfig 176.16.222.0/24
29 no shutdown
30----
31
32
33==== Creating/Editing a GGSN instance
34
35Creating/Editing a GGSN instance can be done by the following sequence
36of VTY commands:
37
38----
39OsmoGGSN> enable <1>
40OsmoGGSN# configure terminal <2>
41OsmoGGSN(config)# ggsn ggsn0 <3>
42OsmoGGSN(config-ggsn)# <4>
43----
44<1> Change into privileged mode
45<2> Enter the interactive configuration mode
46<3> Create or edit the GGSN instance `ggsn0`. The name can be any ASCII
47 string, its significance is only to the local user.
48<4> Your prompt is now in the `ggsn` config node, where you can
49 configure the properties of this GGSN instance.
50
51NOTE:: After creating a new GGSN instance, it is in `shutdown` mode. See
Maxa4cb0262017-09-22 14:36:51 +020052<<unshutdown_apn>> to take it out of shutdown, but make sure to configure it fully
Harald Welte8a1e7b82017-09-06 12:35:04 +020053before taking it out of shutdown.
54
55==== Configuring a GGSN instance
56
57The following two mandatory configuration statements have to be given
58for every GGSN instance:
59
60----
61OsmoGGSN(config-ggsn)# gtp state-dir /var/lib/ggsn/ggsn0 <1>
62OsmoGGSN(config-ggsn)# gtp bind-ip 127.0.0.6 <2>
63----
64<1> Store the GSN restart state in the specified directory
65<2> Bind the GGSN instance to the specified local IPv4 address
66
67There are some further configuration statements that can be used at the
68GGSN node, some examples are given below. For a full list, see the
Maxa4cb0262017-09-22 14:36:51 +020069_OsmoGGSN VTY reference manual_ <<vty-ref-osmoggsn>>.
Harald Welte8a1e7b82017-09-06 12:35:04 +020070
71----
72OsmoGGSN(config-ggsn)# default-apn foobar <1>
73----
74<1> Configure a default APN to be used if the user-requested APN is not
75 found. The named APN must previously be configured
76
77
78==== Deleting a GGSN instance
79
80A GGSN instance can be removed like this
81
82.Example: Deleting a GGSN instance
83----
84OsmoGGSN> enable <1>
85OsmoGGSN# configure terminal <2>
86OsmoGGSN(config)# no ggsn ggsn0 <3>
87----
88<1> Change into privileged mode
89<2> Enter the interactive configuration mode
90<3> Delete the GGSN instance
91
92
93==== Taking a GGSN instance out of shutdown
94
95.Example: Taking a GGSN instance out of shutdown
96----
97OsmoGGSN> enable <1>
98OsmoGGSN# configure terminal <2>
99OsmoGGSN(config)# ggsn ggsn0 <3>
100OsmoGGSN(config-ggsn)# no shutdown ggsn <4>
101----
102<1> Change into privileged mode
103<2> Enter the interactive configuration mode
104<3> Enter the config ndoe of the GGSN instance `ggsn0`
105<4> Take the GGSN instance out of shutdown
106
107
108==== Shutting a GGSN instance down
109
110If you would like to take a GGSN instance out of service, you can
111put it into shutdown mode. This will make the entire GGSN unavailable
112to user traffic and permit you to e.g. reconfigure it before taking it
113out of shutdown again.
114
115.Example: Shutting down a GGSN instance
116----
117OsmoGGSN> enable <1>
118OsmoGGSN# configure terminal <2>
119OsmoGGSN(config)# ggsn ggsn0 <3>
120OsmoGGSN(config-ggsn)# shutdown ggsn <4>
121----
122<1> Change into privileged mode
123<2> Enter the interactive configuration mode
124<3> Enter the config ndoe of the GGSN instance `ggsn0`
125<4> Shut down the GGSN instance
126
127
128=== Configuring an Access Point Name
129
130An Access Point Name (APN) represents a connection to an external packet
131data network, such as the public Internet or private corporate networsk.
132
133APNs are selected by terminals (MS/UE) when establishing PDP contexts.
134
135Each OsmoGGSN GGSN instance can have any number of APNs configured.
136Each APN is identified by a string name.
137
138==== Creating/Editing an APN
139
140.Example: Creating a new APN
141----
142OsmoGGSN> enable <1>
143OsmoGGSN# configure terminal <2>
144OsmoGGSN(config)# ggsn ggsn0 <3>
145OsmoGGSN(config-ggsn)# apn internet <4>
146OsmoGGSN(config-ggsn-apn)# <5>
147----
148<1> Change into privileged mode
149<2> Enter the interactive configuration mode
150<3> Enter the config node of the GGSN instance `ggsn0`
151<4> Create or Edit an APN called `internet`
152<5> Your prompt is now in the `ggsn` config node, where you can
153 configure the properties of this GGSN instance.
154
Maxa4cb0262017-09-22 14:36:51 +0200155NOTE:: The newly-create APN is created in `shutdown` mode. See <<unshutdown_apn>> to take it
Harald Welte8a1e7b82017-09-06 12:35:04 +0200156out of shutdown.
157
158
159==== Configuring an APN
160
161.Example: Configuring an APN
162----
163OsmoGGSN(config-ggsn-apn)# gtpu-mode tun <1>
164OsmoGGSN(config-ggsn-apn)# type-support v4 <2>
165OsmoGGSN(config-ggsn-apn)# ip prefix dynamic 176.16.222.0/24 <3>
166OsmoGGSN(config-ggsn-apn)# ip dns 0 192.168.100.1 <4>
167OsmoGGSN(config-ggsn-apn)# ip dns 1 8.8.8.8 <5>
168OsmoGGSN(config-ggsn-apn)# ip ifconfig 176.16.222.0/24 <6>
169----
170<1> Use the userspace GTP-U handling using a TUN device
171<2> Support (only) IPv4 Addresses
172<3> Specify the pool of dynamic IPv4 addresses to be allocated to PDP
173 contexts
174<4> Specify the primary DNS server to be provided using IPCP/PCO
175<5> Specify the secondary DNS server to be provided using IPCP/PCO
176<6> Request OsmoGGSN to configure the `tun4` device network/netmask
177
178NOTE:: If you use the optional `ip ifconfig` command to set the network
179device address/mask, OsmoGGSN must run with root or `CAP_NET_ADMIN`
180support. It might be better to configure related tun devices at system
Maxa4cb0262017-09-22 14:36:51 +0200181startup and run OsmoGGSN as non-privileged user. See <<ggsn_no_root>> for more
Harald Welte8a1e7b82017-09-06 12:35:04 +0200182details.
183
184
185==== Deleting an APN
186
187An APN configuration can be removed like this
188
189.Example: Deleting an APN
190----
191OsmoGGSN> enable <1>
192OsmoGGSN# configure terminal <2>
193OsmoGGSN(config)# ggsn ggsn0 <3>
194OsmoGGSN(config-ggsn)# no apn internet <4>
195----
196<1> Change into privileged mode
197<2> Enter the interactive configuration mode
198<3> Enter the config node of the GGSN instance `ggsn0`
199<4> Delete the APN `internet`
200
Maxa4cb0262017-09-22 14:36:51 +0200201[[unshutdown_apn]]
Harald Welte8a1e7b82017-09-06 12:35:04 +0200202==== Taking an APN out of shutdown
203
204In order to bring a deactived APN in `shutdown` state into active
205operation, use the `no shutdown` command at the APN node as explained in
206the following example:
207
208.Example: Taking an APN out of shutdown
209----
210OsmoGGSN> enable <1>
211OsmoGGSN# configure terminal <2>
212OsmoGGSN(config)# ggsn ggsn0 <3>
213OsmoGGSN(config-ggsn)# apn internet <4>
214OsmoGGSN(config-ggsn-apn)# no shutdown <5>
215----
216<1> Change into privileged mode
217<2> Enter the interactive configuration mode
218<3> Enter the config ndoe of the GGSN instance `ggsn0`
219<4> Enter the config ndoe of the APN `internet`
220<5> Take the APN out of shutdown
221
222
223==== Shutting an APN down
224
225If you would like to take an APN instance out of service, you can
226put it into shutdown mode. This will make the APN unavailable
227to user traffic and permit you to e.g. reconfigure it before taking it
228out of shutdown again.
229
230.Example: Shutting down an APN
231----
232OsmoGGSN> enable <1>
233OsmoGGSN# configure terminal <2>
234OsmoGGSN(config)# ggsn ggsn0 <3>
235OsmoGGSN(config-ggsn)# apn internet <4>
236OsmoGGSN(config-ggsn-apn)# shutdown <5>
237----
238<1> Change into privileged mode
239<2> Enter the interactive configuration mode
240<3> Enter the config ndoe of the GGSN instance `ggsn0`
241<4> Enter the config ndoe of the APN `internet`
242<5> Shut down the APN
243
Maxa4cb0262017-09-22 14:36:51 +0200244[[ggsn_no_root]]
245=== Configuring for running without root priveleges
246
247It's possible to run OsmoGGSN without root privileges if the tun devices are already configured.
248
Harald Welte3ce5a362017-10-12 21:37:48 +0800249The interface creation + configuration must then happen before osmo-ggsn starting up. This can be
250achieved by means such as
251
252* a custom shell script run as root before starting osmo-ggsn (e.g. as init script)
253* systemd .netdev and .network files
254
255==== Manual TUN device creation / configuration
256
257If you chose to go for custom shell/init scripts, you may use the `ip` program which is the standard
258tool for network interface configuration on Linux, part of the `iproute2` package. In order to
259create a tun device, you must call it like this:
260
261.Example: iproute2 command to create a tun device
262----
263# ip tuntap add dev apn0 mode tun user username group groupname
264----
265
266Where _username_ and _groupname_ correspond to the User and Group that will have ownership over the
267device, i.e. the privileges which you intend to run osmo-ggsn under, and _apn0_ will be the
268name of the network device created. After creating the interface, you can configure its addresses
269using standard means like `ip addr add` or your distribution-specific utilities/tools.
270
271
272==== systemd based TUN device creation+configuration
273
274If you want to have systemd take care of creating and configuring a tun device for you,
275you can use the below example config files.
276
277.Example: device config via systemd-networkd using apn0.netdev
Maxa4cb0262017-09-22 14:36:51 +0200278----
279[NetDev]
Harald Welte3ce5a362017-10-12 21:37:48 +0800280Name=apn0 <1>
Maxa4cb0262017-09-22 14:36:51 +0200281Kind=tun
282
283[Tun]
Harald Welte3ce5a362017-10-12 21:37:48 +0800284User=username <2>
285Group=username <3>
Maxa4cb0262017-09-22 14:36:51 +0200286----
Harald Welte3ce5a362017-10-12 21:37:48 +0800287<1> The network interface name of the newly-created device
288<2> The username under which you will run OsmoGGSN
289<3> The group name under which you will run OsmoGGSN
Maxa4cb0262017-09-22 14:36:51 +0200290
291.Example: network settings via systemd-networkd using ggsn.network
292----
293[Match]
Harald Welte3ce5a362017-10-12 21:37:48 +0800294Name=apn0 <1>
Maxa4cb0262017-09-22 14:36:51 +0200295
296[Network]
Harald Welte3ce5a362017-10-12 21:37:48 +0800297Address=192.168.7.1 <2>
298IPMasquerade=yes <3>
Maxa4cb0262017-09-22 14:36:51 +0200299----
Harald Welte3ce5a362017-10-12 21:37:48 +0800300<1> The netowrk device name, which must match the one in the apn0.netdev unit file above
301<2> The local IP address configured on the device
302<3> Requesting systemd to configure IP masquerading for this interface. Depending on your needs,
303 You may not want this if you have proper end-to-end routing set up, and want to have transparent
304 inbound IP access to your GPRS-attached devices.
Maxa4cb0262017-09-22 14:36:51 +0200305
306The pair of the configuration files above allows you to create and configure tun device which can be
307used by OsmoGGSN as follows.
308
309.Example: using externally configured tun device as non-root
310----
311ggsn ggsn0
312 gtp state-dir /tmp
313 gtp bind-ip 127.0.0.6
314 apn internet
315 gtpu-mode tun
Harald Welte3ce5a362017-10-12 21:37:48 +0800316 tun-device apn0
Maxa4cb0262017-09-22 14:36:51 +0200317 type-support v4
318 ip prefix dynamic 192.168.7.0/24
319 ip dns 0 192.168.100.1
320 ip dns 1 8.8.8.8
321 no shutdown
322 default-apn internet
323 no shutdown ggsn
324----