aligungr / UERANSIM

Open source 5G UE and RAN (gNodeB) implementation.
GNU General Public License v3.0
793 stars 322 forks source link

Can I use -n to create multiple UEs, but send an authentication request every few seconds? #469

Open liuwei-network opened 2 years ago

liuwei-network commented 2 years ago

Hi,

Can I use -n to create multiple UEs, but send an authentication request every few seconds? I found that sending more than 30 authentication requests at the same time would crash UDM.

Where should I start to make changes?

Best regards.

aligungr commented 2 years ago

Hi

It's not possible to delay the authentication when using -n command.

But you can run different nr-ue processeses with a Linux sleep command.

liuwei-network commented 2 years ago

Hi,@aligungr Thanks for reply. That's what I'm currently doing, but this faces system resource issues: sudo unable to fork resource temporarily unavailable

Here is my script, I create a ue process every ten seconds.

for((i=1;i<10000;i=i+15))
do
    s=`printf "%04d" $i`
    cmd1="/home/wei/testbed/UERANSIM/build/nr-ue -c /home/wei/testbed/UERANSIM/config/open5gs-ue.yaml -i imsi-90170000000"
    cmd="${cmd1}${s} -n 15 &"
    eval $cmd
    sleep 10
done

I changed the ulimit max user processes and open files, but it didn't alleviate the problem...

liuwei-network commented 2 years ago

Here is screenshot of program.

Screenshot from 2022-01-08 16-44-20

liuwei-network commented 2 years ago

Btw, I think it might be more important to send the authentication request in stages. If the number of -n is large, almost no open source 5g core can handle so many authentication requests at the same time.

aligungr commented 2 years ago

@VLiu7 You can bypass the TUN configuration in UE side by starting the UE with: nr-ue --no-route-config. I wonder if that fixes the problem in the screenshot.

noormohammedli commented 2 years ago

@VLiu7 Hello, Did you fix the issue? I need to run multiple UEs at the same time. I run your code

!/bin/bash

for((i=1;i<100;i=i+15)) do s=printf "%04d" $i cmd1="sudo build/nr-ue -c config/free5gc-uen10.yaml -i imsi-2089300000000"

cmd="${cmd1}${s} -n 15 &"

    eval $cmd1
    sleep 10

done

But I get this error ERROR: invalid IMSI value

In my free5gc-uen10.yaml the be link this :>>> supi: 'imsi-208930000000001'

Is that right?

Thanks

liuwei-network commented 2 years ago

Hi @noormohammedli I think you should remove 208 and make sure the imsi is in your DB.

noormohammedli commented 2 years ago

Hello @VLiu7,

Thank you,

I have this in my DB " imsi-208930000000001"

I can run it but when i try to add multi UE same time i get an error.

when i try to do link this " sudo build/nr-ue -c config/free5gc-uen10.yaml -n 20" i got time expire.

I can run 7 users individually, but i need them to run from the file.

Thanks,

liuwei-network commented 2 years ago

Hi, @noormohammedli

In fact, I'm not sure what problem you have, can you send me your test script and error log?

Did you make sure that all imsi you want to run are in the DB, not just the one in the config file? As far as I know, free5gc doesn't give a script to insert imsi in batches, I'm not sure if you've done that.

Did you have same error with open5gs?

If all imsi are in DB, let's see the error log.

noormohammedli commented 2 years ago

Hello, I do not think i have error in 5G core i can run 7 uses individual, they are working fine but when i try to add multi UE same time i get an error.

error when i run 10 ue at the same time.zip

this is my log files

Thanks

liuwei-network commented 2 years ago

Sorry, I would like to help you but it is more than I can handle. @aligungr Dear author, could you please help @noormohammedli fix that? Thanks!

aligungr commented 2 years ago

Hello @noormohammedli There is a core network problem according to your files. It looks like AMF crashes in your scenario.

elrandira commented 2 years ago

You can eventually add a sleep in the loop that triggers all the UE registers in the code.

in src/ue.cpp at the very end of the file: g_ueMap.invokeForeach([](const auto &ue) { ue.second->start(); sleep(3);});

Don't forget to include the standard library at the top: #include <stdlib.h>

This is what we did on our side.

noormohammedli commented 2 years ago

Hello @elrandira,

Thanks for your comment.

I put this line at the end of the main function but i get this error when i built the UERANSIM.

Screenshot 2022-04-13 at 12 06 20 am

Thanks

elrandira commented 2 years ago

I don't understand your error. This method is part of the code you retrieved on github, it shouldn't fail.

Did you make more modifications that the sleep and the stdlib import? Maybe retry from the start.

noormohammedli commented 2 years ago

Hello @elrandira

Thanks for the replay,

Screenshot 2022-04-19 at 12 31 36 pm

I have this code in the last part of the file, I put the sleep as in the image i think your commands if for the new version of the code, I will update the code and let you know.

Thanks for your help and support, Noor

elrandira commented 2 years ago

Yes, on the latest version it would look like this:

g_ueMap.invokeForeach([](const auto &ue) { ue.second->start(); sleep(10);});