Project

General

Profile

OsmoNITB » History » Version 21

laforge, 03/23/2018 12:59 PM

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