Project

General

Profile

OpenBSC GPRS » History » Version 15

laforge, 02/27/2016 08:48 PM

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 14 laforge
h3. [[OpenGGSN:]] configuration
138 12 tnt
139
140 2 tnt
The ggsn.conf file is pretty well documented. What is mostly of interest here is :
141 1 tnt
142 12 tnt
* The configuration of the GTP link. (Must match the @ggsn 0 remote-ip@ entry in @osmo-sgsn.cfg@)
143 2 tnt
144 12 tnt
<pre>
145 2 tnt
# TAG: listen
146 4 tnt
# Specifies the local IP address to listen to
147
listen 192.168.1.129
148 12 tnt
</pre>
149 1 tnt
150 12 tnt
* The configuration given to phones, IP pool & DNS.
151 1 tnt
152 12 tnt
<pre>
153 1 tnt
# TAG: dynip
154
# Dynamic IP address pool.
155
# Used for allocation of dynamic IP address when address is not given
156
# by HLR.
157 11 tnt
# If this option is not given then the net option is used as a substitute.
158 1 tnt
# dynip 192.168.254.0/24
159
160
# TAG: pcodns1/pcodns2
161
# Protocol configuration option domain name system server 1 & 2.
162
pcodns1 208.67.222.222
163 2 tnt
pcodns2 208.67.220.220
164
</pre>
165 1 tnt
166 15 laforge
h3. [[OsmoPCU:]] configuration
167 12 tnt
168
169
<pre>
170 11 tnt
pcu
171
 flow-control-interval 10
172
 cs 2
173
 alloc-algorithm dynamic
174
 alpha 0
175
 gamma 0
176 12 tnt
</pre>
177 11 tnt
178
179 12 tnt
h3. Network configuration
180
181
182
You will also need to configure some networking rules to allow connectivity from @tun0@. Look up linux networking/nat howtos on google.
183 1 tnt
The basic setup for testing only in a safe environment would be :
184
185 12 tnt
<pre>
186 1 tnt
bash# echo 1 > /proc/sys/net/ipv4/ip_forward
187
bash# iptables -A POSTROUTING -s 192.168.254.0/24 -t nat -o eth0 -j MASQUERADE
188 12 tnt
</pre>
189 1 tnt
190 12 tnt
(replace @eth0@ by the interface providing your machine connectivity)
191 1 tnt
192
193 12 tnt
h2. Running
194
195
196 11 tnt
Sample startup sequence (adjust logging and configuration files location as you see fit):
197 12 tnt
<pre>
198 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
199
sudo ggsn -c ~/.config/osmocom/ggsn.conf -f -d
200 1 tnt
osmo-sgsn -c ~/.config/osmocom/osmo-sgsn.cfg -d DRLL:DCC:DMM:DRR:DNM:DMSC:DHO:DGPRS:DNS:DLLC:DCTRL
201 11 tnt
202 1 tnt
cd osmo-trx/Transceiver52M
203 11 tnt
sudo chrt 20 ./osmo-trx
204
cd osmo-bts/src/osmo-bts-trx
205
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
206
207
osmo-pcu/src
208
sudo ./osmo-pcu -c ~/.config/osmocom/osmo-pcu.cfg
209
</pre>
210
211 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). 
212 11 tnt
213 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.
214 11 tnt
215 13 laforge
216 12 tnt
h2. Troubleshooting
217
218
219 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.
220 1 tnt
* check that NAT and packet forwarding works properly. Something like this:
221
222 12 tnt
<pre>
223 11 tnt
[Match]
224
Name=tun*
225
226
[Network]
227
Description=Expose GGSN's connected mobiles to Internet
228 4 tnt
IPForward=ipv4
229
IPMasquerade=yes
230 6 tnt
Address=192.168.0.1
231 12 tnt
</pre>
232 1 tnt
might be necessary for systemd-networkd.
233
234
You can access vty from 
235 13 laforge
* [[OsmoNITB:]] on port 4242 See [[osmonitb:osmo-nitb_VTY]]
236
* [[OsmoSGSN:]] on port 4245. See [[osmosgsn:osmo-sgsn_VTY]]
Add picture from clipboard (Maximum size: 48.8 MB)