Commit d0a95924 authored by 吴洲洋's avatar 吴洲洋

update upf configure content

parent 756cfc9b
vpp:
system:
gtpu_entry_ip: 192.168.10.40
gtpu_export_ip: 192.168.50.10
gtpu_entry_ip: 192.168.2.182
gtpu_export_ip: 192.168.2.22
ip_link:
ueip: 192.169.0.0
ueIPPrefix: 24
snatInter: ens32
snatIP: 192.168.2.78
vppHost: ens35
vppHostIP: 192.168.50.11
vppHostIP: 192.168.2.1
gtpu_entry: ens33
gtpu_export: ens34
cpu: 3f
n4:
smf: 192.168.2.39
upf: 192.168.2.78
smf: 192.168.2.35
upf: 192.168.2.21
logSize: 100
......@@ -42,16 +42,7 @@ function init_configure(){
cp -r $configure/template /opt/5gc
$base/plugin/configure -i $yaml -o /opt/5gc
cp $base/plugin/yq $current
# arp
UEIP=$($current/yq r $yaml vpp.ip_link.ueip)
PREFIX=$($current/yq r $yaml vpp.ip_link.ueIPPrefix)
INTER=$($current/yq r $yaml vpp.ip_link.vppHost)
VPPEXPORT=$($current/yq r $yaml vpp.system.gtpu_export_ip)
MAC=$(ifconfig $INTER|grep ether|awk '{print $2}')
# nat
UE_IP=$($current/yq r $yaml vpp.ip_link.ueip)
UE_IP_PREFIX=$($current/yq r $yaml vpp.ip_link.ueIPPrefix)
SNAT_INTER=$($current/yq r $yaml vpp.ip_link.snatInter)
SNAT_IP=$($current/yq r $yaml vpp.ip_link.snatIP)
VPPHOST=$($current/yq r $yaml vpp.ip_link.vppHost)
DPDK_EXPORT=$($current/yq r $yaml vpp.ip_link.gtpu_export)
......@@ -65,7 +56,6 @@ function start_vpp() {
cmd="$VPPCMD"
install_dpdk_kmod
run_nat
$base/plugin/interreput -i $CPUNUMBER
echo Y | sudo tee /sys/module/vfio/parameters/enable_unsafe_noiommu_mode
$cmd >/dev/null 2>&1 &
......@@ -88,6 +78,7 @@ function start_n4() {
else
echo "n4 $pid2 startup success"
fi
exit 0
}
function start_arp() {
......@@ -128,6 +119,7 @@ function close_n4() {
echo "kill n4 $pid"
kill -9 ${pid}
fi
exit 0
}
function close_arp() {
......@@ -160,34 +152,6 @@ function exec_result()
}
function run_nat(){
echo "$UE_IP"
echo "$UE_IP_PREFIX"
echo "$SNAT_INTER"
echo "$SNAT_IP"
echo "$VPPHOST"
echo "$DPDK_EXPORT"
echo "$DPDK_ENTRY"
sudo ifconfig $DPDK_EXPORT down
sudo ifconfig $DPDK_ENTRY down
sudo ethtool -K "$SNAT_INTER" gro off;
sudo ethtool -K "$SNAT_INTER" tso off;
sudo ethtool -K "$SNAT_INTER" sg off;
#del
sudo iptables -t nat -D POSTROUTING -s "$UE_IP/$UE_IP_PREFIX" -j SNAT --to-source "$SNAT_IP"
iptables -t mangle -D POSTROUTING -p tcp --tcp-flags SYN,RST SYN -o "$SNAT_INTER" -j TCPMSS --set-mss 1300
#add
sudo iptables -t nat -A POSTROUTING -s "$UE_IP/$UE_IP_PREFIX" -j SNAT --to-source "$SNAT_IP"
iptables -t mangle -A POSTROUTING -p tcp --tcp-flags SYN,RST SYN -o "$SNAT_INTER" -j TCPMSS --set-mss 1300
#system
echo "1" > /proc/sys/net/ipv4/ip_forward
}
function help()
{
echo " "
......@@ -233,14 +197,11 @@ function main() {
init_configure $2
start_vpp
start_n4
start_arp
shift
;;
--close)
close_vpp
close_n4
close_arp
# unbind
shift
;;
esac
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment