Project

General

Profile

OpenBSC GPRS » History » Version 13

laforge, 02/21/2016 10:53 AM

1 12 tnt
{{>toc}}
2 1 tnt
3
4 12 tnt
h1. [[OpenBSC]] GPRS/EDGE Setup page
5 1 tnt
6
7
8 12 tnt
h2. Pre-requisites
9
10
11 13 laforge
* BTS hardware: [[openbsc:sysmoBTS]], USRP, [[UmTRX:]], [[openbsc:nanoBTS]] with GPRS or EDGE support. [[openbsc:BS11]] are not supported.
12
* A compiled GGSN from [[OpenGGSN:]]
13
* A working and up-to-date [[OpenBSC:]] (see [[openbsc:Building_OpenBSC]])
14
*** You will need to (re-)build it after having installed [[OpenGGSN:]] so that the @libgtp@ is detected and the SGSN binary @osmo-sgsn@ built.
15 12 tnt
* A custom SIM for your network
16 13 laforge
*** Currently [[OsmoSGSN:]] refuses all roaming, so you need a SIM that matches your custom MCC/MNC network
17 12 tnt
18
19
h2. Setup
20
21
22 1 tnt
First a little picture to illustrate the different elements and their interactions :
23
24 13 laforge
!gprs.2.png!
25 1 tnt
26
27 13 laforge
h3. Compiling [[OpenBSC:]] with [E]GPRS
28 12 tnt
29
30 11 tnt
The guide below was tested on Ubuntu 15.10 but should work on Debian as well.
31 1 tnt
32
First you need to download all dependencies:
33 9 tnt
34 12 tnt
<pre>
35 9 tnt
apt install libdbi0-dev libdbd-sqlite3 libtool autoconf git-core pkg-config make libortp-dev
36 12 tnt
</pre>
37 9 tnt
38 13 laforge
Next, download the [[OpenGGSN:]] source code:
39 12 tnt
<pre>
40 11 tnt
git clone git://git.osmocom.org/openggsn.git
41 12 tnt
</pre>
42 1 tnt
43 13 laforge
Compile [[OpenGGSN:]]:
44 12 tnt
<pre>
45 1 tnt
cd openggsn
46
dpkg-buildpackage -tc -uc -us
47
sudo dpkg -i ../*.deb
48 12 tnt
</pre>
49 1 tnt
50
Now download everything else:
51 12 tnt
<pre>
52 11 tnt
git clone git://git.osmocom.org/libosmocore; git clone git://git.osmocom.org/libosmo-abis; git clone git://git.osmocom.org/libosmo-netif; git clone git://git.osmocom.org/openbsc
53 12 tnt
</pre>
54 9 tnt
55 11 tnt
Compile the rest:
56 12 tnt
<pre>
57 1 tnt
cd libosmocore; dpkg-buildpackage -tc -uc -us; sudo dpkg -i ../*.deb
58
cd libosmo-abis; dpkg-buildpackage -tc -uc -us; sudo dpkg -i ../*.deb
59
cd libosmo-netif; dpkg-buildpackage -tc -uc -us; sudo dpkg -i ../*.deb
60
cd openbsc/openbsc; dpkg-buildpackage -tc -uc -us; sudo dpkg -i ../*.deb
61 12 tnt
</pre>
62 1 tnt
63 12 tnt
You should now have a working copy of ggsn, osmo-sgsn and osmo-nitb on your machine. You will also need [[OsmoPCU]]:
64
<pre>
65 1 tnt
git clone git://git.osmocom.org/osmo-pcu 
66
autoreconf -if
67 11 tnt
./configure
68
make
69 12 tnt
</pre>
70 9 tnt
71 11 tnt
It can be executed in-place - no installation necessary.
72
73 1 tnt
74 13 laforge
h3. [[OpenBSC:]] configuration
75 12 tnt
76
77 13 laforge
The first step is to configure [[OpenBSC:]] for gprs support. Add this to the @network/bts@ node in @openbsc.cfg@:
78 12 tnt
<pre>
79 3 tnt
gprs mode gprs
80
gprs routing area 0
81
gprs cell bvci 2
82
gprs nsei 101
83
gprs nsvc 0 nsvci 101
84 2 tnt
gprs nsvc 0 local udp port 23000
85 3 tnt
gprs nsvc 0 remote udp port 23000
86 1 tnt
gprs nsvc 0 remote ip 192.168.0.128
87 12 tnt
</pre>
88 4 tnt
89 12 tnt
The @gprs nsvc 0 remote@ entries @192.168.0.128:23000@ is the IP/port of the machine running the SGSN as seen from the BTS. It will be sent by [[OpenBSC]] to the BTS in the configration phase and the BTS will connect back to the SGSN.
90 1 tnt
91 12 tnt
The second step is to allocate some timeslots to packet data. For this, just change the 1 or more @network/bts/trx/timeslot@ nodes using :
92
<pre>
93 1 tnt
phys_chan_config PDCH
94 12 tnt
</pre>
95 1 tnt
96
97
98 13 laforge
h3. [[OsmoSGSN:]] configuration
99 1 tnt
100 12 tnt
101
Here's a sample SGSN configuration file @osmo-sgsn.cfg@ with some explanations :
102
103
<pre>
104 1 tnt
!
105
! Osmocom SGSN configuration
106 2 tnt
!
107
!
108
line vty
109
 no login
110
!
111
sgsn
112
 gtp local-ip 192.168.1.128
113
 ggsn 0 remote-ip 192.168.1.129
114
 ggsn 0 gtp-version 1
115
!
116 1 tnt
ns
117
 timer tns-block 3
118
 timer tns-block-retries 3
119
 timer tns-reset 3
120
 timer tns-reset-retries 3
121
 timer tns-test 30
122 4 tnt
 timer tns-alive 3
123
 timer tns-alive-retries 10
124 1 tnt
 encapsulation udp local-ip 192.168.0.128
125 9 tnt
 encapsulation udp local-port 23000
126 1 tnt
 encapsulation framerelay-gre enabled 0
127
!
128
bssgp
129
!
130 12 tnt
</pre>
131 4 tnt
132 12 tnt
* The @gtp local-ip@ entry is the local IP the SGSN will bind to.
133
* The @ggsn 0 remote-ip@ entry if the remote IP of the GGSN. The SGSN will connect to it.
134
* Those two IPs *must* be different even if you're running both processes on the same machine. A solution for that is to put several IP aliases on the same network interface or use the loopback interface.
135
* The @encapsulation@ settings must be the same IP/port than you've setup in @openbsc.cfg@
136 4 tnt
137 1 tnt
138 12 tnt
h3. [[OpenGGSN]] configuration
139
140
141 2 tnt
The ggsn.conf file is pretty well documented. What is mostly of interest here is :
142 1 tnt
143 12 tnt
* The configuration of the GTP link. (Must match the @ggsn 0 remote-ip@ entry in @osmo-sgsn.cfg@)
144 2 tnt
145 12 tnt
<pre>
146 2 tnt
# TAG: listen
147 4 tnt
# Specifies the local IP address to listen to
148
listen 192.168.1.129
149 12 tnt
</pre>
150 1 tnt
151 12 tnt
* The configuration given to phones, IP pool & DNS.
152 1 tnt
153 12 tnt
<pre>
154 1 tnt
# TAG: dynip
155
# Dynamic IP address pool.
156
# Used for allocation of dynamic IP address when address is not given
157
# by HLR.
158 11 tnt
# If this option is not given then the net option is used as a substitute.
159 1 tnt
# dynip 192.168.254.0/24
160
161
# TAG: pcodns1/pcodns2
162
# Protocol configuration option domain name system server 1 & 2.
163
pcodns1 208.67.222.222
164 2 tnt
pcodns2 208.67.220.220
165 12 tnt
</pre>
166 2 tnt
167 1 tnt
168 12 tnt
h3. [[OsmoPCU]] configuration
169
170
171
<pre>
172 11 tnt
pcu
173
 flow-control-interval 10
174
 cs 2
175
 alloc-algorithm dynamic
176
 alpha 0
177
 gamma 0
178 12 tnt
</pre>
179 11 tnt
180
181 12 tnt
h3. Network configuration
182
183
184
You will also need to configure some networking rules to allow connectivity from @tun0@. Look up linux networking/nat howtos on google.
185 1 tnt
The basic setup for testing only in a safe environment would be :
186
187 12 tnt
<pre>
188 1 tnt
bash# echo 1 > /proc/sys/net/ipv4/ip_forward
189
bash# iptables -A POSTROUTING -s 192.168.254.0/24 -t nat -o eth0 -j MASQUERADE
190 12 tnt
</pre>
191 1 tnt
192 12 tnt
(replace @eth0@ by the interface providing your machine connectivity)
193 1 tnt
194
195 12 tnt
h2. Running
196
197
198 11 tnt
Sample startup sequence (adjust logging and configuration files location as you see fit):
199 12 tnt
<pre>
200 11 tnt
osmo-nitb -s -c ~/.config/osmocom/open-bsc.cfg -l ~/.config/osmocom/hlr.sqlite3 -P -m -C -T --debug=DSQL:DLSMS:DRLL:DCC:DMM:DRR:DMSC:DHO:DGPRS:DNS:DLLC:DCTRL 2>&1 | tee /tmp/openbsc.log
201
sudo ggsn -c ~/.config/osmocom/ggsn.conf -f -d
202 1 tnt
osmo-sgsn -c ~/.config/osmocom/osmo-sgsn.cfg -d DRLL:DCC:DMM:DRR:DNM:DMSC:DHO:DGPRS:DNS:DLLC:DCTRL
203 11 tnt
204 1 tnt
cd osmo-trx/Transceiver52M
205 11 tnt
sudo chrt 20 ./osmo-trx
206
cd osmo-bts/src/osmo-bts-trx
207
sudo chrt 15 ./osmobts-trx -c ~/.config/osmocom/osmo-bts.cfg -i 224.0.0.1 -d DRLL:DCC:DMM:DRR:DNM:DMSC:DHO:DGPRS:DNS:DLLC:DCTRL
208
209
osmo-pcu/src
210
sudo ./osmo-pcu -c ~/.config/osmocom/osmo-pcu.cfg
211
</pre>
212
213 13 laforge
Note: [[OsmoTRX:]] is only necessary with USRP/UmTRX transceivers (At the time of writing 201509-fairwaves-rebase branch of [[OsmoBTS:]] is necessary as well for compatibility). 
214 11 tnt
215 13 laforge
Once you're done with experimenting and ready for production setup it might be convenient to create systemd units so all the parts are started automatically.
216 11 tnt
217 13 laforge
218 12 tnt
h2. Troubleshooting
219
220
221 11 tnt
* double-check that your phones have APN set to something. "Internet" will do for example. The value of APN is not checked but if it's unset the phones' baseband might not even try to initiate GPRS connection.
222 1 tnt
* check that NAT and packet forwarding works properly. Something like this:
223
224 12 tnt
<pre>
225 11 tnt
[Match]
226
Name=tun*
227
228
[Network]
229
Description=Expose GGSN's connected mobiles to Internet
230 4 tnt
IPForward=ipv4
231
IPMasquerade=yes
232 6 tnt
Address=192.168.0.1
233 12 tnt
</pre>
234 1 tnt
might be necessary for systemd-networkd.
235
236
You can access vty from 
237 13 laforge
* [[OsmoNITB:]] on port 4242 See [[osmonitb:osmo-nitb_VTY]]
238
* [[OsmoSGSN:]] on port 4245. See [[osmosgsn:osmo-sgsn_VTY]]
Add picture from clipboard (Maximum size: 48.8 MB)