Project

General

Profile

OpenBSC GPRS » History » Version 17

wirelesss, 12/01/2016 05:54 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 17 wirelesss
Please follow instructions provided at [[Build_from_source]] in order to get, build and install packages:
39 12 tnt
40 17 wirelesss
 Note: For osmo-pcu command: make install is not needed. 
41 1 tnt
42 17 wirelesss
* openggsn
43
* libosmocore
44
* libosmo-abis
45
* libosmo-netif
46
* openbsc
47
* osmo-pcu
48 11 tnt
49 1 tnt
50 13 laforge
h3. [[OpenBSC:]] configuration
51 12 tnt
52
53 13 laforge
The first step is to configure [[OpenBSC:]] for gprs support. Add this to the @network/bts@ node in @openbsc.cfg@:
54 12 tnt
<pre>
55 3 tnt
gprs mode gprs
56
gprs routing area 0
57
gprs cell bvci 2
58
gprs nsei 101
59
gprs nsvc 0 nsvci 101
60 2 tnt
gprs nsvc 0 local udp port 23000
61 3 tnt
gprs nsvc 0 remote udp port 23000
62 1 tnt
gprs nsvc 0 remote ip 192.168.0.128
63 12 tnt
</pre>
64 4 tnt
65 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.
66 1 tnt
67 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 :
68
<pre>
69 1 tnt
phys_chan_config PDCH
70 12 tnt
</pre>
71 1 tnt
72
73
74 13 laforge
h3. [[OsmoSGSN:]] configuration
75 1 tnt
76 12 tnt
77
Here's a sample SGSN configuration file @osmo-sgsn.cfg@ with some explanations :
78
79
<pre>
80 1 tnt
!
81
! Osmocom SGSN configuration
82 2 tnt
!
83
!
84
line vty
85
 no login
86
!
87
sgsn
88
 gtp local-ip 192.168.1.128
89
 ggsn 0 remote-ip 192.168.1.129
90
 ggsn 0 gtp-version 1
91
!
92 1 tnt
ns
93
 timer tns-block 3
94
 timer tns-block-retries 3
95
 timer tns-reset 3
96
 timer tns-reset-retries 3
97
 timer tns-test 30
98 4 tnt
 timer tns-alive 3
99
 timer tns-alive-retries 10
100 1 tnt
 encapsulation udp local-ip 192.168.0.128
101 9 tnt
 encapsulation udp local-port 23000
102 1 tnt
 encapsulation framerelay-gre enabled 0
103
!
104
bssgp
105
!
106 12 tnt
</pre>
107 4 tnt
108 12 tnt
* The @gtp local-ip@ entry is the local IP the SGSN will bind to.
109
* The @ggsn 0 remote-ip@ entry if the remote IP of the GGSN. The SGSN will connect to it.
110
* 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.
111
* The @encapsulation@ settings must be the same IP/port than you've setup in @openbsc.cfg@
112 4 tnt
113 14 laforge
h3. [[OpenGGSN:]] configuration
114 12 tnt
115
116 2 tnt
The ggsn.conf file is pretty well documented. What is mostly of interest here is :
117 1 tnt
118 12 tnt
* The configuration of the GTP link. (Must match the @ggsn 0 remote-ip@ entry in @osmo-sgsn.cfg@)
119 2 tnt
120 12 tnt
<pre>
121 2 tnt
# TAG: listen
122 4 tnt
# Specifies the local IP address to listen to
123
listen 192.168.1.129
124 12 tnt
</pre>
125 1 tnt
126 12 tnt
* The configuration given to phones, IP pool & DNS.
127 1 tnt
128 12 tnt
<pre>
129 1 tnt
# TAG: dynip
130
# Dynamic IP address pool.
131
# Used for allocation of dynamic IP address when address is not given
132
# by HLR.
133 11 tnt
# If this option is not given then the net option is used as a substitute.
134 1 tnt
# dynip 192.168.254.0/24
135
136
# TAG: pcodns1/pcodns2
137
# Protocol configuration option domain name system server 1 & 2.
138
pcodns1 208.67.222.222
139 2 tnt
pcodns2 208.67.220.220
140
</pre>
141 1 tnt
142 15 laforge
h3. [[OsmoPCU:]] configuration
143 12 tnt
144
145
<pre>
146 11 tnt
pcu
147
 flow-control-interval 10
148
 cs 2
149
 alloc-algorithm dynamic
150
 alpha 0
151
 gamma 0
152 12 tnt
</pre>
153 11 tnt
154
155 12 tnt
h3. Network configuration
156
157
158
You will also need to configure some networking rules to allow connectivity from @tun0@. Look up linux networking/nat howtos on google.
159 1 tnt
The basic setup for testing only in a safe environment would be :
160
161 12 tnt
<pre>
162 1 tnt
bash# echo 1 > /proc/sys/net/ipv4/ip_forward
163
bash# iptables -A POSTROUTING -s 192.168.254.0/24 -t nat -o eth0 -j MASQUERADE
164 12 tnt
</pre>
165 1 tnt
166 12 tnt
(replace @eth0@ by the interface providing your machine connectivity)
167 1 tnt
168 16 dexter
In some cases the DNS server might be hardcoded in the phones APN settings. To work around this problem one might choose to enforce the usage of a specific DNS server by redirecting all DNS traffic via iptables:
169
170
<pre>
171
bash# iptables -t nat -I PREROUTING -i tun0 -p udp --dport 53 -j DNAT --to-dest 1.2.3.4
172
</pre>
173
174
(replace @1.2.3.4@ with the ip-address of your DNS-Server)
175 1 tnt
176 12 tnt
h2. Running
177
178
179 11 tnt
Sample startup sequence (adjust logging and configuration files location as you see fit):
180 12 tnt
<pre>
181 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
182
sudo ggsn -c ~/.config/osmocom/ggsn.conf -f -d
183 1 tnt
osmo-sgsn -c ~/.config/osmocom/osmo-sgsn.cfg -d DRLL:DCC:DMM:DRR:DNM:DMSC:DHO:DGPRS:DNS:DLLC:DCTRL
184 11 tnt
185 1 tnt
cd osmo-trx/Transceiver52M
186 11 tnt
sudo chrt 20 ./osmo-trx
187
cd osmo-bts/src/osmo-bts-trx
188
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
189
190
osmo-pcu/src
191
sudo ./osmo-pcu -c ~/.config/osmocom/osmo-pcu.cfg
192
</pre>
193
194 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). 
195 11 tnt
196 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.
197 11 tnt
198 13 laforge
199 12 tnt
h2. Troubleshooting
200
201
202 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.
203 1 tnt
* check that NAT and packet forwarding works properly. Something like this:
204
205 12 tnt
<pre>
206 11 tnt
[Match]
207
Name=tun*
208
209
[Network]
210
Description=Expose GGSN's connected mobiles to Internet
211 4 tnt
IPForward=ipv4
212
IPMasquerade=yes
213 6 tnt
Address=192.168.0.1
214 12 tnt
</pre>
215 1 tnt
might be necessary for systemd-networkd.
216
217
You can access vty from 
218 13 laforge
* [[OsmoNITB:]] on port 4242 See [[osmonitb:osmo-nitb_VTY]]
219
* [[OsmoSGSN:]] on port 4245. See [[osmosgsn:osmo-sgsn_VTY]]
Add picture from clipboard (Maximum size: 48.8 MB)