Skip to content
Snippets Groups Projects
Commit 1dd2fad5 authored by Raphael Defosseux's avatar Raphael Defosseux
Browse files

Merge remote-tracking branch 'origin/develop-new-upf' into doc-update-new-upf

parents 2b70cfe1 5a87092a
No related branches found
No related tags found
1 merge request!139chore(ci): merging UPF-based tutorials and documentations to develop
......@@ -4,16 +4,76 @@ EBPF_GW_SETUP=${EBPF_GW_SETUP:-no}
EBPF_GW_MTU=${EBPF_GW_MTU:-1460}
if [[ ${EBPF_GW_SETUP} == "yes" ]];then
echo -e "Trying to disable TCP checksum and to setup MTU on N6 interface"
N6_IF_NAME=(`ifconfig | grep -B1 "inet $EBPF_GW_N6_IP_ADDR" | awk '$1!="inet" && $1!="--" {print $1}' | sed -e "s@:@@"`)
echo -e "N6 interface is $N6_IF_NAME"
ethtool -K $N6_IF_NAME tx off
ifconfig $N6_IF_NAME mtu $EBPF_GW_MTU
ifconfig $N6_IF_NAME
echo -e "Adding UE IP routing to the N6 interface of UPF"
ip route add $UE_IP_ADDRESS_POOL via $N6_UPF_IP_ADDR dev $N6_IF_NAME
ip route
N3_IF_NAME=(`ifconfig | grep -B1 "inet $GW_N3_IP_ADDR" | awk '$1!="inet" && $1!="--" {print $1}' | sed -e "s@:@@"`)
SGI_IF_NAME=(`ifconfig | grep -B1 "inet $GW_SGI_IP_ADDR" | awk '$1!="inet" && $1!="--" {print $1}' | sed -e "s@:@@"`)
DEFAULT_ROUTE=(`ip route show default`)
if [[ -n "$N6_IF_NAME" ]]; then
echo
echo -e "1. Disable TCP Checksum on N6 interface ($N6_IF_NAME):"
ethtool -K $N6_IF_NAME tx off
echo
echo -e "2. Setup MTU ($EBPF_GW_MTU) on N6 interface ($N6_IF_NAME):"
ifconfig $N6_IF_NAME mtu $EBPF_GW_MTU
ifconfig $N6_IF_NAME
echo
echo -e "3. Add a route to UE subnet ($UE_IP_ADDRESS_POOL) via UPF N6 interface ($N6_UPF_IP_ADDR):"
ip route add $UE_IP_ADDRESS_POOL via $N6_UPF_IP_ADDR dev $N6_IF_NAME
else
echo
echo -e "N6 interface does not exist;\nThe UPF will not be able to reach the \nGateway neither the Internet"
echo
fi
if [[ -n "$N3_IF_NAME" ]]; then
echo
echo -e "4. Disable the useless N3 interface ($N3_IF_NAME):"
ifconfig $N3_IF_NAME down
fi
if [[ -n "$SGI_IF_NAME" ]]; then
echo
echo -e "5. Update the default route:"
if [[ -n "$DEFAULT_ROUTE" ]]; then
echo "Delete the default route: $DEFAULT_ROUTE"
ip route del default
fi
echo -e "Sgi interface is $SGI_IF_NAME"
ip route add default via $SGI_DEMO_OAI_ADDR
ip route
else
echo -e "Sgi interface does not exist;\nThe UPF will not be able to reach the Internet"
fi
echo
echo "6. Add SNAT rule to allow UE traffic to reach the internet:"
iptables -t nat -A POSTROUTING -o $SGI_IF_NAME -s $UE_IP_ADDRESS_POOL -j SNAT --to-source $GW_SGI_IP_ADDR
fi
echo "Done setting the configuration"
echo
echo -e "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "Gateway Has the following configuration :"
echo
echo " +---------------+ "
echo " | | "
echo " (UPF)----------| OAI-EXT-GW |----------- (Internet)"
echo " N6 | | Sgi "
echo " +---------------+ "
echo
echo " GW N6 Interface ----------------: (Ifname, IPv4, MTU) = (${N6_IF_NAME}, $(ip addr show "${N6_IF_NAME}" | grep -oE 'inet ([0-9]+\.){3}[0-9]+' | awk '{print $2}'), $(ip link show "$N6_IF_NAME" | awk '/mtu/ {print $5}'))"
echo " GW Sgi Interface ---------------: (Ifname, IPv4, MTU) = (${SGI_IF_NAME}, $(ip addr show "${SGI_IF_NAME}" | grep -oE 'inet ([0-9]+\.){3}[0-9]+' | awk '{print $2}'), $(ip link show "$SGI_IF_NAME" | awk '/mtu/ {print $5}'))"
echo " GW Default Route ---------------: $(ip route show default)"
echo " Route to UE --------------------: $(ip route show | grep -E "${UE_IP_ADDRESS_POOL}.*via ${N6_UPF_IP_ADDR}.*dev ${N6_IF_NAME}")"
echo " Iptables Postrouting -----------: $(iptables -t nat -L | grep -E "SNAT.*${UE_IP_ADDRESS_POOL}.*to:${GW_SGI_IP_ADDR}")"
echo
echo -e "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo
exec "$@"
......@@ -148,8 +148,11 @@ services:
environment:
- EBPF_GW_SETUP=yes
- EBPF_GW_N6_IP_ADDR=192.168.72.135
- GW_SGI_IP_ADDR=192.168.70.135
- GW_N3_IP_ADDR=192.168.71.135
- UE_IP_ADDRESS_POOL=12.1.1.0/24
- N6_UPF_IP_ADDR=192.168.72.129
- SGI_DEMO_OAI_ADDR=192.168.70.129
healthcheck:
test: /bin/bash -c "ip r | grep 12.1.1"
interval: 10s
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment