-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
31f8399
commit 0271933
Showing
2 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
FROM alpine:3.19 as buildenv | ||
|
||
RUN apk add --no-cache git ca-certificates \ | ||
libmnl-dev build-base make automake autoconf libtool pkgconfig | ||
|
||
RUN git clone https://gitea.osmocom.org/cellular-infrastructure/libgtpnl \ | ||
&& cd /libgtpnl && autoreconf -fi && ./configure && make | ||
|
||
FROM alpine:3.19 | ||
|
||
WORKDIR /nf-gtp-gw | ||
|
||
COPY --from=buildenv /libgtpnl/src/.libs/libgtpnl.so* /usr/lib/ | ||
COPY --from=buildenv /libgtpnl/tools/.libs/* . | ||
COPY ./startup.sh ./ | ||
|
||
RUN apk add --no-cache libmnl iproute2 \ | ||
&& ldconfig / | ||
|
||
ENV TEID_N3_GNB=100 \ | ||
TEID_N3_UPF=200 \ | ||
N3_UPF_IP=127.0.0.1 \ | ||
N6_APP_SERVER_IP=127.0.0.2 \ | ||
N6_APP_SERVER_SUBNET=127.0.0.0/8 | ||
|
||
ENTRYPOINT ["./startup.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/sh | ||
|
||
# User defined variables | ||
#TEID_N3_UPF | ||
#TEID_N3_GNB | ||
#N3_UPF_IP | ||
#N6_APP_SERVER_IP | ||
#N6_APP_SERVER_SUBNET | ||
|
||
# Pre-defined variables | ||
IP_VERSION="ip" | ||
MTU=1500 | ||
GTP_DEV="ue-tun" | ||
|
||
function log { | ||
echo -e "[INFO] $1" | ||
sleep 1 | ||
} | ||
|
||
function start { | ||
log "create gtp devices (run in bg mode)" | ||
./gtp-link add $GTP_DEV $IP_VERSION & | ||
|
||
log "configure mtu of gtp devices" | ||
ip link set mtu $MTU dev $GTP_DEV | ||
|
||
log "create gtp tunnel: [TEID_N3_GNB=$TEID_N3_GNB, TEID_N3_UPF=$TEID_N3_UPF, \ | ||
N3_UPF_IP=$N3_UPF_IP, N6_APP_SERVER_IP=$N6_APP_SERVER_IP]" | ||
./gtp-tunnel add $GTP_DEV v1 $TEID_N3_UPF $TEID_N3_GNB $N6_APP_SERVER_IP $N3_UPF_IP | ||
log "$(./gtp-tunnel list)" | ||
|
||
log "configure routes using gtp devices" | ||
ip route add $N6_APP_SERVER_SUBNET dev $GTP_DEV | ||
} | ||
|
||
start | ||
sleep infinity |