Project

General

Profile

OpenBSC GPRS » History » Version 19

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