Skip to content

How to setup UE, from SIMcard to the internet

Apbk20 edited this page Jul 12, 2024 · 14 revisions

Introduction

Here I will walk through how to setup a UE on a LINUX PC: I assume you have already set up a oai-5G core network. How to set up OAI-5GCN

Setup

Sim-card setup

The setup of the Sim card is based on the following Open cell project You will need: Sim card and reader 20240712_104110

Start by downloading programming tool uicc-v3.3.

Extract files, in the folder recompile the machine

rm program_uicc ; make program_uicc

After which we are ready to program the simcard with the following command: sudo ./program_uicc --adm 12345678 --imsi [ueid] --isdn [LAST 8 of ueID] --acc 0001 --key fec86ba6eb707ed08905757b1bb44b8f --opc C42449363BBAD02B66D16BC975D77CC1 -spn "OpenAirInterface" --authenticate

To which the UEid to program the card with is found in the oai_db.sql database which is in the 5gCN example is at /oai-cn5g/database

INSERT INTO `AuthenticationSubscription` (`ueid`, `authenticationMethod`, `encPermanentKey`, `protectionParameterId`, `sequenceNumber`, `authenticationManagementField`, `algorithmId`, `encOpcKey`, `encTopcKey`, `vectorGenerationInHss`, `n5gcAuthMethod`, `rgAuthenticationInd`, `supi`) VALUES
    ('001010000000001', '5G_AKA', 'fec86ba6eb707ed08905757b1bb44b8f', 'fec86ba6eb707ed08905757b1bb44b8f', '{\"sqn\": \"000000000000\", \"sqnScheme\": \"NON_TIME_BASED\", \"lastIndexes\": {\"ausf\": 0}}', '8000', 'milenage', 'C42449363BBAD02B66D16BC975D77CC1', NULL, NULL, NULL, NULL, '001010000000001');
INSERT INTO `AuthenticationSubscription` (`ueid`, `authenticationMethod`, `encPermanentKey`, `protectionParameterId`, `sequenceNumber`, `authenticationManagementField`, `algorithmId`, `encOpcKey`, `encTopcKey`, `vectorGenerationInHss`, `n5gcAuthMethod`, `rgAuthenticationInd`, `supi`) VALUES
    ('001010000000002', '5G_AKA', 'fec86ba6eb707ed08905757b1bb44b8f', 'fec86ba6eb707ed08905757b1bb44b8f', '{\"sqn\": \"000000000000\", \"sqnScheme\": \"NON_TIME_BASED\", \"lastIndexes\": {\"ausf\": 0}}', '8000', 'milenage', 'C42449363BBAD02B66D16BC975D77CC1', NULL, NULL, NULL, NULL, '001010000000002');
INSERT INTO `AuthenticationSubscription` (`ueid`, `authenticationMethod`, `encPermanentKey`, `protectionParameterId`, `sequenceNumber`, `authenticationManagementField`, `algorithmId`, `encOpcKey`, `encTopcKey`, `vectorGenerationInHss`, `n5gcAuthMethod`, `rgAuthenticationInd`, `supi`) VALUES
    ('001010000000003', '5G_AKA', 'fec86ba6eb707ed08905757b1bb44b8f', 'fec86ba6eb707ed08905757b1bb44b8f', '{\"sqn\": \"000000000000\", \"sqnScheme\": \"NON_TIME_BASED\", \"lastIndexes\": {\"ausf\": 0}}', '8000', 'milenage', 'C42449363BBAD02B66D16BC975D77CC1', NULL, NULL, NULL, NULL, '001010000000003');
INSERT INTO `AuthenticationSubscription` (`ueid`, `authenticationMethod`, `encPermanentKey`, `protectionParameterId`, `sequenceNumber`, `authenticationManagementField`, `algorithmId`, `encOpcKey`, `encTopcKey`, `vectorGenerationInHss`, `n5gcAuthMethod`, `rgAuthenticationInd`, `supi`) VALUES
    ('001010000000004', '5G_AKA', 'fec86ba6eb707ed08905757b1bb44b8f', 'fec86ba6eb707ed08905757b1bb44b8f', '{\"sqn\": \"000000000000\", \"sqnScheme\": \"NON_TIME_BASED\", \"lastIndexes\": {\"ausf\": 0}}', '8000', 'milenage', 'C42449363BBAD02B66D16BC975D77CC1', NULL, NULL, NULL, NULL, '001010000000004');

a example can be:

