Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
canghaiwuhen
OpenXG-RAN
Commits
d60c8d69
Commit
d60c8d69
authored
Jun 18, 2014
by
Lionel Gauthier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
git-svn-id:
http://svn.eurecom.fr/openair4G/trunk@5410
818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent
2cd42147
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
56 additions
and
334 deletions
+56
-334
targets/PROJECTS/GENERIC-LTE-EPC/interfaces.bash
targets/PROJECTS/GENERIC-LTE-EPC/interfaces.bash
+26
-27
targets/PROJECTS/GENERIC-LTE-EPC/networks.bash
targets/PROJECTS/GENERIC-LTE-EPC/networks.bash
+26
-298
targets/PROJECTS/GENERIC-LTE-EPC/start_epc.bash
targets/PROJECTS/GENERIC-LTE-EPC/start_epc.bash
+3
-5
targets/PROJECTS/GENERIC-LTE-EPC/utils.bash
targets/PROJECTS/GENERIC-LTE-EPC/utils.bash
+1
-4
No files found.
targets/PROJECTS/GENERIC-LTE-EPC/interfaces.bash
View file @
d60c8d69
...
...
@@ -163,23 +163,13 @@ is_openvswitch_interface() {
if
[
"a
$var
"
==
"a"
]
;
then
return
0
fi
if
[
"a
${
var
:0:3
}
"
==
"aeth"
]
;
then
return
0
;
else
if
[
"a
${
var
:0:4
}
"
==
"awlan"
]
;
then
return
0
;
else
if
[
"a
${
var
:0:4
}
"
==
"awifi"
]
;
then
return
0
;
else
if
[
"a
${
var
:0:4
}
"
==
"anone"
]
;
then
return
0
;
else
if
[
"a
${
var
:0:3
}
"
==
"atun"
]
;
then
return
0
;
else
if
[
"a
${
var
:0:4
}
"
==
"avbox"
]
;
then
return
0
;
if
[
"a
${
var
:0:3
}
"
!=
"aeth"
]
;
then
if
[
"a
${
var
:0:4
}
"
!=
"awlan"
]
;
then
if
[
"a
${
var
:0:4
}
"
!=
"awifi"
]
;
then
if
[
"a
${
var
:0:4
}
"
!=
"anone"
]
;
then
if
[
"a
${
var
:0:3
}
"
!=
"atun"
]
;
then
if
[
"a
${
var
:0:4
}
"
!=
"avbox"
]
;
then
return
1
;
fi
fi
fi
...
...
@@ -187,7 +177,7 @@ is_openvswitch_interface() {
fi
fi
done
return
1
;
return
0
;
}
delete_tun_interface
()
{
...
...
@@ -200,9 +190,17 @@ delete_tun_interface() {
delete_vlan_interface
()
{
is_vlan_interface
$1
if
[
$?
-eq
0
]
;
then
ifconfig
$1
down
>
/dev/null 2>&1
vconfig rem
$1
>
/dev/null 2>&1
if
[
$?
-eq
1
]
;
then
bash_exec
"ifconfig
$1
down "
bash_exec
"vconfig rem
$1
"
fi
}
delete_openvswitch_interface
()
{
is_openvswitch_interface
$1
if
[
$?
-eq
1
]
;
then
bash_exec
"ifconfig
$1
down "
bash_exec
"tunctl -d
$1
"
fi
}
...
...
@@ -210,20 +208,21 @@ delete_vlan_interface() {
create_tun_interface
()
{
is_tun_interface
$1
if
[
$?
-eq
1
]
;
then
openvpn
--mktun
--dev
$1
bash_exec
"openvpn --mktun --dev
$1
"
fi
#ip link set $1 up
}
delete_openvswitch
_interface
()
{
is_
openvswitch
_interface
$1
create_vlan
_interface
()
{
is_
vlan
_interface
$1
if
[
$?
-eq
1
]
;
then
ifconfig
$1
down
>
/dev/null 2>&1
tunctl
-d
$1
>
/dev/null 2>&1
interface_name
=
`
echo
$1
|
cut
-f1
-d
'.'
`
vlan
=
`
echo
$1
|
cut
-f2
-d
'.'
`
bash_exec
"vconfig add
$interface_name
$vlan
"
fi
}
create_openvswitch_interface
()
{
is_openvswitch_interface
$1
if
[
$?
-eq
1
]
;
then
...
...
targets/PROJECTS/GENERIC-LTE-EPC/networks.bash
View file @
d60c8d69
...
...
@@ -36,10 +36,6 @@
# email: lionel.gauthier@eurecom.fr
#
###########################################################
THIS_NETWORKS_SCRIPT_PATH
=
$(
dirname
$(
readlink
-f
$0
))
source
$THIS_NETWORKS_SCRIPT_PATH
/interfaces.bash
###########################################################
# example: netcalc 192.168.12.100 255.255.255.0
netcalc
(){
...
...
@@ -56,100 +52,16 @@ netcalc(){
echo
"
${
ip
[*]
}
"
}
build_network
()
{
echo
"TO DO"
}
build_openvswitch_network
()
{
start_openswitch_daemon
# REMINDER:
# hss.eur
# |
# +-----------+ +------+ +-----------+ v +----------+
# | eNB +------+ | ovs | VLAN 1+------+ MME +----+ +---+ HSS |
# | |cpenb0+------------------+cpmme0| | +------+ | |
# | +------+ |bridge| +------+ +----+ +---+ |
# | |upenb0+-------+ | | | +----------+
# | +------+ | | | +-+-------+-+
# | | | | +----------------| s11mme|---+
# | | | | +---+---+ |
# | | | | (optional)| |ovs bridge is optional
# +-----------+ | | +---+---+ |
# +---|------------------ | s11sgw|---+ router.eur
# | +-+-------+-+ | +--------------+
# | | S+P-GW | v | ROUTER |
# | VLAN2 +------+ +-------+ +----+ +----+
# +----------+upsgw0| |sgi +-...-+ | | +---...Internet
# +------+ +-------+ +----+ +----+
# | | 11 VLANS | |
# +-----------+ ids=[5..15] +--------------+
#
##################################################
# build bridge between eNB and MME/SPGW
##################################################
#create_openvswitch_interface $ENB_INTERFACE_NAME_FOR_S1_MME
#create_openvswitch_interface $ENB_INTERFACE_NAME_FOR_S1U
#create_openvswitch_interface $MME_INTERFACE_NAME_FOR_S1_MME
#create_openvswitch_interface $SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP
#create_openvswitch_interface $MME_INTERFACE_NAME_FOR_S11_MME
#create_openvswitch_interface $SGW_INTERFACE_NAME_FOR_S11
bash_exec
"ovs-vsctl add-br
$BRIDGE
"
bash_exec
"ovs-vsctl add-port
$BRIDGE
$ENB_INTERFACE_NAME_FOR_S1_MME
tag=1"
bash_exec
"ovs-vsctl add-port
$BRIDGE
$MME_INTERFACE_NAME_FOR_S1_MME
tag=1"
bash_exec
"ovs-vsctl add-port
$BRIDGE
$ENB_INTERFACE_NAME_FOR_S1U
tag=2"
bash_exec
"ovs-vsctl add-port
$BRIDGE
$SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP
tag=2"
if
[
"a
${
MME_INTERFACE_NAME_FOR_S11_MME
:0:4
}
"
!=
"anone"
]
;
then
bash_exec
"ovs-vsctl add-port
$BRIDGE
$MME_INTERFACE_NAME_FOR_S11_MME
tag=3"
fi
if
[
"a
${
SGW_INTERFACE_NAME_FOR_S11
:0:4
}
"
!=
"anone"
]
;
then
bash_exec
"ovs-vsctl add-port
$BRIDGE
$SGW_INTERFACE_NAME_FOR_S11
tag=3"
fi
set_interface_up
$MME_INTERFACE_NAME_FOR_S1_MME
$MME_IPV4_ADDRESS_FOR_S1_MME
$MME_IPV4_NETMASK_FOR_S1_MME
set_interface_up
$SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP
$SGW_IPV4_ADDRESS_FOR_S1U_S12_S4_UP
$SGW_IPV4_NETMASK_FOR_S1U_S12_S4_UP
set_interface_up
$ENB_INTERFACE_NAME_FOR_S1_MME
$ENB_IPV4_ADDRESS_FOR_S1_MME
$ENB_IPV4_NETMASK_FOR_S1_MME
set_interface_up
$ENB_INTERFACE_NAME_FOR_S1U
$ENB_IPV4_ADDRESS_FOR_S1U
$ENB_IPV4_NETMASK_FOR_S1U
set_interface_up
$MME_INTERFACE_NAME_FOR_S11_MME
$MME_IPV4_ADDRESS_FOR_S11_MME
$MME_IPV4_NETMASK_FOR_S11_MME
set_interface_up
$SGW_INTERFACE_NAME_FOR_S11
$SGW_IPV4_ADDRESS_FOR_S11
$SGW_IPV4_NETMASK_FOR_S11
get_mac_router
}
clean_openvswitch_network
()
{
start_openswitch_daemon
##################################################
# del bridge between eNB and MME/SPGW
##################################################
delete_openvswitch_interface
$ENB_INTERFACE_NAME_FOR_S1_MME
delete_openvswitch_interface
$ENB_INTERFACE_NAME_FOR_S1U
delete_openvswitch_interface
$MME_INTERFACE_NAME_FOR_S1_MME
delete_openvswitch_interface
$SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP
delete_openvswitch_interface
$MME_INTERFACE_NAME_FOR_S11_MME
delete_openvswitch_interface
$SGW_INTERFACE_NAME_FOR_S11
if
is_process_started ovs-vswitchd
;
then
ovs-vsctl del-br
$BRIDGE
>
/dev/null 2>&1
fi
stop_openswitch_daemon
}
build_enb_vlan_network
()
{
# create vlan interface
is_vlan_interface
$ENB_INTERFACE_NAME_FOR_S1_MME
if
[
$?
-eq
1
]
;
then
interface_name
=
`
echo
$ENB_INTERFACE_NAME_FOR_S1_MME
|
cut
-f1
-d
'.'
`
vlan
=
`
echo
$ENB_INTERFACE_NAME_FOR_S1_MME
|
cut
-f2
-d
'.'
`
ifconfig
$ENB_INTERFACE_NAME_FOR_S1_MME
down
>
/dev/null 2>&1
vconfig rem
$ENB_INTERFACE_NAME_FOR_S1_MME
>
/dev/null 2>&1
delete_vlan_interface
$ENB_INTERFACE_NAME_FOR_S1_MME
sync
bash_exec
"vconfig add
$interface_name
$vlan
"
create_vlan_interface
$ENB_INTERFACE_NAME_FOR_S1_MME
sync
#bash_exec "ifconfig $ENB_INTERFACE_NAME_FOR_S1_MME up"
#sync
#bash_exec "ip -4 addr add $ENB_IPV4_ADDRESS_FOR_S1_MME/$ENB_IPV4_NETMASK_FOR_S1_MME dev $ENB_INTERFACE_NAME_FOR_S1_MME"
set_interface_up
$ENB_INTERFACE_NAME_FOR_S1_MME
$ENB_IPV4_ADDRESS_FOR_S1_MME
$ENB_IPV4_NETMASK_FOR_S1_MME
else
echo_fatal
"BAD INTERFACE NAME FOR ENB S1-MME
$ENB_INTERFACE_NAME_FOR_S1_MME
"
' (waiting for ethx.y, wlanx.y or wifix.y)'
...
...
@@ -157,16 +69,10 @@ build_enb_vlan_network() {
is_vlan_interface
$ENB_INTERFACE_NAME_FOR_S1U
if
[
$?
-eq
1
]
;
then
interface_name
=
`
echo
$ENB_INTERFACE_NAME_FOR_S1U
|
cut
-f1
-d
'.'
`
vlan
=
`
echo
$ENB_INTERFACE_NAME_FOR_S1U
|
cut
-f2
-d
'.'
`
ifconfig
$ENB_INTERFACE_NAME_FOR_S1U
down
>
/dev/null 2>&1
vconfig rem
$ENB_INTERFACE_NAME_FOR_S1U
>
/dev/null 2>&1
delete_vlan_interface
$ENB_INTERFACE_NAME_FOR_S1U
sync
bash_exec
"vconfig add
$interface_name
$vlan
"
create_vlan_interface
$ENB_INTERFACE_NAME_FOR_S1U
sync
#bash_exec "ifconfig $ENB_INTERFACE_NAME_FOR_S1U up"
#sync
#bash_exec "ip -4 addr add $ENB_IPV4_ADDRESS_FOR_S1U/$ENB_IPV4_NETMASK_FOR_S1U dev $ENB_INTERFACE_NAME_FOR_S1U"
set_interface_up
$ENB_INTERFACE_NAME_FOR_S1U
$ENB_IPV4_ADDRESS_FOR_S1U
$ENB_IPV4_NETMASK_FOR_S1U
sync
else
...
...
@@ -178,15 +84,13 @@ clean_enb_vlan_network() {
is_vlan_interface
$ENB_INTERFACE_NAME_FOR_S1_MME
if
[
$?
-eq
1
]
;
then
echo_success
"Found VLAN interface
$ENB_INTERFACE_NAME_FOR_S1_MME
... deleting"
ifconfig
$ENB_INTERFACE_NAME_FOR_S1_MME
down
>
/dev/null 2>&1
vconfig rem
$ENB_INTERFACE_NAME_FOR_S1_MME
>
/dev/null 2>&1
delete_vlan_interface
$ENB_INTERFACE_NAME_FOR_S1_MME
fi
;
is_vlan_interface
$ENB_INTERFACE_NAME_FOR_S1U
if
[
$?
-eq
1
]
;
then
echo_success
"Found VLAN interface
$ENB_INTERFACE_NAME_FOR_S1U
... deleting"
ifconfig
$ENB_INTERFACE_NAME_FOR_S1U
down
>
/dev/null 2>&1
vconfig rem
$ENB_INTERFACE_NAME_FOR_S1U
>
/dev/null 2>&1
delete_vlan_interface
$ENB_INTERFACE_NAME_FOR_S1U
fi
;
sync
;
clean_network
...
...
@@ -221,16 +125,10 @@ build_mme_spgw_vlan_network() {
# create vlan interface
is_vlan_interface
$MME_INTERFACE_NAME_FOR_S1_MME
if
[
$?
-eq
1
]
;
then
interface_name
=
`
echo
$MME_INTERFACE_NAME_FOR_S1_MME
|
cut
-f1
-d
'.'
`
vlan
=
`
echo
$MME_INTERFACE_NAME_FOR_S1_MME
|
cut
-f2
-d
'.'
`
ifconfig
$MME_INTERFACE_NAME_FOR_S1_MME
down
>
/dev/null 2>&1
vconfig rem
$MME_INTERFACE_NAME_FOR_S1_MME
>
/dev/null 2>&1
delete_vlan_interface
$MME_INTERFACE_NAME_FOR_S1_MME
sync
bash_exec
"vconfig add
$interface_name
$vlan
"
create_vlan_interface
$MME_INTERFACE_NAME_FOR_S1_MME
sync
#bash_exec "ifconfig $MME_INTERFACE_NAME_FOR_S1_MME up"
#sync
#"bash_exec "ip -4 addr add $MME_IPV4_ADDRESS_FOR_S1_MME/$MME_IPV4_NETMASK_FOR_S1_MME dev $MME_INTERFACE_NAME_FOR_S1_MME"
set_interface_up
$MME_INTERFACE_NAME_FOR_S1_MME
$MME_IPV4_ADDRESS_FOR_S1_MME
$MME_IPV4_NETMASK_FOR_S1_MME
else
echo_fatal
"BAD INTERFACE NAME FOR SGW S1-MME
$MME_INTERFACE_NAME_FOR_S1_MME
"
' (waiting for ethx.y, wlanx.y or wifix.y)'
...
...
@@ -238,17 +136,10 @@ build_mme_spgw_vlan_network() {
is_vlan_interface
$SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP
if
[
$?
-eq
1
]
;
then
interface_name
=
`
echo
$SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP
|
cut
-f1
-d
'.'
`
vlan
=
`
echo
$SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP
|
cut
-f2
-d
'.'
`
ifconfig
$SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP
down
>
/dev/null 2>&1
vconfig rem
$SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP
>
/dev/null 2>&1
delete_vlan_interface
$SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP
sync
bash_exec
"vconfig add
$interface_name
$vlan
"
create_vlan_interface
$SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP
sync
#bash_exec "ifconfig $SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP up"
#sync
#bash_exec "ip -4 addr add $SGW_IPV4_ADDRESS_FOR_S1U_S12_S4_UP/$SGW_IPV4_NETMASK_FOR_S1U_S12_S4_UP dev $SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP"
#sync
set_interface_up
$SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP
$SGW_IPV4_ADDRESS_FOR_S1U_S12_S4_UP
$SGW_IPV4_NETMASK_FOR_S1U_S12_S4_UP
else
echo_fatal
"BAD INTERFACE NAME FOR SGW S1U
$SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP
"
' (waiting for ethx.y, wlanx.y or wifix.y)'
...
...
@@ -264,111 +155,20 @@ build_mme_spgw_vlan_network() {
}
clean_epc_vlan_network
()
{
bash_exec
"modprobe tun"
bash_exec
"modprobe ip_tables"
bash_exec
"modprobe iptable_nat"
bash_exec
"modprobe x_tables"
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 raw -F"
bash_exec
"
$IPTABLES
-t nat -F"
bash_exec
"
$IPTABLES
-t mangle -F"
bash_exec
"
$IPTABLES
-t filter -F"
bash_exec
"ip route flush cache"
echo
" Disabling forwarding"
bash_exec
"sysctl -w net.ipv4.ip_forward=0"
assert
"
`
sysctl
-n
net.ipv4.ip_forward
`
-eq 0"
$LINENO
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
"modprobe 8021q"
delete_vlan_interface
$MME_INTERFACE_NAME_FOR_S1_MME
delete_vlan_interface
$SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP
for
i
in
5 6 7 8 9 10 11 12 13 14 15
do
# delete vlan interface
delete_vlan_interface
$PGW_INTERFACE_NAME_FOR_SGI
.
$i
down
delete_vlan_interface
$PGW_INTERFACE_NAME_FOR_SGI
.
$i
done
clean_network
}
build_tun_network
()
{
# REMINDER:
# hss.eur
# |
# +-----------+ +-----------+ v +----------+
# | eNB +------+ +------+ MME +----+ +---+ HSS |
# | |cpenb0+------------------+cpmme0| |s6am+------+s6a| |
# | +------+ +------+ +----+ +---+ |
# | |upenb0+-------+ | | +----------+
# | +------+ | +-+-------+-+
# | | | | s11mme|
# | | | +---+---+
# | | | (optional)|
# +-----------+ | +---+---+
# | | s11sgw| router.eur
# | +-+-------+-+ | +--------------+
# | | S+P-GW | v | ROUTER |
# | +------+ +-------+ +----+ +----+
# +----------+upsgw0| |sgi +-...-+ | | +---...Internet
# +------+ +-------+ +----+ +----+
# | | 11 VLANS | |
# +-----------+ ids=[5..15] +--------------+
#
bash_exec
"modprobe tun"
##################################################
# build network between eNB and MME/SPGW and HSS
##################################################
echo_success
"ENB_INTERFACE_NAME_FOR_S1_MME is "
$ENB_INTERFACE_NAME_FOR_S1_MME
" addr is "
$ENB_IPV4_ADDRESS_FOR_S1_MME
echo_success
"ENB_INTERFACE_NAME_FOR_S1U is "
$ENB_INTERFACE_NAME_FOR_S1U
" addr is "
$ENB_IPV4_ADDRESS_FOR_S1U
echo_success
"MME_INTERFACE_NAME_FOR_S1_MME is "
$MME_INTERFACE_NAME_FOR_S1_MME
" addr is "
$MME_IPV4_ADDRESS_FOR_S1_MME
echo_success
"SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP is "
$SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP
" addr is "
$SGW_IPV4_ADDRESS_FOR_S1U_S12_S4_UP
echo_success
"MME_INTERFACE_NAME_FOR_S11_MME is "
$MME_INTERFACE_NAME_FOR_S11_MME
" addr is "
$MME_IPV4_ADDRESS_FOR_S11_MME
echo_success
"SGW_INTERFACE_NAME_FOR_S11 is "
$SGW_INTERFACE_NAME_FOR_S11
" addr is "
$SGW_IPV4_ADDRESS_FOR_S11
echo_success
"MME_INTERFACE_NAME_FOR_S6A is "
$MME_INTERFACE_NAME_FOR_S6A
" addr is "
$MME_IPV4_ADDRESS_FOR_S6A
echo_success
"HSS_INTERFACE_NAME_FOR_S6A is "
$HSS_INTERFACE_NAME_FOR_S6A
" addr is "
$HSS_IPV4_ADDRESS_FOR_S6A
create_tun_interface
$ENB_INTERFACE_NAME_FOR_S1_MME
create_tun_interface
$ENB_INTERFACE_NAME_FOR_S1U
create_tun_interface
$MME_INTERFACE_NAME_FOR_S1_MME
create_tun_interface
$SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP
create_tun_interface
$MME_INTERFACE_NAME_FOR_S11_MME
create_tun_interface
$SGW_INTERFACE_NAME_FOR_S11
create_tun_interface
$MME_INTERFACE_NAME_FOR_S6A
create_tun_interface
$HSS_INTERFACE_NAME_FOR_S6A
set_interface_up
$MME_INTERFACE_NAME_FOR_S1_MME
$MME_IPV4_ADDRESS_FOR_S1_MME
$MME_IPV4_NETMASK_FOR_S1_MME
set_interface_up
$SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP
$SGW_IPV4_ADDRESS_FOR_S1U_S12_S4_UP
$SGW_IPV4_NETMASK_FOR_S1U_S12_S4_UP
set_interface_up
$ENB_INTERFACE_NAME_FOR_S1_MME
$ENB_IPV4_ADDRESS_FOR_S1_MME
$ENB_IPV4_NETMASK_FOR_S1_MME
set_interface_up
$ENB_INTERFACE_NAME_FOR_S1U
$ENB_IPV4_ADDRESS_FOR_S1U
$ENB_IPV4_NETMASK_FOR_S1U
set_interface_up
$MME_INTERFACE_NAME_FOR_S11_MME
$MME_IPV4_ADDRESS_FOR_S11_MME
$MME_IPV4_NETMASK_FOR_S11_MME
set_interface_up
$SGW_INTERFACE_NAME_FOR_S11
$SGW_IPV4_ADDRESS_FOR_S11
$SGW_IPV4_NETMASK_FOR_S11
set_interface_up
$MME_INTERFACE_NAME_FOR_S6A
$MME_IPV4_ADDRESS_FOR_S6A
$MME_IPV4_NETMASK_FOR_S6A
set_interface_up
$HSS_INTERFACE_NAME_FOR_S6A
$HSS_IPV4_ADDRESS_FOR_S6A
$HSS_IPV4_NETMASK_FOR_S6A
}
# arg1 is IF1 IP addr
# arg2 is IF2 IP addr
...
...
@@ -460,42 +260,34 @@ test_network() {
return
0
}
clean_tun_network
()
{
bash_exec
"modprobe tun"
##################################################
# del interfaces eNB and MME/SPGW and HSS
##################################################
delete_tun_interface
$ENB_INTERFACE_NAME_FOR_S1_MME
delete_tun_interface
$ENB_INTERFACE_NAME_FOR_S1U
delete_tun_interface
$MME_INTERFACE_NAME_FOR_S1_MME
delete_tun_interface
$SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP
delete_tun_interface
$MME_INTERFACE_NAME_FOR_S11_MME
delete_tun_interface
$SGW_INTERFACE_NAME_FOR_S11
delete_tun_interface
$MME_INTERFACE_NAME_FOR_S6A
delete_tun_interface
$HSS_INTERFACE_NAME_FOR_S6A
clean_network
()
{
interfaces
=
`
ifconfig |
grep
HWaddr |
cut
-d
" "
-f1-2
|
tr
-d
'\n'
`
for
interface
in
$interfaces
do
is_vlan_interface
$interface
if
[
$?
-eq
1
]
;
then
echo_success
"Found VLAN interface
$interface
... deleting"
delete_vlan_interface
$interface
fi
done
}
build_epc_tun_network
()
{
build_tun_network
create_sgi_vlans
}
create_sgi_vlans
()
{
get_mac_router
bash_exec
"modprobe 8021q"
bash_exec
"ip link set
$PGW_INTERFACE_NAME_FOR_SGI
promisc on"
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
"
delete_vlan_interface
$PGW_INTERFACE_NAME_FOR_SGI
.
$i
sync
bash_exec
"ifconfig
$PGW_INTERFACE_NAME_FOR_SGI
.
$i
up"
create_vlan_interface
$PGW_INTERFACE_NAME_FOR_SGI
.
$i
sync
# configure vlan interface
#CIDR=$NETWORK'.'$i'/24'
...
...
@@ -505,72 +297,8 @@ create_sgi_vlans() {
bash_exec
"ip -4 addr add
$CIDR
dev
$PGW_INTERFACE_NAME_FOR_SGI
.
$i
"
done
bash_exec
"ip link set
$PGW_INTERFACE_NAME_FOR_SGI
promisc on"
}
clean_epc_ovs_network
()
{
bash_exec
"modprobe tun"
bash_exec
"modprobe ip_tables"
bash_exec
"modprobe iptable_nat"
bash_exec
"modprobe x_tables"
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 raw -F"
bash_exec
"
$IPTABLES
-t nat -F"
bash_exec
"
$IPTABLES
-t mangle -F"
bash_exec
"
$IPTABLES
-t filter -F"
bash_exec
"ip route flush cache"
echo
" Disabling forwarding"
bash_exec
"sysctl -w net.ipv4.ip_forward=0"
assert
"
`
sysctl
-n
net.ipv4.ip_forward
`
-eq 0"
$LINENO
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
for
i
in
5 6 7 8 9 10 11 12 13 14 15
do
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
clean_network
clean_tun_network
}
clean_network
()
{
interfaces
=
`
ifconfig |
grep
HWaddr |
cut
-d
" "
-f1-2
|
tr
-d
'\n'
`
for
interface
in
$interfaces
do
is_openvswitch_interface
$interface
if
[
$?
-eq
1
]
;
then
echo_success
"Found open-vswitch interface
$interface
... deleting"
delete_openvswitch_interface
$interface
fi
is_vlan_interface
$interface
if
[
$?
-eq
1
]
;
then
echo_success
"Found VLAN interface
$interface
... deleting"
ifconfig
$interface
down
>
/dev/null 2>&1
vconfig rem
$interface
>
/dev/null 2>&1
fi
done
}
targets/PROJECTS/GENERIC-LTE-EPC/start_epc.bash
View file @
d60c8d69
...
...
@@ -133,11 +133,11 @@
# | | 11 VLANS | |
# +-----------+ ids=[5..15] +--------------+
BRIDGE
=
"vswitch"
###########################################################
THIS_SCRIPT_PATH
=
$(
dirname
$(
readlink
-f
$0
))
source
$THIS_SCRIPT_PATH
/utils.bash
.
$THIS_SCRIPT_PATH
/utils.bash
.
$THIS_SCRIPT_PATH
/interfaces.bash
.
$THIS_SCRIPT_PATH
/networks.bash
###########################################################
if
[
$#
-eq
1
]
;
then
...
...
@@ -285,8 +285,6 @@ if [ $? -eq 1 ]; then
clean_epc_vlan_network
build_mme_spgw_vlan_network
else
ovs_setting
=
0
vlan_setting
=
0
clean_epc_vlan_network
create_sgi_vlans
fi
...
...
targets/PROJECTS/GENERIC-LTE-EPC/utils.bash
View file @
d60c8d69
...
...
@@ -674,10 +674,7 @@ compile_epc() {
exit
1
fi
}
###########################################################
THIS_UTILS_SCRIPT_PATH
=
$(
dirname
$(
readlink
-f
$0
))
source
$THIS_UTILS_SCRIPT_PATH
/networks.bash
###########################################################
###########################################################
IPTABLES
=
/sbin/iptables
THIS_SCRIPT_PATH
=
$(
dirname
$(
readlink
-f
$0
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment