Decapsulate GTP-U payload and forward to a Router

Papa Tana papa.tana101@REDACTED
Mon Jul 6 09:34:39 CEST 2020


Hi Andreas,

To be honest, your works are my triggering point, and so far, I am
definitely checking out all of them as reference point: gtplib,
pfcplib, ergw, gtp_u_kmod, etc....

Before Erlang, I was using Scapy, and Linux tun driver to establish a
simple GRE tunnel.

I never knew Erlang before, I manage some SGSN/MME and GGSN/PGW, HSS
etc...,  and I am not a developer neither, but I came across Erlang by
June 2020 and after just 1 week of using it, I was definitely
convinced by its strength, and now, I was hoping that I could do all
of these stuff with Erlang, my fault..

Currently, because it's my first real personal project after some
personal tutorials like DNS, NTP, ASN.1, I do hope that maybe on long
run, if 3G GGSN is ok, I will go for 4G LTE PDN-GW and 5G UPF as well
but in very very long run.

Really appreciated!

So Ok, I take notes of your precious advice:

- Linux kernel GTP module is the way to go

Best Regards,


2020-07-06 10:06 UTC+03:00, Andreas Schultz <andreas.schultz@REDACTED>:
> Am Mo., 6. Juli 2020 um 08:48 Uhr schrieb Papa Tana <papa.tana101@REDACTED
>>:
>
>> Yes! I already saw it, it's a really interested one.
>>
>> Someone else seems to manage to do it very well, and I'm still on the
>> ongoing process of exploring this huge source code as well:
>> https://github.com/travelping/ergw
>
>
>>
>> But actually, I don't need to create or manipulate, I need to
>> decapsulate the user-data inside GTP-u (this I can do) and forward
>> these data packets to external Router, "without changing any
>> information".
>>
>> I am kind of the "default router" for some client equipment who is
>> sending me packets in GTP-u format, I receive and decapsulate them,
>> forward and don't have to look what are inside.
>>
>> I should have changed the title as "Erlang used as a  Router", but I
>> wanted to illustrate my real scenario.
>>
>
> That is not an Erlang specific question. Using a user space process as
> tunnel encap/decap or router would be more appropriate.
>
> On Linux what you are looking for is called a TUN device (other OSes have
> different mechanisms). A TUN device is controlled through a socket.
>
> A quick search on github finds [1] which might or might not do what you
> want.
>
> Another option would be to use the Linux kernel GTP module. That module is
> controlled through netlink messages. A sample of how this can work can be
> found here [2].
>
> For your specific use case, the 5G/CUPS way would be to use a UPF instance
> and talk PFCP to it.
>
> Regards
> Andreas
>
> [1]: https://github.com/msantos/tunctl
> [2]: https://github.com/travelping/gtp_u_kmod
>
>
>>
>> 2020-07-06 4:13 UTC+03:00, Matthew Evans <mattevans123@REDACTED>:
>> > Have you looked at the procket library? Lots of low-level socket
>> > manipulation tools..
>> >
>> > https://github.com/msantos/procket
>> >
>> > Sent from my iPhone
>> >
>> > On Jul 5, 2020, at 8:56 PM, Papa Tana <papa.tana101@REDACTED> wrote:
>> >
>> > Hi All,
>> >
>> > I am a node built in Erlang, and I receive lots of GTP-U packets:
>> >
>> > ---> GTP-U packets ---------> My Node as a Relay ----> Router [using
>> > NAT]----> Internet
>> >
>> > As shown above, the Erlang node task is to decapsulate the user data
>> > (GTP-U Message Type is T-PDU (0xff)) and forward them to the Router,
>> > without changing any information, just forward it, that's all.
>> >
>> > I was used to send application message in binary as a Client, just
>> > using gen_udp and gen_tcp, but now, I am not the Client. And not the
>> > server because those messages are not for me neither.
>> >
>> > => Then, after I decapsulate these messages from GTP-U, I would like
>> > to relay these layer messages to the Router with which I am connected.
>> > The Router should connect with me with one network interface, using
>> > the same netmask, let's say a small /30 netmask, it's obvious.
>> >
>> > The IP addresses (src and dst) in the payload are not "from" me and
>> > not "for" me.
>> > Any tips please?
>> >
>> > Thank you,
>> > Best Regards,
>> >
>>
>
>
> --
>
> Andreas Schultz
>
> --
>
> Principal Engineer
>
> t: +49 391 819099-224
>
> ------------------------------- enabling your networks
> -----------------------------
>
> Travelping GmbH
> Roentgenstraße 13
> 39108 Magdeburg
> Germany
>
> t: +49 391 819099-0
> f: +49 391 819099-299
>
> e: info@REDACTED
> w: https://www.travelping.com/
> Company registration: Amtsgericht Stendal
> Managing Director: Holger Winkelmann
> Reg. No.: HRB 10578
> VAT ID: DE236673780
>


More information about the erlang-questions mailing list