UPF cannot transfer flow to internet

In my test, I combine free5gc with gnbsim. I can capture gtp traffic on the UPF node, but UPF does not forward the traffic to the DN, and gnbsim also shows that it cannot connect to the internet. Our configuration is as follows:

AMF:
image
SMF:
image
UPF:
image
NAT:
image
The flow we captured on upf node is:

hi,Eddie
thanks. i also find the root cause in my case.
I send the icmp messages encap in the gtp,however didn’t do the checksum of the ipv4hdr, the kernal of gtp5g then drop the frame ,although the pdr worked and it remove the gtp header,but the kernal refuse to forward. after make checksum,it worked.
br,thornton.

Hello,

Can you please send me the code on how to do this. I cannot ping internet and I do not know what else to do, maybe my problem is related with this. Do I have to change something on registration_test.go?

upf.pcapng (1.6 KB)

It seems that UPF has successfully decapsulated the GTP packet.

How about checking if you have a right routing table firewall, and NAT setting on your host? Will the outgoing interface have get the decapsulated packet and will send it out?

And how is your MTU setting? Check if the packet is larger than the MTU and will it be disassmebled.

hi,Eddie.
Did you find any reason the the data forwarding. i face almost a same problem.
the gtp header was already removed in the pdr from access to core,however the far rule forwarding didn’t work.so can’t access outside.
br,thornton.

Hi @thornton,

Can I check if you set the NAT rules on iptables and if packet size smaller than MTU on UPF.
Also, what’s the routing rules on your system?

We solved this problem by configuring multiple hosts in the LAN. We deployed upf on one host separately, and the rest of the NF on another host, and connected to the 5GC using gbsim on the third host to connect internet. We specified the only interface(connect to internet) on the upf host and configured NAT.

1 Like

Can someone share the configuration to connect UPF to internet ?
My packets reach the UPF at ‘upfgtp’ interface, but not beyond that.

  1. What changes are required in configuration files (smf, upf) to connect upfgtp to internet ?
  2. What NAT steps are required to connect ‘upfgtp’ interface to internet ?

I am at my wits end after trying various configurations and am stuck here since many days.

Thanks,
Pradnya

Is my following simple configuration written using free5GC and UERANSIM helpful?

@s5uishida Thanks for sharing. Which UERANSIM version did you use?

Hi @carloshemu

I’ve confirmed that it works with v3.0.2 (although I can’t get it anymore), but it also worked with the latest v3.1.0.

This might be helpful. I will go through it in detail.

UE ----- gNB ------ (upfgtp) UPF ----- internet (dnn)

My configuration seems correct because the packet arrives from UE through gNB to UPF interface ‘upfgtp’. But I am facing problem after UPF, when it needs to send the packet to the internet (dnn). It gives me ‘Destination unreachable’. I am just looking for this configuration to connect the UPF to internet.

If anyone can throw some light on this aspect, it would be helpful.

Thanks,
Pradnya

When I do ‘ping -I uesimtun0 8.8.8.8’ , the PDU session is successfully established, and free5gc logs are as below:

2021-02-17T19:53:25+05:30 [INFO][SMF][PduSess] [SMF] PFCP Modification Resonse Accept (/home/pradnya/free5gc/NFs/smf/pfcp/handler/handler.go:233 github.com/free5gc/smf/pfcp/handler.HandlePfcpSessionModificationResponse)
2021-02-17T19:53:25+05:30 [INFO][SMF][PFCP] PFCP Session Modification Success[1] (/home/pradnya/free5gc/NFs/smf/pfcp/handler/handler.go:254 github.com/free5gc/smf/pfcp/handler.HandlePfcpSessionModificationResponse)
2021-02-17T19:53:25+05:30 [INFO][SMF][GIN] | 200 | 127.0.0.1 | POST | /nsmf-pdusession/v1/sm-contexts/urn:uuid:088b1eb3-bc35-46ed-a92d-368e15460fcf/modify | (/home/pradnya/go/pkg/mod/github.com/free5gc/[email protected]/logger_util.go:76 github.com/free5gc/logger_util.ginToLogrus.func1)

But the ping command shows 100% packet loss.
pradnya@pc:~$ ping -I uesimtun0 8.8.8.8
PING 8.8.8.8 (8.8.8.8) from 60.60.0.1 uesimtun0: 56(84) bytes of data.
^C
— 8.8.8.8 ping statistics —
3 packets transmitted, 0 received, 100% packet loss, time 2048ms

Thanks,
Pradnya

Hi, I got the same issue. All output logs of gNB, UE and core look okay, at least to explicit warning or errors, but there were no ICMP reply packets. I dumped the packets on the host machine, and both ICMP request and reply packets can be observed on my WiFi interface. Therefore I suspect that something is wrong somewhere while processing the ICMP reply.

I am using UERANSIM v3.1.0, not v3.0.2 which is used in the successful demonstration (probably) at this link | free5GC. Because v3.0.2 is not available as a tag, I could only try v3.0.3. But there is an error on the UE complaining PLMN cannot be found.

Any insights on this would be appreciated!

BR, Mu

Hello Pradnya,

I am facing the same issue and I can’t seem to fix it. Using UERANSIM I can connect the gNB and UE to free5gc and establish a PDU session. I am running free5gc and UERANSIM (both UE and gNB) in the same computer without using VMs. When I ping google through the uesimtun0 I also get 100% packet loss, but can see the packets in the upfgtp interface.

I think I have configured the NAT correctly, since the response to sudo iptables -t nat -S is

-P PREROUTING ACCEPT
-P INPUT ACCEPT
-P OUTPUT ACCEPT
-P POSTROUTING ACCEPT
-N DOCKER
-A POSTROUTING -o eno1 -j MASQUERADE
-A DOCKER -i docker0 -j RETURN

being eno1 the interface I use for connecting to the Internet.

I attach my configuration files in case they are useful.

Thanks,

Cristina

Config.zip (19.1 KB)

@cristina I think they have to be installed in separate machines, or separate VMs as given in the link by s5uishida.