Adding osmo* stack for 2G (radio+core) & 3G (core)

This commit is contained in:
FlUxIuS 2024-07-03 17:10:47 +02:00
parent df792455d4
commit fb00ae8a36
No known key found for this signature in database
GPG Key ID: E8B96449EE4FA72F
16 changed files with 325 additions and 1 deletions

View File

@ -244,6 +244,7 @@ RUN ./entrypoint.sh srsran4G_5GNSA_soft_install
RUN ./entrypoint.sh srsran5GSA_soft_install RUN ./entrypoint.sh srsran5GSA_soft_install
RUN ./entrypoint.sh Open5GS_soft_install RUN ./entrypoint.sh Open5GS_soft_install
RUN ./entrypoint.sh pycrate_soft_install RUN ./entrypoint.sh pycrate_soft_install
RUN ./entrypoint.sh osmobts_suite_soft_install
RUN mkdir -p /sdrtools/ RUN mkdir -p /sdrtools/
COPY run /sdrtools/run COPY run /sdrtools/run

View File

@ -15,6 +15,7 @@ RUN apt-fast update
COPY scripts /root/scripts/ COPY scripts /root/scripts/
COPY rules /root/rules/ COPY rules /root/rules/
COPY config /root/config
WORKDIR /root/scripts/ WORKDIR /root/scripts/
RUN chmod +x entrypoint.sh RUN chmod +x entrypoint.sh
@ -27,6 +28,7 @@ RUN ./entrypoint.sh srsran4G_5GNSA_soft_install
RUN ./entrypoint.sh srsran5GSA_soft_install RUN ./entrypoint.sh srsran5GSA_soft_install
RUN ./entrypoint.sh Open5GS_soft_install RUN ./entrypoint.sh Open5GS_soft_install
RUN ./entrypoint.sh pycrate_soft_install RUN ./entrypoint.sh pycrate_soft_install
RUN ./entrypoint.sh osmobts_suite_soft_install
# More to come! # More to come!
RUN mkdir -p /sdrtools/ RUN mkdir -p /sdrtools/

View File

@ -0,0 +1,53 @@
network
network country code 901
mobile network code 70
bts 0
type sysmobts
band GSM-1800
location_area_code 23
# This is the unit id that has to match the BTS configuration
ip.access unit_id 1800 0
codec-support fr hr amr
gprs mode gprs
gprs nsvc 0 remote ip 192.168.0.9
gprs nsvc 0 remote udp port 23000
gprs nsvc 0 local udp port 23000
gprs nsvc 0 nsvci 1800
gprs nsei 1800
gprs cell bvci 1800
trx 0
rf_locked 0
arfcn 868
nominal power 23
timeslot 0
phys_chan_config CCCH+SDCCH4
timeslot 1
phys_chan_config SDCCH8
timeslot 2
phys_chan_config TCH/F_TCH/H_PDCH
timeslot 3
phys_chan_config TCH/F_TCH/H_PDCH
timeslot 4
phys_chan_config TCH/F_TCH/H_PDCH
timeslot 5
phys_chan_config TCH/F_TCH/H_PDCH
timeslot 6
phys_chan_config TCH/F_TCH/H_PDCH
timeslot 7
phys_chan_config PDCH
e1_input
e1_line 0 driver ipa
msc 0
mgw remote-ip 192.168.0.9
mgw remote-port 12427
allow-emergency deny
codec-list hr3
log stderr
logging filter all 1
logging print extended-timestamp 1
logging print category 1
logging print category-hex 0
logging print level 1
logging print file basename last
logging level set-all info

View File

@ -0,0 +1,24 @@
log stderr
logging level all debug
logging filter all 1
logging print category 1
ggsn ggsn0
gtp bind-ip 192.168.0.42
apn internet
tun-device apn0
type-support v4
ip dns 0 192.168.0.1
ip dns 1 9.9.9.9
ip prefix dynamic 192.168.42.0/24
no shutdown
default-apn internet
no shutdown ggsn
log stderr
logging filter all 1
logging print extended-timestamp 1
logging print category 1
logging print category-hex 0
logging print level 1
logging print file basename last
logging level set-all info

View File

@ -0,0 +1,12 @@
hlr
ussd route prefix *#100# internal own-msisdn
ussd route prefix *#101# internal own-imsi
log stderr
logging filter all 1
logging print extended-timestamp 1
logging print category 1
logging print category-hex 0
logging print level 1
logging print file basename last
logging level set-all debug

