OpenBSC GPRS » History » Version 11
Anonymous, 02/19/2016 10:47 PM
add osmopcu and troubleshooting info
1 | 1 | tnt | [[PageOutline]] |
---|---|---|---|
2 | |||
3 | = OpenBSC GPRS/EDGE Setup page = |
||
4 | |||
5 | == Pre-requisites == |
||
6 | |||
7 | 11 | tnt | * SDR transceiver: SysmoBTS, USRP, UmTRX, nano BTS with GPRS or EDGE support. BS-11 are not supported. |
8 | 6 | tnt | * A compiled GGSN from OpenGGSN (make sure to use the osmocom version. git://git.osmocom.org/openggsn.git ) |
9 | 2 | tnt | * A working and up-to-date OpenBSC (see [wiki:Building_OpenBSC]) |
10 | 3 | tnt | * You will need to (re-)build it after having installed OpenGGSN so that the `libgtp` is detected and the SGSN binary `osmo-sgsn` built. |
11 | 8 | tnt | * A custom SIM for your network |
12 | * Currently osmo-sgsn refuses all roaming, so you need a SIM that matches your custom MCC/MNC network |
||
13 | 1 | tnt | |
14 | == Setup == |
||
15 | |||
16 | 3 | tnt | First a little picture to illustrate the different elements and their interactions : |
17 | 1 | tnt | |
18 | 8 | tnt | [[Image(gprs.2.png)]] |
19 | 1 | tnt | |
20 | 9 | tnt | === Compiling OpenBSC with [E]GPRS === |
21 | |||
22 | 11 | tnt | The guide below was tested on Ubuntu 15.10 but should work on Debian as well. |
23 | 9 | tnt | |
24 | First you need to download all dependencies: |
||
25 | |||
26 | {{{ |
||
27 | 11 | tnt | apt install libdbi0-dev libdbd-sqlite3 libtool autoconf git-core pkg-config make libortp-dev |
28 | 9 | tnt | }}} |
29 | |||
30 | Next, download the OpenGGSN source code: |
||
31 | {{{ |
||
32 | git clone git://git.osmocom.org/openggsn.git |
||
33 | 1 | tnt | }}} |
34 | 9 | tnt | |
35 | Compile OpenGGSN: |
||
36 | {{{ |
||
37 | 11 | tnt | cd openggsn |
38 | dpkg-buildpackage -tc -uc -us |
||
39 | sudo dpkg -i ../*.deb |
||
40 | 9 | tnt | }}} |
41 | 1 | tnt | |
42 | 9 | tnt | Now download everything else: |
43 | 1 | tnt | {{{ |
44 | 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 |
45 | 1 | tnt | }}} |
46 | |||
47 | Compile the rest: |
||
48 | {{{ |
||
49 | 11 | tnt | cd libosmocore; dpkg-buildpackage -tc -uc -us; sudo dpkg -i ../*.deb |
50 | cd libosmo-abis; dpkg-buildpackage -tc -uc -us; sudo dpkg -i ../*.deb |
||
51 | cd libosmo-netif; dpkg-buildpackage -tc -uc -us; sudo dpkg -i ../*.deb |
||
52 | cd openbsc/openbsc; dpkg-buildpackage -tc -uc -us; sudo dpkg -i ../*.deb |
||
53 | 9 | tnt | }}} |
54 | |||
55 | 11 | tnt | You should now have a working copy of ggsn, osmo-sgsn and osmo-nitb on your machine. You will also need OsmoPCU: |
56 | {{{ |
||
57 | git clone git://git.osmocom.org/osmo-pcu |
||
58 | autoreconf -if |
||
59 | ./configure |
||
60 | make |
||
61 | }}} |
||
62 | 9 | tnt | |
63 | 11 | tnt | It can be executed in-place - no installation necessary. |
64 | |||
65 | 1 | tnt | === OpenBSC configuration === |
66 | |||
67 | 3 | tnt | The first step is to configure OpenBSC for gprs support. Add this to the `network/bts` node in `openbsc.cfg`: |
68 | 1 | tnt | {{{ |
69 | 3 | tnt | gprs mode gprs |
70 | gprs routing area 0 |
||
71 | gprs cell bvci 2 |
||
72 | gprs nsei 101 |
||
73 | gprs nsvc 0 nsvci 101 |
||
74 | gprs nsvc 0 local udp port 23000 |
||
75 | gprs nsvc 0 remote udp port 23000 |
||
76 | gprs nsvc 0 remote ip 192.168.0.128 |
||
77 | 1 | tnt | }}} |
78 | |||
79 | 3 | 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. |
80 | |||
81 | 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 : |
||
82 | 2 | tnt | {{{ |
83 | 3 | tnt | phys_chan_config PDCH |
84 | 2 | tnt | }}} |
85 | 1 | tnt | |
86 | |||
87 | 2 | tnt | === Osmocom SGSN configuration === |
88 | 4 | tnt | |
89 | Here's a sample SGSN configuration file `osmo-sgsn.cfg` with some explanations : |
||
90 | 2 | tnt | |
91 | {{{ |
||
92 | ! |
||
93 | ! Osmocom SGSN configuration |
||
94 | ! |
||
95 | ! |
||
96 | line vty |
||
97 | no login |
||
98 | ! |
||
99 | sgsn |
||
100 | gtp local-ip 192.168.1.128 |
||
101 | ggsn 0 remote-ip 192.168.1.129 |
||
102 | ggsn 0 gtp-version 1 |
||
103 | ! |
||
104 | ns |
||
105 | timer tns-block 3 |
||
106 | timer tns-block-retries 3 |
||
107 | timer tns-reset 3 |
||
108 | timer tns-reset-retries 3 |
||
109 | timer tns-test 30 |
||
110 | timer tns-alive 3 |
||
111 | timer tns-alive-retries 10 |
||
112 | encapsulation udp local-ip 192.168.0.128 |
||
113 | encapsulation udp local-port 23000 |
||
114 | encapsulation framerelay-gre enabled 0 |
||
115 | ! |
||
116 | bssgp |
||
117 | ! |
||
118 | 1 | tnt | }}} |
119 | 4 | tnt | |
120 | * The `gtp local-ip` entry is the local IP the SGSN will bind to. |
||
121 | 1 | tnt | * The `ggsn 0 remote-ip` entry if the remote IP of the GGSN. The SGSN will connect to it. |
122 | 9 | tnt | * 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. |
123 | 4 | tnt | * The `encapsulation` settings must be the same IP/port than you've setup in `openbsc.cfg` |
124 | |||
125 | 2 | tnt | === OpenGGSN configuration === |
126 | 4 | tnt | |
127 | The ggsn.conf file is pretty well documented. What is mostly of interest here is : |
||
128 | |||
129 | * The configuration of the GTP link. (Must match the `ggsn 0 remote-ip` entry in `osmo-sgsn.cfg`) |
||
130 | 2 | tnt | |
131 | 1 | tnt | {{{ |
132 | 2 | tnt | # TAG: listen |
133 | # Specifies the local IP address to listen to |
||
134 | listen 192.168.1.129 |
||
135 | }}} |
||
136 | |||
137 | 4 | tnt | * The configuration given to phones, IP pool & DNS. |
138 | |||
139 | 1 | tnt | {{{ |
140 | # TAG: dynip |
||
141 | # Dynamic IP address pool. |
||
142 | # Used for allocation of dynamic IP address when address is not given |
||
143 | # by HLR. |
||
144 | # If this option is not given then the net option is used as a substitute. |
||
145 | 11 | tnt | # dynip 192.168.254.0/24 |
146 | 1 | tnt | |
147 | # TAG: pcodns1/pcodns2 |
||
148 | # Protocol configuration option domain name system server 1 & 2. |
||
149 | pcodns1 208.67.222.222 |
||
150 | 2 | tnt | pcodns2 208.67.220.220 |
151 | }}} |
||
152 | |||
153 | 11 | tnt | === OsmoPCU configuration === |
154 | |||
155 | {{{ |
||
156 | pcu |
||
157 | flow-control-interval 10 |
||
158 | cs 2 |
||
159 | alloc-algorithm dynamic |
||
160 | alpha 0 |
||
161 | gamma 0 |
||
162 | }}} |
||
163 | |||
164 | 1 | tnt | === Network configuration === |
165 | |||
166 | You will also need to configure some networking rules to allow connectivity from `tun0`. Look up linux networking/nat howtos on google. |
||
167 | The basic setup for testing only in a safe environment would be : |
||
168 | |||
169 | {{{ |
||
170 | bash# echo 1 > /proc/sys/net/ipv4/ip_forward |
||
171 | bash# iptables -A POSTROUTING -s 192.168.254.0/24 -t nat -o eth0 -j MASQUERADE |
||
172 | }}} |
||
173 | |||
174 | (replace `eth0` by the interface providing your machine connectivity) |
||
175 | |||
176 | == Running == |
||
177 | |||
178 | 11 | tnt | Sample startup sequence (adjust logging and configuration files location as you see fit): |
179 | {{{ |
||
180 | 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 |
||
181 | sudo ggsn -c ~/.config/osmocom/ggsn.conf -f -d |
||
182 | osmo-sgsn -c ~/.config/osmocom/osmo-sgsn.cfg -d DRLL:DCC:DMM:DRR:DNM:DMSC:DHO:DGPRS:DNS:DLLC:DCTRL |
||
183 | |||
184 | cd osmo-trx/Transceiver52M |
||
185 | sudo chrt 20 ./osmo-trx |
||
186 | cd osmo-bts/src/osmo-bts-trx |
||
187 | 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 |
||
188 | |||
189 | osmo-pcu/src |
||
190 | sudo ./osmo-pcu -c ~/.config/osmocom/osmo-pcu.cfg |
||
191 | }}} |
||
192 | |||
193 | 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). 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. |
||
194 | |||
195 | == Troubleshooting == |
||
196 | |||
197 | * 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. |
||
198 | * check that NAT and packet forwarding works properly. Something like this: |
||
199 | |||
200 | {{{ |
||
201 | [Match] |
||
202 | Name=tun* |
||
203 | |||
204 | [Network] |
||
205 | Description=Expose GGSN's connected mobiles to Internet |
||
206 | IPForward=ipv4 |
||
207 | IPMasquerade=yes |
||
208 | Address=192.168.0.1 |
||
209 | }}} |
||
210 | might be necessary for systemd-networkd. |
||
211 | 4 | tnt | |
212 | You can access vty from |
||
213 | 6 | tnt | * OpenBSC on port 4242 See [wiki:osmo-nitb_VTY] |
214 | 5 | tnt | * SGSN on port 4245. See [wiki:osmo-sgsn_VTY] |