Commit b8454458 authored by Lionel Gauthier's avatar Lionel Gauthier

Updates

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5018 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent c6a9543c
#!/bin/bash
# Author Lionel GAUTHIER 02/03/2014
#
# This script start ENB+UE (all in one executable, on one host) with vlan setting
# MME+SP-GW executable have to be launched on an other host by your own (start_lte-epc-vlan.bash).
#
# hss.eur
# |
# +-----------+ +-----------+ v +----------+
# | eNB +------+ VLAN 1+------+ MME +----+ +---+ HSS |
# | |ethx.1+------------------+ethy.1| | +------+ | |
# | +------+ +------+ +----+ +---+ |
# | |ethx.2+-------+ | | +----------+
# | +------+ | +-+-------+-+
# | | | | s11mme|
# | | | +---+---+
# | | | (optional)| VLAN 3
# +-----------+ | +---+---+
# | | s11sgw| router.eur
# | +-+-------+-+ | +--------------+
# | | S+P-GW | v | ROUTER |
# | VLAN2 +------+ +-------+ +----+ +----+
# +----------+ethy.2| |sgi +-...-+ | | +---...Internet
# +------+ +-------+ +----+ +----+
# | | 11 VLANS | |
# +-----------+ ids=[5..15] +--------------+
#
###########################################################
# Parameters
###########################################################
declare MAKE_LTE_ACCESS_STRATUM_TARGET="oaisim ENABLE_ITTI=1 USE_MME=R10 NAS=1 Rel10=1"
declare MAKE_IP_DRIVER_TARGET="ue_ip.ko"
declare IP_DRIVER_NAME="ue_ip"
declare LTEIF="oip1"
declare UE_IPv4="10.0.0.8"
declare UE_IPv6="2001:1::8"
declare UE_IPv6_CIDR=$UE_IPv6"/64"
declare UE_IPv4_CIDR=$UE_IPv4"/24"
###########################################################
THIS_SCRIPT_PATH=$(dirname $(readlink -f $0))
source $THIS_SCRIPT_PATH/utils.bash
###########################################################
test_command_install_package "gccxml" "gccxml" "--force-yes"
test_command_install_package "vconfig" "vlan"
test_command_install_package "iptables" "iptables"
test_command_install_package "iperf" "iperf"
test_command_install_package "ip" "iproute"
test_command_install_package "tunctl" "uml-utilities"
test_command_install_lib "/usr/lib/libconfig.so" "libconfig-dev"
#######################################################
# USIM, NVRAM files
#######################################################
if [ ! -f $OPENAIRCN_DIR/NAS/EURECOM-NAS/bin/ue_data ]; then
make --directory=$OPENAIRCN_DIR/NAS/EURECOM-NAS veryveryclean
make --directory=$OPENAIRCN_DIR/NAS/EURECOM-NAS PROCESS=UE
fi
if [ ! -f $OPENAIRCN_DIR/NAS/EURECOM-NAS/bin/usim_data ]; then
make --directory=$OPENAIRCN_DIR/NAS/EURECOM-NAS veryveryclean
make --directory=$OPENAIRCN_DIR/NAS/EURECOM-NAS PROCESS=UE
fi
if [ ! -f .ue.nvram ]; then
# generate .ue_emm.nvram .ue.nvram
$OPENAIRCN_DIR/NAS/EURECOM-NAS/bin/ue_data -g
fi
if [ ! -f .usim.nvram ]; then
# generate .usim.nvram
$OPENAIRCN_DIR/NAS/EURECOM-NAS/bin/usim_data -g
fi
##################################################
# NETWORK TOPOLOGY
##################################################
clean_enb_vlan_network
build_enb_vlan_network
test_enb_vlan_network
##################################################
# LAUNCH eNB + UE executable
##################################################
echo "Bringup UE interface"
pkill oaisim
bash_exec "rmmod $IP_DRIVER_NAME" > /dev/null 2>&1
cecho "make $MAKE_IP_DRIVER_TARGET $MAKE_LTE_ACCESS_STRATUM_TARGET ....." $green
#bash_exec "make --directory=$OPENAIR2_DIR $MAKE_IP_DRIVER_TARGET "
make --directory=$OPENAIR2_DIR $MAKE_IP_DRIVER_TARGET || exit 1
#bash_exec "make --directory=$OPENAIR_TARGETS/SIMU/USER $MAKE_LTE_ACCESS_STRATUM_TARGET "
make --directory=$OPENAIR_TARGETS/SIMU/USER $MAKE_LTE_ACCESS_STRATUM_TARGET || exit 1
bash_exec "insmod $OPENAIR2_DIR/NETWORK_DRIVER/UE_IP/$IP_DRIVER_NAME.ko"
bash_exec "ip route flush cache"
bash_exec "ip link set $LTEIF up"
sleep 1
#bash_exec "ip addr add dev $LTEIF $UE_IPv4_CIDR"
#bash_exec "ip addr add dev $LTEIF $UE_IPv6_CIDR"
sleep 1
bash_exec "sysctl -w net.ipv4.conf.all.log_martians=1"
assert " `sysctl -n net.ipv4.conf.all.log_martians` -eq 1" $LINENO
echo " Disabling reverse path filtering"
bash_exec "sysctl -w net.ipv4.conf.all.rp_filter=0"
assert " `sysctl -n net.ipv4.conf.all.rp_filter` -eq 0" $LINENO
bash_exec "ip route flush cache"
# Check table 200 lte in /etc/iproute2/rt_tables
fgrep lte /etc/iproute2/rt_tables
if [ $? -ne 0 ]; then
echo "200 lte " >> /etc/iproute2/rt_tables
fi
ip rule add fwmark 5 table lte
ip route add default dev $LTEIF table lte
ITTI_LOG_FILE=/tmp/itti_enb.$HOSTNAME.log
rotate_log_file $ITTI_LOG_FILE
#######################################################
# FIND CONFIG FILE
#######################################################
CONFIG_FILE=$THIS_SCRIPT_PATH/CONF/enb.sfr.default_vlan.conf
SEARCHED_CONFIG_FILE=$THIS_SCRIPT_PATH/CONF/enb.sfr."$HOSTNAME"_vlan.conf
if [ -f $SEARCHED_CONFIG_FILE ]; then
CONFIG_FILE=$SEARCHED_CONFIG_FILE
echo_warning "config file found is now $CONFIG_FILE"
else
echo_warning "config file $SEARCHED_CONFIG_FILE for host $HOSTNAME not found, trying default: $CONFIG_FILE"
if [ -f $CONFIG_FILE ]; then
echo_success "Default config file found: $CONFIG_FILE"
else
echo_error "Default config file not found, exiting"
exit 1
fi
fi
gdb --args $OPENAIR_TARGETS/SIMU/USER/oaisim -a -u1 -l7 -K $ITTI_LOG_FILE --enb-conf $CONFIG_FILE
#!/bin/bash
# Author Lionel GAUTHIER 01/20/2014
#
# This script start MME+S/P-GW (all in one executable, on one host) with openvswitch setting
# eNB executable have to be launched on the same host by your own (start_lte-enb-ovs.bash).
#
# hss.eur
# |
# +-----------+ +-----------+ v +----------+
# | eNB +------+ VLAN 1+------+ MME +----+ +---+ HSS |
# | |ethx.1+------------------+ethy.1| | +------+ | |
# | +------+ +------+ +----+ +---+ |
# | |ethx.2+-------+ | | +----------+
# | +------+ | +-+-------+-+
# | | | | s11mme|
# | | | +---+---+
# | | | (optional)| VLAN 3
# +-----------+ | +---+---+
# | | s11sgw| router.eur
# | +-+-------+-+ | +--------------+
# | | S+P-GW | v | ROUTER |
# | VLAN2 +------+ +-------+ +----+ +----+
# +----------+ethy.2| |sgi +-...-+ | | +---...Internet
# +------+ +-------+ +----+ +----+
# | | 11 VLANS | |
# +-----------+ ids=[5..15] +--------------+
###########################################################
THIS_SCRIPT_PATH=$(dirname $(readlink -f $0))
source $THIS_SCRIPT_PATH/utils.bash
###########################################################
test_command_install_package "gccxml" "gccxml" "--force-yes"
test_command_install_package "vconfig" "vlan"
test_command_install_package "iptables" "iptables"
test_command_install_package "iperf" "iperf"
test_command_install_package "ip" "iproute"
test_command_install_package "tunctl" "uml-utilities"
if [ ! -d /usr/local/etc/freeDiameter ]
then
cd $OPENAIRCN_DIR/S6A/freediameter && ./install_freediameter.sh
else
echo_success "freediameter is installed"
fi
test_command_install_script "asn1c" "$OPENAIRCN_DIR/SCRIPTS/install_asn1c_0.9.24.modified.bash"
# One mor check about version of asn1c
ASN1C_COMPILER_REQUIRED_VERSION_MESSAGE="ASN.1 Compiler, v0.9.24"
ASN1C_COMPILER_VERSION_MESSAGE=`asn1c -h 2>&1 | grep -i ASN\.1\ Compiler`
##ASN1C_COMPILER_VERSION_MESSAGE=`trim $ASN1C_COMPILER_VERSION_MESSAGE`
if [ "$ASN1C_COMPILER_VERSION_MESSAGE" != "$ASN1C_COMPILER_REQUIRED_VERSION_MESSAGE" ]
then
diff <(echo -n "$ASN1C_COMPILER_VERSION_MESSAGE") <(echo -n "$ASN1C_COMPILER_REQUIRED_VERSION_MESSAGE")
echo_error "Version of asn1c is not the required one, do you want to install the required one (overwrite installation) ? (Y/n)"
echo_error "$ASN1C_COMPILER_VERSION_MESSAGE"
while read -r -n 1 -s answer; do
if [[ $answer = [YyNn] ]]; then
[[ $answer = [Yy] ]] && $OPENAIRCN_DIR/SCRIPTS/install_asn1c_0.9.24.modified.bash
[[ $answer = [Nn] ]] && echo_error "Version of asn1c is not the required one, exiting." && exit 1
break
fi
done
fi
# May we have booted on a new kernel, not the one when we build vswitch kernel module
if [ ! -f /lib/modules/`uname -r`/extra/openvswitch.ko ]; then
$OPENAIRCN_DIR/SCRIPTS/install_openvswitch1.9.0.bash
fi
##################################
# Get or set OBJ DIR and compile #
##################################
# TEST IF EXIST
cd $OPENAIRCN_DIR
OBJ_DIR=`find . -maxdepth 1 -type d -iname obj*`
if [ -n "$OBJ_DIR" ]
then
OBJ_DIR=`basename $OBJ_DIR`
if [ ! -f $OBJ_DIR/Makefile ]
then
cd ./$OBJ_DIR
echo_success "Invoking configure"
rm -f Makefile
../configure --enable-standalone-epc --enable-raw-socket-for-sgi LDFLAGS=-L/usr/local/lib
else
cd ./$OBJ_DIR
fi
else
OBJ_DIR="objs"
bash_exec "mkdir -m 777 ./$OBJ_DIR"
echo_success "Created $OBJ_DIR directory"
echo_success "Invoking autogen"
bash_exec "./autogen.sh"
cd ./$OBJ_DIR
echo_success "Invoking configure"
../configure --enable-standalone-epc --enable-raw-socket-for-sgi LDFLAGS=-L/usr/local/lib
fi
pkill oai_epc
if [ -f Makefile ]
then
echo_success "Compiling..."
bash_exec "make"
else
echo_error "Configure failed, exiting"
exit 1
fi
cd $OPENAIRCN_DIR
#######################################################
# FIND CONFIG FILE
#######################################################
CONFIG_FILE=$THIS_SCRIPT_PATH/CONF/epc.sfr.default_vlan.conf
SEARCHED_CONFIG_FILE=$THIS_SCRIPT_PATH/CONF/epc.sfr."$HOSTNAME"_vlan.conf
if [ -f $SEARCHED_CONFIG_FILE ]; then
CONFIG_FILE=$SEARCHED_CONFIG_FILE
echo_warning "config file found is now $CONFIG_FILE"
else
echo_warning "config file $SEARCHED_CONFIG_FILE for host $HOSTNAME not found, trying default: $CONFIG_FILE"
if [ -f $CONFIG_FILE ]; then
echo_success "Default config file found: $CONFIG_FILE"
else
echo_error "Default config file not found, exiting"
exit 1
fi
fi
#######################################################
# SOURCE CONFIG FILE
#######################################################
rm -f /tmp/source.txt
VARIABLES="
MME_INTERFACE_NAME_FOR_S1_MME\|\
MME_IPV4_ADDRESS_FOR_S1_MME\|\
MME_INTERFACE_NAME_FOR_S11_MME\|\
MME_IPV4_ADDRESS_FOR_S11_MME\|\
SGW_INTERFACE_NAME_FOR_S11\|\
SGW_IPV4_ADDRESS_FOR_S11\|\
SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP\|\
SGW_IPV4_ADDRESS_FOR_S1U_S12_S4_UP\|\
SGW_INTERFACE_NAME_FOR_S5_S8_UP\|\
SGW_IPV4_ADDRESS_FOR_S5_S8_UP\|\
PGW_INTERFACE_NAME_FOR_S5_S8\|\
PGW_IPV4_ADDRESS_FOR_S5_S8\|\
PGW_INTERFACE_NAME_FOR_SGI\|\
PGW_IPV4_ADDR_FOR_SGI"
VARIABLES=$(echo $VARIABLES | sed -e 's/\\r//g')
VARIABLES=$(echo $VARIABLES | tr -d ' ')
cat $CONFIG_FILE | grep -w "$VARIABLES"| tr -d " " | tr -d ";" > /tmp/source.txt
source /tmp/source.txt
declare MME_IPV4_NETMASK_FOR_S1_MME=$( echo $MME_IPV4_ADDRESS_FOR_S1_MME | cut -f2 -d '/')
#declare MME_IPV4_NETMASK_FOR_S11_MME=$( echo $MME_IPV4_ADDRESS_FOR_S11_MME | cut -f2 -d '/')
#declare SGW_IPV4_NETMASK_FOR_S11=$( echo $SGW_IPV4_ADDRESS_FOR_S11 | cut -f2 -d '/')
declare SGW_IPV4_NETMASK_FOR_S1U_S12_S4_UP=$(echo $SGW_IPV4_ADDRESS_FOR_S1U_S12_S4_UP | cut -f2 -d '/')
#declare SGW_IPV4_NETMASK_FOR_S5_S8_UP=$( echo $SGW_IPV4_ADDRESS_FOR_S5_S8_UP | cut -f2 -d '/')
#declare PGW_IPV4_NETMASK_FOR_S5_S8=$( echo $PGW_IPV4_ADDRESS_FOR_S5_S8 | cut -f2 -d '/')
declare PGW_IPV4_NETMASK_FOR_SGI=$( echo $PGW_IPV4_ADDR_FOR_SGI | cut -f2 -d '/')
ENB_IPV4_ADDRESS_FOR_S1_MME=$( echo $ENB_IPV4_ADDRESS_FOR_S1_MME | cut -f1 -d '/')
ENB_IPV4_ADDRESS_FOR_S1U=$( echo $ENB_IPV4_ADDRESS_FOR_S1U | cut -f1 -d '/')
MME_IPV4_ADDRESS_FOR_S1_MME=$( echo $MME_IPV4_ADDRESS_FOR_S1_MME | cut -f1 -d '/')
#MME_IPV4_ADDRESS_FOR_S11_MME=$( echo $MME_IPV4_ADDRESS_FOR_S11_MME | cut -f1 -d '/')
#SGW_IPV4_ADDRESS_FOR_S11=$( echo $SGW_IPV4_ADDRESS_FOR_S11 | cut -f1 -d '/')
SGW_IPV4_ADDRESS_FOR_S1U_S12_S4_UP=$( echo $SGW_IPV4_ADDRESS_FOR_S1U_S12_S4_UP | cut -f1 -d '/')
#SGW_IPV4_ADDRESS_FOR_S5_S8_UP=$( echo $SGW_IPV4_ADDRESS_FOR_S5_S8_UP | cut -f1 -d '/')
#PGW_IPV4_ADDRESS_FOR_S5_S8=$( echo $PGW_IPV4_ADDRESS_FOR_S5_S8 | cut -f1 -d '/')
PGW_IPV4_ADDR_FOR_SGI=$( echo $PGW_IPV4_ADDR_FOR_SGI | cut -f1 -d '/')
clean_epc_vlan_network
build_epc_vlan_network
test_epc_vlan_network
##################################################..
# LAUNCH MME + S+P-GW executable
##################################################
cd $OPENAIRCN_DIR/$OBJ_DIR
ITTI_LOG_FILE=/tmp/itti_mme.log
rotate_log_file $ITTI_LOG_FILE
gdb --args $OPENAIRCN_DIR/$OBJ_DIR/OAI_EPC/oai_epc -K $ITTI_LOG_FILE -c $CONFIG_FILE
#!/bin/bash
#############################################################
#Setting the EXTERNAL and INTERNAL interfaces for the network
#############################################################
declare EXTIF="eth0"
declare INTIF="eth3"
IPTABLES=/sbin/iptables
DEPMOD=/sbin/depmod
MODPROBE=/sbin/modprobe
###########################################################
THIS_SCRIPT_PATH=$(dirname $(readlink -f $0))
source $THIS_SCRIPT_PATH/utils.bash
###########################################################
test_command_install_package "vconfig" "vlan" "--force-yes"
test_command_install_package "iptables" "iptables"
test_command_install_package "iperf" "iperf" "--force-yes"
test_command_install_package "ip" "iproute"
echo " External Interface: $EXTIF"
echo " Internal Interface: $INTIF"
echo -en " loading modules: "
# Need to verify that all modules have all required dependencies
#
echo " - Verifying that all kernel modules are ok"
$DEPMOD -a
echo "----------------------------------------------------------------------"
#Load the main body of the IPTABLES module - "iptable"
# - Loaded automatically when the "iptables" command is invoked
#
# - Loaded manually to clean up kernel auto-loading timing issues
#
echo -en "ip_tables, "
$MODPROBE ip_tables
#Load the IPTABLES filtering module - "iptable_filter"
# - Loaded automatically when filter policies are activated
#Load the stateful connection tracking framework - "ip_conntrack"
#
# The conntrack module in itself does nothing without other specific
# conntrack modules being loaded afterwards such as the "ip_conntrack_ftp"
# module
#
# - This module is loaded automatically when MASQ functionality is
# enabled
#
# - Loaded manually to clean up kernel auto-loading timing issues
#
echo -en "ip_conntrack, "
$MODPROBE ip_conntrack
#Load the FTP tracking mechanism for full FTP tracking
#
# Enabled by default -- insert a "#" on the next line to deactivate
#
echo -en "ip_conntrack_ftp, "
$MODPROBE ip_conntrack_ftp
#Load the IRC tracking mechanism for full IRC tracking
#
# Enabled by default -- insert a "#" on the next line to deactivate
#
echo -en "ip_conntrack_irc, "
$MODPROBE ip_conntrack_irc
#Load the general IPTABLES NAT code - "iptable_nat"
# - Loaded automatically when MASQ functionality is turned on
#
# - Loaded manually to clean up kernel auto-loading timing issues
#
echo -en "iptable_nat, "
$MODPROBE iptable_nat
#Loads the FTP NAT functionality into the core IPTABLES code
# Required to support non-PASV FTP.
#
# Enabled by default -- insert a "#" on the next line to deactivate
#
echo -en "ip_nat_ftp, "
$MODPROBE ip_nat_ftp
#Clearing any previous configuration
#
# Unless specified, the defaults for INPUT and OUTPUT is ACCEPT
# The default for FORWARD is DROP (REJECT is not a valid policy)
#
# Isn't ACCEPT insecure? To some degree, YES, but this is our testing
# phase. Once we know that IPMASQ is working well, I recommend you run
# the rc.firewall-*-stronger rulesets which set the defaults to DROP but
# also include the critical additional rulesets to still let you connect to
# the IPMASQ server, etc.
#
echo " Clearing any existing rules and setting default policy.."
bash_exec "iptables -P INPUT ACCEPT"
bash_exec "iptables -F INPUT"
bash_exec "iptables -P OUTPUT ACCEPT"
bash_exec "iptables -F OUTPUT"
bash_exec "iptables -P FORWARD ACCEPT"
bash_exec "iptables -F FORWARD"
bash_exec "iptables -t nat -F"
bash_exec "iptables -t mangle -F"
bash_exec "iptables -t filter -F"
bash_exec "iptables -t raw -F"
bash_exec "ip route flush cache"
echo " Enabling forwarding"
bash_exec "sysctl -w net.ipv4.ip_forward=1"
assert " `sysctl -n net.ipv4.ip_forward` -eq 1" $LINENO
# Dynamic IP users:
#
# If you get your IP address dynamically from SLIP, PPP, or DHCP,
# enable this following option. This enables dynamic-address hacking
# which makes the life with Diald and similar programs much easier.
#
echo " Enabling DynamicAddr.."
bash_exec "sysctl -w net.ipv4.ip_dynaddr=1"
assert " `sysctl -n net.ipv4.ip_dynaddr` -eq 1" $LINENO
bash_exec "sysctl -w net.ipv4.conf.all.log_martians=1"
assert " `sysctl -n net.ipv4.conf.all.log_martians` -eq 1" $LINENO
echo " Disabling reverse path filtering"
bash_exec "sysctl -w net.ipv4.conf.all.rp_filter=0"
assert " `sysctl -n net.ipv4.conf.all.rp_filter` -eq 0" $LINENO
bash_exec "sysctl -w net.ipv4.conf.$EXTIF.rp_filter=0"
assert " `sysctl -n net.ipv4.conf.$EXTIF.rp_filter` -eq 0" $LINENO
bash_exec "sysctl -w net.ipv4.conf.$INTIF.rp_filter=0"
assert " `sysctl -n net.ipv4.conf.$INTIF.rp_filter` -eq 0" $LINENO
echo "0" > /proc/sys/net/ipv4/conf/all/proxy_arp
echo "1" > /proc/sys/net/ipv4/conf/$EXTIF/proxy_arp
echo "1" > /proc/sys/net/ipv4/conf/$INTIF/proxy_arp
echo " FWD: Allow all connections OUT and only existing and related ones IN"
bash_exec "iptables -A FORWARD -i $EXTIF -o $INTIF -m state --state ESTABLISHED,RELATED -j ACCEPT"
bash_exec "iptables -A FORWARD -i $INTIF -o $EXTIF -m state --state NEW,ESTABLISHED,RELATED,INVALID -j ACCEPT"
bash_exec "modprobe 8021q"
for i in 5 6 7 8 9 10 11 12 13 14 15
do
vconfig rem $INTIF.$i > /dev/null 2>&1
sync
bash_exec "vconfig add $INTIF $i"
sync
NET=$(( $i + 200 ))
CIDR='10.0.'$NET'.1/8'
bash_exec "ip -4 addr add $CIDR broadcast 192.174.$NET.255 dev $INTIF.$i"
bash_exec "iptables -A FORWARD -i $EXTIF -o $INTIF.$i -m state --state ESTABLISHED,RELATED -j ACCEPT"
bash_exec "iptables -A FORWARD -i $INTIF.$i -o $EXTIF -m state --state NEW,ESTABLISHED,RELATED,INVALID -j ACCEPT"
bash_exec "echo 1 > /proc/sys/net/ipv4/conf/$INTIF.$i/proxy_arp"
bash_exec "echo 0 > /proc/sys/net/ipv4/conf/$INTIF.$i/rp_filter"
#assert " `sysctl -n net.ipv4.conf.$INTIF.$i.proxy_arp` -eq 1" $LINENO
#assert " `sysctl -n net.ipv4.conf.$INTIF.$i.rp_forward` -eq 0" $LINENO
#assert " `sysctl -n net.ipv4.conf.$INTIF.$i.rp_filter` -eq 0" $LINENO
done
for i in 5 6 7 8 9 10 11 12 13 14 15
do
bash_exec "iptables -t mangle -A PREROUTING -i $INTIF.$i -j CONNMARK --restore-mark"
bash_exec "iptables -t mangle -A PREROUTING -i $INTIF.$i -m mark --mark 0 -j MARK --set-mark $i"
bash_exec "iptables -t mangle -A PREROUTING -i $INTIF.$i -j CONNMARK --save-mark"
fgrep vlan$i /etc/iproute2/rt_tables
if [ $? -ne 0 ]
then
base=200
num=$(( $i + $base ))
echo "$num vlan$i" >> /etc/iproute2/rt_tables
echo "Updating /etc/iproute2/rt_tables with table vlan$i id $num"
fi
ip rule del from all iif $EXTIF fwmark $i table vlan$i > /dev/null
bash_exec "ip rule add iif $EXTIF fwmark $i table vlan$i"
bash_exec "ip route add default dev $INTIF.$i table vlan$i"
done
#bash_exec "iptables -t mangle -A OUTPUT -m mark ! --mark 0 -j CONNMARK --save-mark"
#iptables -I INPUT -i $INTIF.5 -j LOG --log-ip-options --log-prefix "INPUT CHAIN:"
#iptables -I FORWARD -t mangle -i $INTIF.5 -j LOG --log-ip-options --log-prefix "FORWARD CHAIN(mangle):"
#iptables -I FORWARD -t filter -i $INTIF.5 -j LOG --log-ip-options --log-prefix "FORWARD CHAIN(filter):"
#iptables -I PREROUTING -t raw -i $INTIF.5 -j LOG --log-ip-options --log-prefix "PREROUTING (raw):"
#iptables -I PREROUTING -t mangle -i $INTIF.5 -j LOG --log-ip-options --log-prefix "PREROUTING (mangle):"
#iptables -I PREROUTING -t nat -i $INTIF.5 -j LOG --log-ip-options --log-prefix "PREROUTING (nat):"
echo " Enabling SNAT (MASQUERADE) functionality on $EXTIF"
bash_exec "iptables -t nat -A POSTROUTING -o $EXTIF -j MASQUERADE"
echo -e "\nrc.firewall-iptables v$FWVER done.\n"
iptables -t mangle -nvL
iptables -t filter -nvL
......@@ -375,33 +375,42 @@ create_openvswitch_interface() {
build_enb_vlan_network() {
# create vlan interface
if [ is_real_interface $ENB_INTERFACE_NAME_FOR_S1_MME ]; then
is_real_interface $ENB_INTERFACE_NAME_FOR_S1_MME
if [ $? -eq 1 ]; then
ifconfig "$ENB_INTERFACE_NAME_FOR_S1_MME".1 down" > /dev/null 2>&1
vconfig rem "$ENB_INTERFACE_NAME_FOR_S1_MME".1 > /dev/null 2>&1
sync
bash_exec "vconfig add ENB_INTERFACE_NAME_FOR_S1_MME 1"
sync
bash_exec "ip -4 addr add $ENB_IPV4_ADDRESS_FOR_S1_MME dev $ENB_INTERFACE_NAME_FOR_S1_MME.1"
else
echo_fatal "BAD INTERFACE NAME FOR ENB S1-MME "$ENB_INTERFACE_NAME_FOR_S1_MME" (waiting for ethx)"
echo_fatal "BAD INTERFACE NAME FOR ENB S1-MME "$ENB_INTERFACE_NAME_FOR_S1_MME' (waiting for ethx)'
fi;
if [ is_real_interface $ENB_INTERFACE_NAME_FOR_S1U ]; then
vconfig rem $ENB_INTERFACE_NAME_FOR_S1U.2 > /dev/null 2>&1
is_real_interface $ENB_INTERFACE_NAME_FOR_S1U
if [ $? -eq 1 ]; then
ifconfig "$ENB_INTERFACE_NAME_FOR_S1U".2 down" > /dev/null 2>&1
vconfig rem "$ENB_INTERFACE_NAME_FOR_S1U".2 > /dev/null 2>&1
sync
bash_exec "vconfig add ENB_INTERFACE_NAME_FOR_S1U 2"
sync
bash_exec "ip -4 addr add $ENB_IPV4_ADDRESS_FOR_S1U dev $ENB_INTERFACE_NAME_FOR_S1U.2"
sync
else
echo_fatal "BAD INTERFACE NAME FOR ENB S1U "$ENB_INTERFACE_NAME_FOR_S1U" (waiting for ethx)"
echo_fatal "BAD INTERFACE NAME FOR ENB S1U "$ENB_INTERFACE_NAME_FOR_S1U' (waiting for ethx)'
fi;
}
clean_enb_vlan_network() {
# create vlan interface
if [ is_real_interface $ENB_INTERFACE_NAME_FOR_S1_MME ]; then
is_real_interface $ENB_INTERFACE_NAME_FOR_S1_MME
if [ $? -eq 1 ]; then
ifconfig "$ENB_INTERFACE_NAME_FOR_S1_MME".2 down" > /dev/null 2>&1
vconfig rem "$ENB_INTERFACE_NAME_FOR_S1_MME".1 > /dev/null 2>&1
fi;
if [ is_real_interface $ENB_INTERFACE_NAME_FOR_S1U ]; then
is_real_interface $ENB_INTERFACE_NAME_FOR_S1U
if [ $? -eq 1 ]; then
ifconfig "$ENB_INTERFACE_NAME_FOR_S1U".2 down" > /dev/null 2>&1
vconfig rem $ENB_INTERFACE_NAME_FOR_S1U.2 > /dev/null 2>&1
fi;
sync;
......@@ -458,27 +467,27 @@ build_mme_spgw_vlan_network() {
# create vlan interface
if [ is_real_interface $MME_INTERFACE_NAME_FOR_S1_MME ]; then
ifconfig "$MME_INTERFACE_NAME_FOR_S1_MME".1 down" > /dev/null 2>&1
bash_exec "vconfig rem $MME_INTERFACE_NAME_FOR_S1_MME.1" > /dev/null 2>&1
sync
bash_exec "vconfig add MME_INTERFACE_NAME_FOR_S1_MME 1"
sync
bash_exec "ip -4 addr add $MME_IPV4_ADDRESS_FOR_S1_MME dev $MME_INTERFACE_NAME_FOR_S1_MME.1"
else
echo_fatal "BAD INTERFACE NAME FOR SGW S1-MME "$MME_INTERFACE_NAME_FOR_S1_MME" (waiting for ethx)"
echo_fatal "BAD INTERFACE NAME FOR SGW S1-MME "$MME_INTERFACE_NAME_FOR_S1_MME' (waiting for ethx)'
fi;
if [ is_real_interface $SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP ]; then
ifconfig "$SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP".2 down" > /dev/null 2>&1
vconfig rem $SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP.2 > /dev/null 2>&1
sync
bash_exec "vconfig add SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP 2"
sync
bash_exec "ip -4 addr add $MME_IPV4_ADDRESS_FOR_S1_MME dev $SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP.2"
bash_exec "ip -4 addr add $SGW_IPV4_ADDRESS_FOR_S1U_S12_S4_UP dev $SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP.2"
sync
else
echo_fatal "BAD INTERFACE NAME FOR SGW S1U "$SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP" (waiting for ethx)"
echo_fatal "BAD INTERFACE NAME FOR SGW S1U "$SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP' (waiting for ethx)'
fi;
ping -c 1 router.eur > /dev/null || { echo_fatal "router.eur does not respond to ping" >&2 ; }
IP_ROUTER=`python -c 'import socket; print socket.gethostbyname("router.eur")'`
export MAC_ROUTER=`ip neigh show | grep $IP_ROUTER | cut -d ' ' -f5 | tr -d ':'`
......@@ -569,6 +578,7 @@ build_mme_spgw_vlan_network() {
for i in 5 6 7 8 9 10 11 12 13 14 15
do
# create vlan interface
ifconfig "$PGW_INTERFACE_NAME_FOR_SGI".$i down" > /dev/null 2>&1
vconfig rem $PGW_INTERFACE_NAME_FOR_SGI.$i > /dev/null 2>&1
sync
bash_exec "vconfig add $PGW_INTERFACE_NAME_FOR_SGI $i"
......@@ -622,12 +632,20 @@ clean_epc_vlan_network() {
bash_exec "modprobe 8021q"
ip link set $PGW_INTERFACE_NAME_FOR_SGI off > /dev/null 2>&1
ifconfig "$MME_INTERFACE_NAME_FOR_S1_MME".1 down" > /dev/null 2>&1
vconfig rem $MME_INTERFACE_NAME_FOR_S1_MME.1 > /dev/null 2>&1
ifconfig "$SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP".2 down" > /dev/null 2>&1
vconfig rem $SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP.2 > /dev/null 2>&1
for i in 5 6 7 8 9 10 11 12 13 14 15
do
# delete vlan interface
ifconfig "$PGW_INTERFACE_NAME_FOR_SGI".$i down" > /dev/null 2>&1
vconfig rem $PGW_INTERFACE_NAME_FOR_SGI.$i > /dev/null 2>&1
done
ip link set $PGW_INTERFACE_NAME_FOR_SGI down > /dev/null 2>&1
}
build_openvswitch_network() {
......@@ -857,9 +875,6 @@ build_epc_ovs_network() {
#This table can be used to avoid packets (connection really) to enter the NAT table:
# iptables -t raw -I PREROUTING -i BRIDGE -s x.x.x.x -j NOTRACK.
#bash_exec "$IPTABLES -t nat -A POSTROUTING -o $PGW_INTERFACE_NAME_FOR_SGI -j SNAT --to-source $PGW_IP_ADDR_FOR_SGI"
else
# # get ipv4 address from PGW_INTERFACE_NAME_FOR_SGI
......@@ -872,6 +887,7 @@ build_epc_ovs_network() {
for i in 5 6 7 8 9 10 11 12 13 14 15
do
# create vlan interface
ifconfig "$PGW_INTERFACE_NAME_FOR_SGI".$i down" > /dev/null 2>&1
vconfig rem $PGW_INTERFACE_NAME_FOR_SGI.$i > /dev/null 2>&1
sync
bash_exec "vconfig add $PGW_INTERFACE_NAME_FOR_SGI $i"
......
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