Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
N
nexdpi
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
sysadmin
nexdpi
Commits
a6f49b25
Commit
a6f49b25
authored
4 years ago
by
Franco (nextime) Lanza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add rc.local example
parent
52752635
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
103 additions
and
0 deletions
+103
-0
rc.local
rc.local
+103
-0
No files found.
rc.local
0 → 100755
View file @
a6f49b25
#!/bin/bash -x
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
WLAN
=
"wlx485d602d09c8"
WANS
=
"ppp0 ppp1 eth0 eth1
$WLAN
"
EXTTUNS
=
"tun600"
ISPS
=
"vanilla rain"
INTLAN
=
"192.168.1.0/24"
MYLANIP
=
"192.168.1.1"
#Set the best governor for CPU
for
CPUID
in
$(
grep
processor /proc/cpuinfo |
awk
'{print $3}'
)
;
do
cpufreq-set
-r
-c
$CPUID
-g
performance
done
# Disable HT as is a shit for routing performances..
for
CPU
in
/sys/devices/system/cpu/cpu[0-9]
*
;
do
CPUID
=
$(
basename
$CPU
)
echo
"CPU:
$CPUID
"
;
if
test
-e
$CPU
/online
;
then
echo
"1"
>
$CPU
/online
;
fi
;
COREID
=
"
$(
cat
$CPU
/topology/core_id
)
"
;
eval
"COREENABLE=
\"\$
{core
${
COREID
}
enable}
\"
"
;
if
${
COREENABLE
:-
true
}
;
then
echo
"
${
CPU
}
core=
${
CORE
}
-> enable"
eval
"core
${
COREID
}
enable='false'"
;
else
echo
"
$CPU
core=
${
CORE
}
-> disable"
;
echo
"0"
>
"
$CPU
/online"
;
fi
;
done
;
for
WAN
in
$WANS
do
iptables
-t
nat
-I
POSTROUTING
-o
$WAN
-j
MASQUERADE
done
# Just a bit of performances
iptables
-A
FORWARD
-p
tcp
--tcp-flags
SYN,RST SYN
-j
TCPMSS
--clamp-mss-to-pmtu
# NOTE: YOU MUST have the tables as per in the $ISPS variable
# configured properly!
# example:
# cat /etc/iproute2/rt_tables
# #
# # reserved values
# #
# 255 local
# 254 main
# 253 default
# 0 unspec
# #
# # local
# #
# #1 inr.ruhep
# 60 catchall
# 58 telkom
# 57 rain
# 50 level7
# 40 vanilla
for
ISP
in
$ISPS
do
ip route add
$INTLAN
dev br0 scope
link
src
$MYLANIP
table
$ISP
done
# Change default priority for main so we can add a new table between main and default
ip rule add priority 32765 from all lookup main
ip rule del priority 32766 from all lookup main
# then add a special table catchall
ip rule add priority 32766 from all lookup catchall
ip route flush cache
iptables
-t
mangle
-A
POSTROUTING
-j
CONNMARK
--save-mark
iptables
-t
mangle
-A
PREROUTING
-j
CONNMARK
--restore-mark
# Shaping policies
setsid /etc/multihome/shaping &
# Deep Packet Inspection
/etc/multihome/dpi
>
/tmp/dpi.log 2>&1 &
disown
ipset add full_ip 192.168.1.2
ipset add full_ip 192.168.1.3
exit
0
This diff is collapsed.
Click to expand it.
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