Project

General

Profile

OsmoNITB » History » Version 15

laforge, 02/19/2016 10:48 PM

1 15 laforge
{{>toc}}
2 3 laforge
3 15 laforge
h1. osmo-nitb
4 1 zecke
5
6 15 laforge
_osmo-nitb_ (formerly called _bsc_hack_) is the executable program name of [[OpenBSC]] in NITB (network in the box) mode.
7 1 zecke
8 15 laforge
See [[OpenBSC#ConfigurationsModes|Configurations and Modes]] to understand the difference between [[OsmoNITB]] and [[OsmoBSC]] mode.
9 1 zecke
10
11 15 laforge
h2. Configuration
12 1 zecke
13
14 15 laforge
[[OpenBSC]] has a configuration file.  The default config file name is _openbsc.cfg_ in the current working directory of the osmo-nitb process.
15 1 zecke
16 15 laforge
You can specify an alternate config file location by using the _--config-file_ command line argument.
17
18
<pre>
19
<pre>
20
<pre>
21
<pre>
22
<pre>
23
<pre>
24
<pre>
25
<pre>
26
27
For more information, plase see the [[osmo-nitb_VTY]] reference.
28
29
30
h2. Command Reference
31
32
33
<pre>
34 6 zecke
netzing@btsDev:~/openbsc/openbsc/src> ./osmo-nitb --help
35 1 zecke
Usage: osmo-nitb
36 9 laforge
  Some useful help...
37
  -h --help this text
38 6 zecke
  -d option --debug=DRLL:DCC:DMM:DRR:DRSL:DNM enable debugging
39
  -s --disable-color
40
  -c --config-file filename The config file to use.
41
  -l --database db-name The database to use
42
  -r --reject-cause number The reject cause for LOCATION UPDATING REJECT.
43
  -p --pcap file  The filename of the pcap file
44
  -T --timestamp Prefix every log line with a timestamp
45 15 laforge
</pre>
46 6 zecke
47 3 laforge
48 15 laforge
h3. BS-11
49
50
51 3 laforge
you will see something like
52 15 laforge
<pre>
53 3 laforge
DB: Database initialized.
54
DB: Database prepared.
55
1 device found
56
        id:             0
57
        Dprotocols:     00000018
58 1 zecke
        Bprotocols:     0000000e
59
        protocol:       4
60 3 laforge
        nrbchan:        30
61 1 zecke
        name:           hfc-e1.1
62
activate bchan
63
bootstrapping OML
64
Thu Feb 19 04:22:48 2009 <0020> abis_nm.c:1376 Set Chan Attr (bts=0,trx=0,ts=0)
65 4 laforge
Thu Feb 19 04:22:48 2009 <0020> abis_nm.c:1376 Set Chan Attr (bts=0,trx=0,ts=1)
66 1 zecke
Thu Feb 19 04:22:48 2009 <0020> abis_nm.c:1315 CONNECT TERR TRAF Um=(0,0,1) E1=(0,2,1)
67
Thu Feb 19 04:22:48 2009 <0020> abis_nm.c:1376 Set Chan Attr (bts=0,trx=0,ts=2)
68
Thu Feb 19 04:22:48 2009 <0020> abis_nm.c:1315 CONNECT TERR TRAF Um=(0,0,2) E1=(0,2,2)
69
Thu Feb 19 04:22:48 2009 <0020> abis_nm.c:1376 Set Chan Attr (bts=0,trx=0,ts=3)
70 4 laforge
Thu Feb 19 04:22:48 2009 <0020> abis_nm.c:1315 CONNECT TERR TRAF Um=(0,0,3) E1=(0,2,3)
71
Thu Feb 19 04:22:48 2009 <0020> abis_nm.c:1376 Set Chan Attr (bts=0,trx=0,ts=4)
72
Thu Feb 19 04:22:48 2009 <0020> abis_nm.c:1315 CONNECT TERR TRAF Um=(0,0,4) E1=(0,3,0)
73 1 zecke
Thu Feb 19 04:22:48 2009 <0020> abis_nm.c:1376 Set Chan Attr (bts=0,trx=0,ts=5)
74 4 laforge
Thu Feb 19 04:22:48 2009 <0020> abis_nm.c:1315 CONNECT TERR TRAF Um=(0,0,5) E1=(0,3,1)
75 1 zecke
Thu Feb 19 04:22:48 2009 <0020> abis_nm.c:1376 Set Chan Attr (bts=0,trx=0,ts=6)
76
Thu Feb 19 04:22:48 2009 <0020> abis_nm.c:1315 CONNECT TERR TRAF Um=(0,0,6) E1=(0,3,2)
77 4 laforge
Thu Feb 19 04:22:48 2009 <0020> abis_nm.c:1376 Set Chan Attr (bts=0,trx=0,ts=7)
78 1 zecke
Thu Feb 19 04:22:48 2009 <0020> abis_nm.c:1315 CONNECT TERR TRAF Um=(0,0,7) E1=(0,3,3)
79
bootstrapping RSL MCC=1 MNC=1
80 15 laforge
</pre>
81 1 zecke
82 6 zecke
83 15 laforge
h3. ip.access nanoBTS
84 1 zecke
85 15 laforge
86
we assume you have a [[nanoBTS]] configured with its primary OML link to the IP address of your Linux PC.
87
88 4 laforge
After starting osmo-nitb will just wait for your nanoBTS to connect, which can take quite a while.
89 1 zecke
90
91 15 laforge
h2. Dealing with the HLR
92
93
94 1 zecke
We currently use a quite simple sqlite3 database for the HLR.  In fact, it is more than just a HLR, since it actually stores
95 4 laforge
entries even about any subscriber or phone that tries to log into your network.
96 1 zecke
97
We obtain the IMSI and IMEI of every LOCATION UPDATING REQUEST, and then if neccessary create a new entry for the equipment
98
as well as the subscribers in the respective tables.
99
100 4 laforge
The schama looks like:
101 15 laforge
<pre>
102 1 zecke
CREATE TABLE Equipment (id INTEGER PRIMARY KEY AUTOINCREMENT, created TIMESTAMP NOT NULL, updated TIMESTAMP NOT NULL, imei NUMERIC UNIQUE NOT NULL, name TEXT);
103 15 laforge
CREATE TABLE [[EquipmentWatch]] (id INTEGER PRIMARY KEY AUTOINCREMENT, created TIMESTAMP NOT NULL, updated TIMESTAMP NOT NULL, subscriber_id NUMERIC NOT NULL, equipment_id NUMERIC NOT NULL, UNIQUE (subscriber_id, equipment_id) );
104 1 zecke
CREATE TABLE Meta (id INTEGER PRIMARY KEY AUTOINCREMENT, key TEXT UNIQUE NOT NULL, value TEXT NOT NULL);
105
CREATE TABLE Subscriber (id INTEGER PRIMARY KEY AUTOINCREMENT, created TIMESTAMP NOT NULL, updated TIMESTAMP NOT NULL, imsi NUMERIC UNIQUE NOT NULL, name TEXT, extension TEXT UNIQUE, authorized INTEGER NOT NULL DEFAULT 0, tmsi TEXT UNIQUE, lac INTEGER NOT NULL DEFAULT 0);
106 15 laforge
</pre>
107 1 zecke
108 12 laforge
If the subscrber.authorized field is set to '1', then we allocate a TMSI and answer with LOCATION UPDATING ACCEPT.  Otherwise, we send
109 15 laforge
a regular LOCATION UPDATING REJECT to refuse the mobile to roam to our network.  You can change the reject cause using _--reject-cause_.
110 1 zecke
111 15 laforge
You can allow everyone to join your network by using the _auth policy accept_ config file option.
112 12 laforge
113 1 zecke
114 15 laforge
h3. HLR modification using the telnet interface
115
116
117 1 zecke
You can telnet to port 4242 of the machine that runs osmo-nitb and try some of the commands, e.g. for dealing with subscribers.
118
119 15 laforge
<pre>
120 12 laforge
121 1 zecke
Then you can type statements like
122
123 15 laforge
<pre>
124 1 zecke
subscriber imsi 012340123456789 authorized 1
125 15 laforge
</pre>
126 1 zecke
 which will enable this subscriber to enter the network
127
128 15 laforge
<pre>
129 12 laforge
subscriber imsi 012340123456789 extension 5555
130 15 laforge
</pre>
131 1 zecke
 which will assign the telephone number 5555 to the subscriber with the specified IMSI
132
133 15 laforge
<pre>
134 1 zecke
subscriber imsi 012340123456789 name Peter
135 15 laforge
</pre>
136
 which will associate the name _Peter_ with the subscriber record
137 1 zecke
138 15 laforge
<pre>
139 1 zecke
show subscriber imsi 012340123456789
140 15 laforge
</pre>
141 1 zecke
 which will show you all information about the respective subscriber
142
143 15 laforge
<pre>
144 1 zecke
 subscriber imsi 012340123456789 sms send test123
145 15 laforge
</pre>
146
 which will send a SMS with the content _test123_ to the respective subscriber
147 1 zecke
148 12 laforge
149 15 laforge
h3. Raw SQL access
150
151
152 1 zecke
Instead of the manual commands on the VTY, you can also directly access the underlying HLR SQL database table.
153 12 laforge
154
155 15 laforge
h4. Authorizing a particular IMSI
156
157
158 12 laforge
To authorize your mobile station you will need to execute the following comand:
159
160 15 laforge
<pre>
161 12 laforge
$ sqlite3 hlr.sqlite
162
update Subscriber set authorized=1 where imsi=YOUR_IMSI;
163 15 laforge
</pre>
164 12 laforge
165
166 15 laforge
h4. Assigning an extension number IMSI
167
168
169 5 laforge
In order to call a phone, you need to assign an extension number (phone number) for the IMSI.
170
171 15 laforge
In the following example, we assign the extension number _4444_:
172 7 laforge
173 15 laforge
<pre>
174 7 laforge
$ sqlite3 hlr.sqlite
175 12 laforge
update Subscriber set extension=4444 where imsi=YOUR_IMSI;
176 15 laforge
</pre>
177 7 laforge
178
179 15 laforge
h4. finding IMEIs for a given IMSI
180
181
182
<pre>
183 1 zecke
$ sqlite3 hlr.sqlite
184 2 zecke
select equipment.imei from equipment,equipmentwatch,subscriber where equipmentwatch.equipment_id=equipment.id and subscriber.id=equipmentwatch.subscriber_id and subscriber.imsi=YOUR_IMSI;
185 15 laforge
</pre>
186 12 laforge
187 6 zecke
188 15 laforge
h4. List IMSI to extensions mapping
189
190
191
<pre>
192 1 zecke
sqlite3 -line hlr.sqlite3 'select imsi,extension from subscriber;'
193 15 laforge
</pre>
194 13 ipse
195
196
197 15 laforge
h2. Configuration via telnet / VTY
198 13 ipse
199 1 zecke
200 15 laforge
<pre>
201
configuration file. For more information, plase see the [[osmo-nitb_VTY]] reference.
202 1 zecke
203 15 laforge
204
h2. Common Problems
205
206
207
208
h3. Failed to init database
209
210
211
<pre>
212 8 laforge
$ ./osmo-nitb
213
DB: Failed to create connection.
214
DB: Failed to init database. Please check the option settings.
215 15 laforge
</pre>
216 8 laforge
217 9 laforge
This is most likely caused by one of the following problems
218 15 laforge
* the sqlite3 backend for DBD (dbd-sqlite3) has not been installed
219
* osmo-nitb does not have write permissions to the local directory
Add picture from clipboard (Maximum size: 48.8 MB)