View File

@ -0,0 +1,17 @@
hnbgw
iuh
local-ip 192.168.0.9
mgcp
mgw remote-ip 192.168.0.9
mgw remote-port 22427
pfcp
remote-addr 192.168.0.9
log stderr
logging filter all 1
logging print extended-timestamp 1
logging print category 1
logging print category-hex 0
logging print level 1
logging print file basename last
logging level set-all info

View File

@ -0,0 +1,16 @@
mgcp
bind ip 192.168.0.9
# default port is 2427 (is used for MSC's MGW)
bind port 12427
line vty
# default VTY interface is on 127.0.0.1 (used for MSC's MGW)
bind 127.0.0.2
log stderr
logging filter all 1
logging print extended-timestamp 1
logging print category 1
logging print category-hex 0
logging print level 1
logging print file basename last
logging level set-all info

View File

@ -0,0 +1,14 @@
mgcp
bind ip 192.168.0.9
bind port 22427
line vty
bind 127.0.0.3
log stderr
logging filter all 1
logging print extended-timestamp 1
logging print category 1
logging print category-hex 0
logging print level 1
logging print file basename last
logging level set-all info

View File

@ -0,0 +1,13 @@
mgcp
bind ip 192.168.0.9
line vty
bind 127.0.0.1
log stderr
logging filter all 1
logging print extended-timestamp 1
logging print category 1
logging print category-hex 0
logging print level 1
logging print file basename last
logging level set-all info

View File

@ -0,0 +1,16 @@
network
network country code 901
mobile network code 70
msc
mgw remote-ip 192.168.0.9
# For nano3G:
iu rab-assign-addr-enc x213
log stderr
logging filter all 1
logging print extended-timestamp 1
logging print category 1
logging print category-hex 0
logging print level 1
logging print file basename last
logging level set-all info

View File

@ -0,0 +1,19 @@
sgsn
gtp local-ip 192.168.0.9
ggsn 0 remote-ip 192.168.0.42
ggsn 0 gtp-version 1
auth-policy remote
gsup remote-ip 127.0.0.1
ns
bind udp some
listen 192.168.1.20 23000
accept-ipaccess
log stderr
logging filter all 1
logging print extended-timestamp 1
logging print category 1
logging print category-hex 0
logging print level 1
logging print file basename last
logging level set-all info

View File

@ -0,0 +1,13 @@
cs7 instance 0
xua rkm routing-key-allocation dynamic-permitted
listen m3ua 2905
accept-asp-connections dynamic-permitted
log stderr
logging filter all 1
logging print extended-timestamp 1
logging print category 1
logging print category-hex 0
logging print level 1
logging print file basename last
logging level set-all info

View File

@ -0,0 +1,15 @@
pfcp
local-addr 192.168.0.9
nft
# netfilter requires no specifc configuration
gtp
# if encaps/decaps of GTP to "the internet" is required, uncomment the following line:
#dev create apn0
log stderr
logging filter all 1
logging print extended-timestamp 1
logging print category 1
logging print category-hex 0
logging print level 1
logging print file basename last
logging level set-all info

58
config/osmobts/nitb/vty Executable file
View File

@ -0,0 +1,58 @@
#!/usr/bin/expect -f
set vty [lindex $argv 0]
set host localhost
switch $vty {
hlr { set port 4258 }
bsc { set port 4242 }
mgw { set port 4243 }
mgw2 {
set host 127.0.0.2
set port 4243
}
sg { set port 4245 }
msc { set port 4254 }
sip { set port 4256 }
gg { set port 4260 }
osmo-hlr { set port 4258 }
osmo-bsc { set port 4242 }
osmo-mgw { set port 4243 }
osmo-mgw-for-bsc { set port 4243 }
osmo-mgw-for-msc {
set host 127.0.0.2
set port 4243
}
osmo-sgsn { set port 4245 }
osmo-msc { set port 4254 }
osmo-sip-connector { set port 4256 }
osmo-ggsn { set port 4260 }
default { set port 4242 }
}
spawn telnet localhost $port
expect ">"
send "enable\r"
expect "#"
send "logging enable\r"
expect "#"
send "logging print category 1\r"
expect "#"
send "logging print category-hex 0\r"
expect "#"
send "logging print level 1\r"
expect "#"
send "logging print file basename last\r"
expect "#"
send "logging print extended-timestamp 1\r"
expect "#"
send "logging level set-all notice\r"
expect "#"
switch $vty {
msc {
send "logging level mm info\r"
expect "#"
send "logging level cc info\r"
expect "#"
}
}
send "logging filter all 1\r"
expect "#"
interact

