делали по http://mikbill.blogspot.com/2016/02/ppp ... l-ppp.html
Все по мануалу+ свои нароботки в районе 2К сесий и 700 мег трафика , начинается деградация трафика на тунелях (с тарифа 50 есть тольки 20 мег) незнаю почему
ядро Linux 3.16.0
Code: Select all
#!/bin/sh -e
#
# 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.
modprobe ip_conntrack
modprobe nf_conntrack
modprobe nf_conntrack_pptp
modprobe 8021q
modprobe sch_netem
#Правило для hashsize=nf_conntrack_max
echo 9437184 > /sys/module/nf_conntrack/parameters/hashsize
/bin/bash /usr/local/sbin/intel.sh
#IpTables
iptables -t nat --flush
iptables -t nat -A PREROUTING -s 10.7.7.0/24 ! -d 71.0/24 -j DNAT --to-destination .249
iptables -t nat -A POSTROUTING -s 192.168.0.0/16 -j SNAT --to-source 195.16
iptables -t nat -A POSTROUTING -p tcp -m tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
iptables -t filter -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -t filter -A INPUT -p icmp -j ACCEPT
iptables -t filter -A INPUT -p gre -j ACCEPT
iptables -t filter -A INPUT -i lo -j ACCEPT
iptables -t filter -A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
iptables -t filter -A INPUT -p udp -m udp --dport 3799 -j ACCEPT
iptables -t filter -I INPUT -p udp --dport 123 -j ACCEPT
iptables -t filter -A INPUT -p tcp -m tcp --dport 3799 -j ACCEPT
iptables -t filter -A INPUT -p tcp -m tcp --dport 10050 -j ACCEPT
iptables -t filter -A INPUT -p tcp -m tcp --dport 10051 -j ACCEPT
iptables -t filter -A INPUT -i out12 -p ospf -m state --state NEW -j ACCEPT
iptables -t filter -A INPUT -i in12.999 -p tcp -m state --state NEW -m tcp --dport 1723 -j ACCEPT
iptables -t filter -A INPUT -j REJECT --reject-with icmp-host-prohibited
iptables -t filter -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -t filter -A FORWARD -m state --state INVALID -j DROP
#Роути на наші мережі
/sbin/route add -net 10.9.0.0/16 gw 10.9.9.1
/sbin/route add -net 172.16.0.0/16 gw 10.9.9.1
#Продовжуємо черги
/sbin/ifconfig eth4 txqueuelen 10000
/sbin/ifconfig eth5 txqueuelen 10000
/sbin/ifconfig eth6 txqueuelen 10000
/sbin/ifconfig eth7 txqueuelen 10000
/sbin/ifconfig out12 txqueuelen 10000
/sbin/ifconfig in12 txqueuelen 10000
#Зміна параметрів Езертула
/sbin/ethtool -K eth4 rx off tx off
/sbin/ethtool -K eth5 rx off tx off
/sbin/ethtool -K eth6 rx off tx off
/sbin/ethtool -K eth7 rx off tx off
/sbin/ethtool -G eth4 rx 8096
/sbin/ethtool -G eth5 rx 8096
/sbin/ethtool -G eth6 rx 8096
/sbin/ethtool -G eth7 rx 8096
/sbin/ethtool -G eth4 tx 8096
/sbin/ethtool -G eth5 tx 8096
/sbin/ethtool -G eth6 tx 8096
/sbin/ethtool -G eth7 tx 8096
/sbin/ethtool -A eth4 autoneg off rx off
/sbin/ethtool -A eth4 autoneg off tx off
/sbin/ethtool -A eth5 autoneg off rx off
/sbin/ethtool -A eth5 autoneg off tx off
/sbin/ethtool -A eth6 autoneg off rx off
/sbin/ethtool -A eth6 autoneg off tx off
/sbin/ethtool -A eth7 autoneg off rx off
/sbin/ethtool -A eth7 autoneg off tx off
/sbin/ethtool --offload eth4 rx off tx off
/sbin/ethtool --offload eth5 rx off tx off
/sbin/ethtool --offload eth6 rx off tx off
/sbin/ethtool --offload eth7 rx off tx off
/sbin/ethtool -K eth4 rxvlan off txvlan off
/sbin/ethtool -K eth5 rxvlan off txvlan off
/sbin/ethtool -K eth6 rxvlan off txvlan off
/sbin/ethtool -K eth7 rxvlan off txvlan off
/usr/sbin/service accel-pppd start
exit 0
Code: Select all
cat /etc/sysctl.conf
#
# /etc/sysctl.conf - Configuration file for setting system variables
# See /etc/sysctl.d/ for additonal system variables
# See sysctl.conf (5) for information.
#
#kernel.domainname = example.com
# Uncomment the following to stop low-level messages on console
#kernel.printk = 3 4 1 3
##############################################################3
# Functions previously found in netbase
#
# Uncomment the next two lines to enable Spoof protection (reverse-path filter)
# Turn on Source Address Verification in all interfaces to
# prevent some spoofing attacks
#net.ipv4.conf.default.rp_filter=1
#net.ipv4.conf.all.rp_filter=1
# Uncomment the next line to enable TCP/IP SYN cookies
# See http://lwn.net/Articles/277146/
# Note: This may impact IPv6 TCP sessions too
#net.ipv4.tcp_syncookies=1
# Uncomment the next line to enable packet forwarding for IPv4
#net.ipv4.ip_forward=1
# Uncomment the next line to enable packet forwarding for IPv6
# Enabling this option disables Stateless Address Autoconfiguration
# based on Router Advertisements for this host
#net.ipv6.conf.all.forwarding=1
###################################################################
# Additional settings - these settings can improve the network
# security of the host and prevent against some network attacks
# including spoofing attacks and man in the middle attacks through
# redirection. Some network environments, however, require that these
# settings are disabled so review and enable them as needed.
#
# Do not accept ICMP redirects (prevent MITM attacks)
#net.ipv4.conf.all.accept_redirects = 0
#net.ipv6.conf.all.accept_redirects = 0
# _or_
# Accept ICMP redirects only for gateways listed in our default
# gateway list (enabled by default)
# net.ipv4.conf.all.secure_redirects = 1
#
# Do not send ICMP redirects (we are not a router)
#net.ipv4.conf.all.send_redirects = 0
#
# Do not accept IP source route packets (we are not a router)
#net.ipv4.conf.all.accept_source_route = 0
#net.ipv6.conf.all.accept_source_route = 0
#
# Log Martian Packets
#net.ipv4.conf.all.log_martians = 1
#
# Controls IP packet forwarding
net.ipv4.ip_forward = 1
# Controls source route verification
net.ipv4.conf.default.rp_filter = 1
# Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0
# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 0
# Controls whether core dumps will append the PID to the core filename
# Useful for debugging multi-threaded applications
kernel.core_uses_pid = 1
# Controls the use of TCP syncookies
net.ipv4.tcp_syncookies = 1
# Controls the maximum size of a message, in bytes
kernel.msgmnb = 65536
# Controls the default maxmimum size of a mesage queue
kernel.msgmax = 65536
# Controls the maximum shared segment size, in bytes
kernel.shmmax = 68719476736
# Controls the maximum number of shared memory segments, in pages
kernel.shmall = 4294967296
##############
# nat tuning #
##############
# Увеличиваем количество conntrack соединений, необходимо менять значение
# по умолчанию только на высоконагруженных серверах.
# ядро 2.6 лучше воспринимают размеры таблиц равные степени 2, так что можно установить
# CONNTRACK_MAX и HASHSIZE равные 1048576 (2^20) etc...
# net.ipv4.netfilter.ip_conntrack_max = 4194304
# net.nf_conntrack_max = 4194304
net.ipv4.netfilter.ip_conntrack_max = 9437184
net.nf_conntrack_max = 9437184
# increase TCP max buffer size setable using setsockopt()
# изменение размеров буферов для приема и отправки данных через сокеты, tcp-memory
net.core.rmem_default = 16777216
net.core.rmem_max = 16777216
net.core.wmem_default = 16777216
net.core.wmem_max = 16777216
# increase Linux autotuning TCP buffer limits
# min, default, and max number of bytes to use
# set max to at least 4MB, or higher if you use very high BDP paths
# net.ipv4.tcp_rmem = 4096 87380 16777216
# net.ipv4.tcp_wmem = 4096 65536 16777216
net.ipv4.tcp_rmem = 4096 16777216 16777216
net.ipv4.tcp_wmem = 4096 16777216 16777216
# Максимальное число сокетов в состоянии TIME-WAIT одновременно. При превышении этого порога лишний сокет разрушается
# и пишется сообщение в системный журнал. Цель этой переменной – предотвращение простейших разновидностей DoS-атак
# Значение по-умолчанию – 180000
net.ipv4.tcp_max_tw_buckets = 1800000
# Переменная задает максимальное число осиротевших (не связанных ни с
# одним процессом) сокетов. Если это число будет превышено, то такие
# соединения разрываются, а в системный журнал пишется предупреждение. Это
# ограничение существует исключительно ради предотвращения простейших
# разновидностей DoS-атак.
net.ipv4.tcp_max_orphans = 262144
# net.ipv4.tcp_max_orphans = 65536
# When in a non-Napi (or Interrupt) mode, this counter indicates that the stack is dropping packets.
# net.core.netdev_max_backlog = 10000
net.core.netdev_max_backlog = 30000
# net.core.somaxconn = 262144
# These ensure that TIME_WAIT ports either get reused or closed fast.
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
# защита от syn-флуда
net.ipv4.tcp_syncookies=1
# запрет приёма ICMP-редиректов
# net.ipv4.conf.all.accept_redirects = 0
# net.ipv4.conf.default.accept_redirects = 0
# игнорируем широковещательные ICMP-запросы
net.ipv4.icmp_echo_ignore_broadcasts=1
# игнорируем пакеты, в которых указан путь до источника
net.ipv4.conf.all.accept_source_route=0
# Укажем диапазон портов которые разрешено использовать в качестве
# локальных. По умолчанию этот диапазон достаточно мал, и при высокой
# нагрузке вам их может просто не хватить
# net.ipv4.ip_local_port_range = 16384 61000
net.ipv4.ip_local_port_range = 1024 65535
# Уменьшим время которое используется для сообщений
# о поддержке keep alive соединений
net.ipv4.tcp_keepalive_time = 7200
# Уменьшим время до закрытия TCP соединения, данный параметр стоит менять
# только на высоко нагруженных серверах.
net.netfilter.nf_conntrack_tcp_timeout_established = 120
# Другие таймауты:
net.netfilter.nf_conntrack_udp_timeout_stream = 60
net.netfilter.nf_conntrack_udp_timeout = 60
net.netfilter.nf_conntrack_generic_timeout = 3600
# В случае kernel panic reboot через 10 секунд (panic может возникнуть при высокой нагрузке и irqbalance, например)
kernel.panic = 10
# чтобы не переполнялась арп-таблица (пишет в логах kernel: ipv4: Neighbour table overflow)
net.ipv4.neigh.default.gc_thresh1 = 4096
net.ipv4.neigh.default.gc_thresh2 = 8192
net.ipv4.neigh.default.gc_thresh3 = 12288
##Уменьшим таймаут отслеживаемых соединением.
net.netfilter.nf_conntrack_generic_timeout = 300
net.netfilter.nf_conntrack_tcp_timeout_syn_sent = 60
net.netfilter.nf_conntrack_tcp_timeout_syn_recv = 60
net.netfilter.nf_conntrack_tcp_timeout_established = 600
net.netfilter.nf_conntrack_tcp_timeout_fin_wait = 60
net.netfilter.nf_conntrack_tcp_timeout_close_wait = 45
net.netfilter.nf_conntrack_tcp_timeout_last_ack = 30
net.netfilter.nf_conntrack_tcp_timeout_time_wait = 120
net.netfilter.nf_conntrack_tcp_timeout_close = 10
net.netfilter.nf_conntrack_tcp_timeout_max_retrans = 300
net.netfilter.nf_conntrack_tcp_timeout_unacknowledged = 300
net.netfilter.nf_conntrack_udp_timeout = 30
net.netfilter.nf_conntrack_udp_timeout_stream = 60
net.netfilter.nf_conntrack_icmp_timeout = 30
net.netfilter.nf_conntrack_events_retry_timeout = 15
net.netfilter.nf_conntrack_checksum=0
net.ipv4.netfilter.ip_conntrack_checksum=0
net.core.dev_weight = 16
net.core.netdev_budget = 256
net.core.netdev_max_backlog = 16000
# File max
fs.file-max = 100000
##############
net.core.somaxconn = 65536
net.ipv4.tcp_fin_timeout = 20
net.ipv4.tcp_keepalive_time = 600
net.ipv4.tcp_orphan_retries = 2
net.ipv4.tcp_tw_recycle = 1
net.ipv4.icmp_echo_ignore_broadcasts = 1
net.core.netdev_max_backlog = 10000
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_max_syn_backlog = 4096
net.ipv4.tcp_reordering = 10
net.ipv4.tcp_congestion_control = cubic
net.ipv4.tcp_sack = 0
net.ipv4.tcp_syn_retries = 3
net.ipv4.tcp_synack_retries = 2
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_rmem = 8192 87380 16777216
net.ipv4.tcp_wmem = 8192 65536 16777216
net.ipv4.tcp_mem = 16777216 16777216 16777216
net.ipv4.ip_local_port_range = 1800 65400
#
net.ipv4.tcp_no_metrics_save = 1
net.ipv4.tcp_moderate_rcvbuf = 1
Code: Select all
auto out12
iface out12 inet static
address 195.
gateway 195.
netmask 255.255.255.
nameserver 195
bond_mode 4
bond_miimon 100
bond_downdeley 200
bond_updeley 200
bond-lacp-rate 1
slaves eth4 eth5
auto in12
iface in12 inet manual
bond_mode 4
bond_miimon 100
bond_downdelay 200
bond_updelay 200
bond-lacp-rate 1
slaves eth6 eth7