Project

General

Profile

OsmoNITB » History » Version 13

ipse, 02/19/2016 10:48 PM
List IMSI to extensions mapping (Raw SQL)

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