N3IWF and UPF in separate machines

Hi @free5GC,
is it possible to run the N3IWF and the UPF in two separated machines? If yes, how can I achieve this deployment (from the N3IWF and UPF configuration files and host networking configurations points of view)?
Actually I am able to connect them just in case they are running in the same VM.
Thank you in advance for your help!

I think it should work to run them in separated machines if you are able to run in the same VM. Maybe you can try the following:

  1. Make sure the interfaces of N3IWF and UPF are reachable to each other, and set up the interface IP addresses with same mask (connection with AMF should do the same thing if separated).

  2. Configure GTPBindAddress in config/n3iwfcfg.yaml and GTP-U address in config/upfcfg.yaml with the addresses of their interfaces respectively (AMF as well).

Hi @sinchenlin,
first of all many thanks for your reply.
Regarding point 1, the N3IWF and the UPF are reachable to each other (as well as the N3IWF and the AMF).
Regarding point 2, the GTPBindAddress and the GTP-U address are configured with IPs belonging to the same network (10.99.100.0/24) in config/n3iwfcgc.yaml and config/upfcfg.yaml, respectively.

The deployment I would like to achieve is the one in the following picture:

The configuration files related to AMF, N3IWF, SMF and UPF are the ones attached to this message.amfcfg.yaml (5.4 KB) n3iwfcfg.yaml (2.9 KB) smfcfg.yaml (4.1 KB) upfcfg.yaml (1.0 KB)

Are they correct? Are there any networking configurations I need to do on VM_2?

Many thanks in advance!

I forgot to mention that the error that I am getting with this deployment is raised by the github.com/wmnsk/go-gtp library when the N3IWF tries to ping the UPFs through the established tunnel.
The function call rainsing the error is:
userPlaneConnection, err := gtp.DialUPlane(gtpContext, localUDPAddr, remoteUDPAddr)
and it is called in function SetupGTPTunnelWithUPF() in the NFs/n3iwf/internal/gtp/service/service.go file.

Many thanks in advance

Hello, I download your config file. GTPBindAddress in the n3iwf config file should be 10.99.100.10.

Hi @Jerry, thank you for your reply. You are right I attached the wrong configuration file, sorry about that. Even if the GTPBindAddress is the right one (10.99.100.10), the N3IWF is still throwing the following error:

2023-08-21T15:20:22.344019473Z [FATA][N3IWF][NWuUP] panic: runtime error: invalid memory address or nil pointer dereference
goroutine 22 [running]:
runtime/debug.Stack()
	/usr/local/go/src/runtime/debug/stack.go:24 +0x65
github.com/free5gc/n3iwf/internal/nwuup/service.forward.func1()
	/home/ubuntu/leonardol/repos/common/5GC/free5gc/NFs/n3iwf/internal/nwuup/service/service.go:93 +0x3f
panic({0x92bac0, 0xddffe0})
	/usr/local/go/src/runtime/panic.go:884 +0x213
github.com/wmnsk/go-gtp/gtpv1.(*UPlaneConn).WriteTo(...)
	/home/ubuntu/leonardol/repos/common/5GC/go-gtp/gtpv1/u-conn.go:307
github.com/free5gc/n3iwf/internal/nwuup/service.forward({0xc0002e76c0?, 0x0?}, 0xdd, {0xc0006acf40, 0x40, 0x40}, 0x0?)
	/home/ubuntu/leonardol/repos/common/5GC/free5gc/NFs/n3iwf/internal/nwuup/service/service.go:155 +0x505
created by github.com/free5gc/n3iwf/internal/nwuup/service.listenAndServe
	/home/ubuntu/leonardol/repos/common/5GC/free5gc/NFs/n3iwf/internal/nwuup/service/service.go:83 +0x13a

Using a remote debugger, I saw that the gtpPacket in the statement
n, writeErr = userPlaneConnection.WriteTo(gtpPacket, gtpConnection.UPFUDPAddr)
in file
n3iwf/internal/nwuup/service/service.go
is Nil.

Does anyone know how to fix this?
Many thanks in advance

Try turning off the Internet Network card (on the VM_2), it may be that the packet has gone to the wrong network card. Can you provide complete log file and pcap file?

Hi @Jerry,
sorry for the late reply but I did not see your answer until now. Which Network card you want me to switch off? Regarding the pcap file, which interfaces I should monitor? Regarding instead the log file, do you want the N3IWF one?
Thank you in advance for your help!

Hello, close the interface connect to Internet may work. And I want to see the pcap file of 10.99.100.10, check weather gtp tunnel is established. There should be gtp echo request packet and response packet.
I also want to see the log of n3iwf and upf.

Hi @Jerry,
sorry for the late reply. I tried to capture packets on the 10.99.100.10 interface but no packets were captured during the PDU Session Establishment Request.
Attached you can find the N3IWF log produced during this test (as you may notice there is an error which I guess is preventing the issuing of the Echo request towards the UPF).
n3iwf.txt (218.8 KB)

Thank you for your help and patience!
Best Regards

Hello, forward function is used to forward data after connection is created, and gtp.DialUPlane will create connection to upf. But you say userPlaneConnection is nil, I want to know what happened when establishing the connection. Can you find the gtp echo request packet, I wonder where it was sent to, or if it hasn’t been created? Maybe there was an error in the previous process.