s5uishida / free5gc_ueransim_sample_config

free5GC 5GC & UERANSIM UE / RAN Sample Configuration
37 stars 7 forks source link

Can you tell me why my ue cannot ping to another one? #1

Closed Hertz0103 closed 3 years ago

Hertz0103 commented 3 years ago

Hello @s5uishida , I referenced your architecture to try free5gc and ueransim, and I changed a little bit from your sample. I create two UEs and let them connect to different DNN, internet and internet2. They used the same upf to work(I only set one upf). My architecture can run and the UEs have the IP, 60.60.0.1 and 60.61.0.1.They can connect to google eventually. But it is wired that my UE1 cannot ping to UE2(or UE2 ping UE1). This is my iptable setting on 5gc (the enp0s3 is my NAT interface):

$ sudo iptables -t nat -A POSTROUTING -s 60.60.0.0/24 ! -o enp0s3 -j MASQUERADE
$ sudo iptables -t nat -A POSTROUTING -s 60.61.0.0/24 ! -o enp0s3 -j MASQUERADE

The other setting is almost same. What should I do to solve this problem?

s5uishida commented 3 years ago

Hi @Hertz0103

I tried ping and ssh between UEs with the following settings. Of course, I also was able to ping google.com. I will hope that this is helpful for you.

     free5GC(UPF)     UERANSIM(gNB)     UERANSIM(UE)
     ------------     -------------     ---------------
VM0 |            |   | VM1         |   | uesimtun0     | VM2
    |            |   |             |---| 60.60.0.1 (X) | user: master
    |            |   |             |    ---------------
    | upfgtp     |---|             |
    |            |   |             |    ---------------
    |            |   |             |   | uesimtun0     | VM3
    |            |   |             |---| 60.61.0.1 (Y) | user: master
     ------------     -------------     ---------------

VM0)
iptables -t nat -A POSTROUTING -s 60.60.0.0/16 ! -o upfgtp -j MASQUERADE
iptables -t nat -A POSTROUTING -s 60.61.0.0/16 ! -o upfgtp -j MASQUERADE

a) ping X --> Y [OK]

ping 60.61.0.1 -I ueransim0

b) ssh X --> Y [OK]

ssh -b 60.60.0.1 master@60.61.0.1
Hertz0103 commented 3 years ago

Hello @s5uishida , My UE1 pings to UE2 successfully, and so does UE2. I let ues on the different VMs .Then I make a mistake to set iptables. Your commands at VM0 are helpful for me. Thank you for your help!