5
config/osmobts/nitb/vty_sticky Executable file
View File

@ -0,0 +1,5 @@
#!/bin/sh
while true; do
vty $@
sleep 3
done

View File

@ -153,7 +153,7 @@ function Open5GS_soft_install() {
} }
function pycrate_soft_install() { function pycrate_soft_install() {
[ -d /telecom/5G ] || mkdir -p /telecom [ -d /telecom ] || mkdir -p /telecom
cd /telecom cd /telecom
goodecho "[+] Cloninig and installing pycrate" goodecho "[+] Cloninig and installing pycrate"
installfromnet "git clone https://github.com/pycrate-org/pycrate.git" installfromnet "git clone https://github.com/pycrate-org/pycrate.git"
@ -161,4 +161,50 @@ function pycrate_soft_install() {
python3 setup.py install python3 setup.py install
} }
function osmobts_suite_soft_install() {
set -e
goodecho "[+] Installing OsmoBTS suite dependencies"
installfromnet "apt-fast install -y libmnl-dev libpcsclite-dev liburing-dev libtool libgnutls28-dev libtalloc-dev libsctp-dev lksctp-tools libortp-dev dahdi-source libopenr2-dev libc-ares-dev libtonezone-dev libsqlite3-dev"
install_lib() {
local repo_url=$1
local repo_dir=$2
local configure_opts=$3
goodecho "[+] Cloning and installing $repo_dir"
cd $osmo_src
installfromnet "git clone $repo_url" || { echo "Failed to clone $repo_dir"; exit 1; }
cd $repo_dir
autoreconf -fi || { echo "autoreconf failed for $repo_dir"; exit 1; }
./configure $configure_opts || { echo "configure failed for $repo_dir"; exit 1; }
make -j$(nproc) || { echo "make failed for $repo_dir"; exit 1; }
#make check || { echo "make check failed for $repo_dir"; exit 1; }
make install || { echo "make install failed for $repo_dir"; exit 1; }
sudo ldconfig || { echo "ldconfig failed for $repo_dir"; exit 1; }
}
[ -d /telecom/2G/osmocom ] || mkdir -p /telecom/2G/osmocom
cd /telecom/2G/osmocom
mkdir -p tmp/osmo/src
osmo_src=$(pwd)/tmp/osmo/src
install_lib "https://gitea.osmocom.org/osmocom/libosmocore.git" "libosmocore"
install_lib "https://gitea.osmocom.org/osmocom/libosmo-abis.git" "libosmo-abis"
install_lib "https://gitea.osmocom.org/osmocom/libosmo-netif.git" "libosmo-netif"
install_lib "https://gitea.osmocom.org/osmocom/libosmo-sccp.git" "libosmo-sccp"
install_lib "https://gitea.osmocom.org/cellular-infrastructure/libsmpp34.git" "libsmpp34"
install_lib "https://gitea.osmocom.org/cellular-infrastructure/osmo-mgw.git" "osmo-mgw"
install_lib "https://gitea.osmocom.org/cellular-infrastructure/libasn1c.git" "libasn1c"
install_lib "https://gitea.osmocom.org/cellular-infrastructure/osmo-iuh.git" "osmo-iuh"
install_lib "https://gitea.osmocom.org/cellular-infrastructure/osmo-hlr.git" "osmo-hlr"
install_lib "https://gitea.osmocom.org/cellular-infrastructure/osmo-msc.git" "osmo-msc" "--enable-iu"
install_lib "https://gitea.osmocom.org/cellular-infrastructure/osmo-ggsn.git" "osmo-ggsn"
install_lib "https://gitea.osmocom.org/cellular-infrastructure/osmo-sgsn.git" "osmo-sgsn" "--enable-iu"
# cleaning
cd /telecom/2G/osmocom
rm -R tmp
cp /root/config/osmobts/nitb/* .
}
### TODO: more More! ### TODO: more More!