Project

General

Profile

OsmoNITB » History » Version 20

laforge, 03/05/2018 03:30 PM

1 1 zecke
h1. osmo-nitb
2 15 laforge
3 17 laforge
{{>toc}}
4 1 zecke
5 17 laforge
[[OsmoNITB:]] (formerly called _bsc_hack_) is the name of [[OpenBSC:]] in NITB (network in the box) mode.
6 1 zecke
7 18 laforge
See [[OpenBSC:OpenBSC#Configurations-Modes|OpenBSC Configurations and Modes]] to understand the difference between [[OsmoNITB:]] and [[OsmoBSC:]] mode.
8 1 zecke
9 20 laforge
{{include(cellular-infrastructure:MacroBinaryPackages)}}
10
11 17 laforge
h2. Manuals
12 1 zecke
13 17 laforge
* User Manual: http://ftp.osmocom.org/docs/latest/osmonitb-usermanual.pdf
14
* VTY Reference: http://ftp.osmocom.org/docs/latest/osmonitb-vty-reference.pdf
15
16 1 zecke
h2. Configuration
17
18
19 17 laforge
[[OsmoNITB:]] has a configuration file.  The default config file name is @openbsc.cfg@ in the current working directory of the osmo-nitb process.
20 15 laforge
21
You can specify an alternate config file location by using the @--config-file@ command line argument.
22 1 zecke
23 17 laforge
For more information, please see the User manual linked above.
24 15 laforge
25
26 1 zecke
h2. Dealing with the HLR
27 4 laforge
28 17 laforge
We currently use a quite simple sqlite3 database for the HLR.  In fact, it is more than just a HLR, since it actually stores entries even about any subscriber or phone that tries to log into your network.
29 1 zecke
30 17 laforge
We obtain the IMSI and IMEI of every LOCATION UPDATING REQUEST, and then if neccessary create a new entry for the equipment as well as the subscribers in the respective tables.
31 1 zecke
32 4 laforge
The schama looks like:
33 15 laforge
<pre>
34 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);
35 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) );
36 1 zecke
CREATE TABLE Meta (id INTEGER PRIMARY KEY AUTOINCREMENT, key TEXT UNIQUE NOT NULL, value TEXT NOT NULL);
37
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);
38 15 laforge
</pre>
39 1 zecke
40 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
41 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_.
42 12 laforge
43 1 zecke
You can allow everyone to join your network by using the _auth policy accept_ config file option.
44 15 laforge
45
46
h3. HLR modification using the telnet interface
47 1 zecke
48
49 15 laforge
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.
50 12 laforge
51 1 zecke
Then you can type statements like
52
53 15 laforge
<pre>
54 1 zecke
subscriber imsi 012340123456789 authorized 1
55 15 laforge
</pre>
56 1 zecke
 which will enable this subscriber to enter the network
57
58 15 laforge
<pre>
59 12 laforge
subscriber imsi 012340123456789 extension 5555
60 15 laforge
</pre>
61 1 zecke
 which will assign the telephone number 5555 to the subscriber with the specified IMSI
62
63 15 laforge
<pre>
64 1 zecke
subscriber imsi 012340123456789 name Peter
65 15 laforge
</pre>
66
 which will associate the name _Peter_ with the subscriber record
67 1 zecke
68 15 laforge
<pre>
69 1 zecke
show subscriber imsi 012340123456789
70 15 laforge
</pre>
71 1 zecke
 which will show you all information about the respective subscriber
72
73 15 laforge
<pre>
74 19 wirelesss
 subscriber imsi 012340123456789 sms sender imsi 987654321043210 send test123 
75 15 laforge
</pre>
76
 which will send a SMS with the content _test123_ to the respective subscriber
77 1 zecke
78 12 laforge
79 15 laforge
h3. Raw SQL access
80
81
82 1 zecke
Instead of the manual commands on the VTY, you can also directly access the underlying HLR SQL database table.
83 12 laforge
84
85 15 laforge
h4. Authorizing a particular IMSI
86
87
88 12 laforge
To authorize your mobile station you will need to execute the following comand:
89
90 15 laforge
<pre>
91 12 laforge
$ sqlite3 hlr.sqlite
92
update Subscriber set authorized=1 where imsi=YOUR_IMSI;
93 15 laforge
</pre>
94 12 laforge
95
96 15 laforge
h4. Assigning an extension number IMSI
97
98
99 5 laforge
In order to call a phone, you need to assign an extension number (phone number) for the IMSI.
100
101 15 laforge
In the following example, we assign the extension number _4444_:
102 7 laforge
103 15 laforge
<pre>
104 7 laforge
$ sqlite3 hlr.sqlite
105 12 laforge
update Subscriber set extension=4444 where imsi=YOUR_IMSI;
106 15 laforge
</pre>
107 7 laforge
108
109 15 laforge
h4. finding IMEIs for a given IMSI
110
111
112
<pre>
113 1 zecke
$ sqlite3 hlr.sqlite
114
select equipment.imei from equipment,equipmentwatch,subscriber where equipmentwatch.equipment_id=equipment.id and subscriber.id=equipmentwatch.subscriber_id and subscriber.imsi=YOUR_IMSI;
115 15 laforge
</pre>
116 13 ipse
117
118
h4. List IMSI to extensions mapping
119 15 laforge
120 13 ipse
121 1 zecke
<pre>
122 15 laforge
sqlite3 -line hlr.sqlite3 'select imsi,extension from subscriber;'
123
</pre>
124 1 zecke
125 15 laforge
126
h2. Common Problems
127
128
129
130
h3. Failed to init database
131
132
133
<pre>
134 8 laforge
$ ./osmo-nitb
135
DB: Failed to create connection.
136
DB: Failed to init database. Please check the option settings.
137 15 laforge
</pre>
138 8 laforge
139 9 laforge
This is most likely caused by one of the following problems
140 15 laforge
* the sqlite3 backend for DBD (dbd-sqlite3) has not been installed
141
* osmo-nitb does not have write permissions to the local directory
Add picture from clipboard (Maximum size: 48.8 MB)