sudo ./program_uicc --adm 12345678 --imsi 001010000000001 --isdn 00000001 --acc 0001 --key fec86ba6eb707ed08905757b1bb44b8f --opc C42449363BBAD02B66D16BC975D77CC1 -spn "OpenAirInterface" --authenticate

IF MULTIPULL UE's IS USED ENSUR imsi and isdn IS DIFFERENT

UE setup

Inset the SIM card into the modem, and connect the modem to the PC over USB INSET FOTO

AT COMANDS

First we must configure the UE using AT commands

sudo apt install minicom ; minicom -s

In the serial port setup change the serial device to the UE, and set the Bps/par/bits to 115200 8N1 in the serial port write

AT+CGDCONT=1,"IP","oai"
AT+CGDCONT=2
AT+CGDCONT=3

Check the setup with AT+CGDCONT?

Where we should see the output

+CGDCONT: 1,"IP","oai","0.0.0.0",0,0,0,0,,,,,,,,,"",,,,0

resart the ue 'AT+CFUN=1,1'

When the UE is on agin the UE should be reqistred on the core network verify with 'docker logs oai-amf --follow' on the terminal with core network output should be: image

Setup of modem

Add a APN called oai in the GUI Network interface

First check if you can see the modem 'mmcli --list-modems' output should be

/org/freedesktop/ModemManager1/Modem/1 [Quectel] RM500Q-GL

modem number is 1 in the case above. You can see this by /org/freedesktop/ModemManager1/Modem/[MODEM NO.] [Quectel] RM500Q-GL

Now connect the MODEM mmcli -m [MODEM NO.] --simple-connect="apn=oai,ip-type=ipv4

Check the status of the UE: mmcli -m [MODEM NR]

You must now see this

  -----------------------------------
  Status   |                    lock: sim-pin2
           |          unlock retries: sim-pin (3), sim-puk (10), sim-pin2 (3), sim-puk2 (10)
           |                   state: connected
           |             power state: on
           |             access tech: 5gnr
           |          signal quality: 50% (recent)
  -----------------------------------

Other interesting result from that command, keep in mind. Here the BEARER NO. = 0 as indicated by /0

  Bearer   |                   paths: /org/freedesktop/ModemManager1/Bearer/0

IF YOU DID NOT SEE THE RESULT START

If there is no bearer we first create on ´ mmcli -m [MODEM NO.] --create-bearer='apn=oai,ip-type=ipv4' `

if not connected but registed

sudo ifconfig wwan0 up 
sudo dhclient wwan0
ifconfig

Verify that a network called wwan0 is present, after witch connect again mmcli -m 1 --simple-connect="apn=oai,ip-type=ipv4"

IF YOU DID NOT SEE THE RESULT STOP

Check Bearer information

mmcli -m [MODEM NO.] -b [BEARER NO.]

Address is the relevant information here, 10.0.0.2

  ------------------------------------
  General            |           path: /org/freedesktop/ModemManager1/Bearer/0
                     |           type: default
  ------------------------------------
  Status             |      connected: yes
                     |      suspended: no
                     |    multiplexed: no
                     |      interface: wwan0
                     |     ip timeout: 20
  ------------------------------------
  Properties         |            apn: oai
                     |        roaming: allowed
                     |        ip type: ipv4
  ------------------------------------
  IPv4 configuration |         method: static
                     |        address: 10.0.0.2 
                     |         prefix: 30
                     |        gateway: 10.0.0.1
                     |            dns: 1.1.1.1
                     |            mtu: 1500
  ------------------------------------
  Statistics         |     start date: 2024-07-10T10:56:34Z
                     |       duration: 359
                     |       attempts: 1
                     | total-duration: 359

Set up IP LINK

sudo ip link set wwan0 up # we set interface to up
sudo  ip addr add 10.0.0.2/32 dev wwan0 # ind interface to the given IP above
ifconfig

You should now se

	wwan0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST>  mtu 1500
		inet 10.0.0.2  netmask 255.255.255.255  destination 10.0.0.2
		inet6 fe80::11b1:3222:5273:a28c  prefixlen 64  scopeid 0x20<link>
		unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 1000  (UNSPEC)
		RX packets 23  bytes 1932 (1.9 KB)
		RX errors 0  dropped 0  overruns 0  frame 0
		TX packets 30  bytes 2268 (2.2 KB)
		TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

You should be able to ping the Core Network ect-dn and UPF

ping 192.168.71.135 -I wwan0 
ping 10.0.0.1 -I wwan0

Every thing should be working now.

Clone this wiki locally