так я понял?
#------------------------------------EXTERNAL-RULES-------------------------
$LOG "Start user routes chains from /rwfs/network/routes"
/rwfs/network/routes
$LOG "Start user iptables chains from /rwfs/network/iptables"
/rwfs/network/iptables
}
myrules() {
iptables -A PREROUTING -t mangle -s 90.189.193.0/255 -j MARK --set-mark 6
iptables -A PREROUTING -t mangle -s 90.189.192.0/255 -j MARK --set-mark 6
}
stop() {
$LOG "Iptables stop"
iptables -F
iptables -t nat -F
iptables -t filter -F
iptables -t mangle -F
iptables -X
iptables -t nat -X
iptables -t filter -X
iptables -t mangle -X
iptables -t mangle -F PREROUTING
iptables -t mangle -F FORWARD
iptables -t mangle -F INPUT
iptables -t mangle -F OUTPUT
iptables -t mangle -F POSTROUTING
iptables -t nat -Z
iptables -t filter -Z
iptables -t mangle -Z
iptables -Z
}
case "$1" in
start)
start
myrules
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 1
esac
есть особенность если изменить что-то в шейпери он перестает работать но до изменений работает нормально
вот оригинал S15shaper
#!/bin/sh
SHAPER_SUPPORT=`flash get SHAPER_ENABLE | cut -f 2- -d =`
OUTIFACE=ppp0
LOG="logger -t init.d"
start() {
#----------------------------------------------CLEAR---------------------------------------------------------------
tc qdisc del dev br0 root > /dev/null 2>&1
tc qdisc del dev $OUTIFACE root > /dev/null 2>&1
tc qdisc del dev $OUTIFACE ingress > /dev/null 2>&1
if [ "$SHAPER_SUPPORT" != "on" ]; then
$LOG "Shaper disabled by user."
exit 0
fi
$LOG "Start shaper..."
NATFASTPATH=`flash get NFASTPATH_ENABLED | cut -f 2- -d =`
if [ -f /proc/FastPath ] && [ "$NATFASTPATH" = "1" ]; then
echo 0 > /proc/FastPath
echo "Disable fastpath if shaper is up."
fi
$LOG "Load needs modules..."
modprobe sch_esfq > /dev/null 2>&1
modprobe sch_sfq > /dev/null 2>&1
$LOG "Tune netsched..."
#get parametrs
BANDWIDTHUP=`flash get TOTAL_BANDWIDTH_UP | cut -f 2- -d =`
BANDWIDTHDOWN=`flash get TOTAL_BANDWIDTH_DOWN | cut -f 2- -d =`
BANDWIDTHUP_LIMIT=`flash get TOTAL_BANDWIDTH_LIMIT_UP | cut -f 2- -d =`
BANDWIDTHDOWN_LIMIT=`flash get TOTAL_BANDWIDTH_LIMIT_DOWN | cut -f 2- -d =`
LAN_IP_ADDR=`flash get LAN_IP_ADDR | cut -f 2- -d =`
LAN_IP_ADDR2=`flash get LAN_IP_ADDR2 | cut -f 2- -d =`
SHAPER_IN_ENABLE=`flash get SHAPER_IN_ENABLE | cut -f 2- -d =`
#--------------------------------------------INCOMING---------------------------------------------------------------
#all output traffic for ppp0
$LOG "All incoming ppp rate: normal $BANDWIDTHDOWN_LIMIT , maximum $BANDWIDTHDOWN (kbit/s)"
tc qdisc add dev br0 root handle 1: htb default 22
tc class add dev br0 parent 1: classid 1:1 htb rate 90mbit quantum 1500 burst 500k
tc class add dev br0 parent 1:1 classid 1:2 htb rate ${BANDWIDTHDOWN}kbit \
quantum 1500 burst 100k
tc class add dev br0 parent 1:1 classid 1:3 htb rate 80 \
ceil 90mbit prio 0 quantum 1500 burst 100k
tc class add dev br0 parent 1:2 classid 1:20 htb rate ${BANDWIDTHDOWN_LIMIT}kbit \
ceil ${BANDWIDTHDOWN}kbit prio 1 quantum 1500
tc class add dev br0 parent 1:2 classid 1:21 htb rate ${BANDWIDTHDOWN_LIMIT}kbit \
ceil ${BANDWIDTHDOWN}kbit prio 2 quantum 1500
tc class add dev br0 parent 1:2 classid 1:22 htb rate ${BANDWIDTHDOWN_LIMIT}kbit \
ceil ${BANDWIDTHDOWN}kbit prio 3 quantum 1500
tc qdisc add dev br0 parent 1:3 handle 3: esfq perturb 10 hash dst quantum 1500
tc qdisc add dev br0 parent 1:20 handle 20: esfq perturb 10 hash dst quantum 1500
tc qdisc add dev br0 parent 1:21 handle 21: esfq perturb 10 hash dst quantum 1500
tc qdisc add dev br0 parent 1:22 handle 22: esfq perturb 10 hash dst quantum 1500
if [ "$SHAPER_IN_ENABLE" = "on" ]; then
#filters for marked in prerouting
tc filter add dev br0 parent 1:0 prio 1 protocol ip handle 20 fw flowid 1:20
tc filter add dev br0 parent 1:0 prio 2 protocol ip handle 21 fw flowid 1:21
tc filter add dev br0 parent 1:0 prio 3 protocol ip handle 22 fw flowid 1:22
else
#HIGH icmp,ssh,https,telnet,sip,dns //fix me
tc filter add dev br0 parent 1:0 protocol ip prio 1 u32 match ip sport 21 0xffff flowid 1:20
tc filter add dev br0 parent 1:0 protocol ip prio 1 u32 match ip sport 22 0xffff flowid 1:20
tc filter add dev br0 parent 1:0 protocol ip prio 1 u32 match ip sport 23 0xffff flowid 1:20
tc filter add dev br0 parent 1:0 protocol ip prio 1 u32 match ip sport 53 0xffff flowid 1:20
tc filter add dev br0 parent 1:0 protocol ip prio 1 u32 match ip dport 53 0xffff flowid 1:20
tc filter add dev br0 parent 1:0 protocol ip prio 1 u32 match ip sport 443 0xffff flowid 1:20
tc filter add dev br0 parent 1:0 protocol ip prio 1 u32 match ip dport 443 0xffff flowid 1:20
tc filter add dev br0 parent 1:0 protocol ip prio 1 u32 match ip sport 5060 0xffff flowid 1:20
tc filter add dev br0 parent 1:0 protocol ip prio 1 u32 match ip protocol 1 0xff flowid 1:20
#MEDIUM http/ftpdata/udp
tc filter add dev br0 parent 1:0 protocol ip prio 2 u32 match ip sport 80 0xffff flowid 1:21
tc filter add dev br0 parent 1:0 protocol ip prio 2 u32 match ip dport 80 0xffff flowid 1:21
tc filter add dev br0 parent 1:0 protocol ip prio 2 u32 match ip sport 20 0xffff flowid 1:21
tc filter add dev br0 parent 1:0 protocol ip prio 2 u32 match ip protocol 17 0xff flowid 1:21
#LOW smtp/pop and others
tc filter add dev br0 parent 1:0 protocol ip prio 3 u32 match ip sport 110 0xffff flowid 1:22
tc filter add dev br0 parent 1:0 protocol ip prio 3 u32 match ip sport 25 0xffff flowid 1:22
fi
#local connections
tc filter add dev br0 parent 1:0 protocol ip prio 0 u32 match ip src $LAN_IP_ADDR flowid 1:3
#---------------------------------------------OUTGOING--------------------------------------------------------------
#all output traffic for ppp0
$LOG "All outgoing ppp rate: normal $BANDWIDTHUP_LIMIT , maximum $BANDWIDTHUP (kbit/s)"
tc qdisc add dev $OUTIFACE root handle 1: htb default 24
tc class add dev $OUTIFACE parent 1: classid 1:1 htb rate ${BANDWIDTHUP}kbit quantum 1500 burst 50k
tc class add dev $OUTIFACE parent 1:1 classid 1:23 htb rate ${BANDWIDTHUP_LIMIT}kbit \
ceil ${BANDWIDTHUP}kbit prio 0 quantum 1500
tc class add dev $OUTIFACE parent 1:1 classid 1:24 htb rate ${BANDWIDTHUP_LIMIT}kbit \
ceil ${BANDWIDTHUP}kbit prio 1 quantum 1500
tc qdisc add dev $OUTIFACE parent 1:23 handle 23: sfq perturb 10 quantum 1500
tc qdisc add dev $OUTIFACE parent 1:24 handle 24: sfq perturb 10 quantum 1500
tc filter add dev $OUTIFACE parent 1:0 prio 0 protocol ip handle 23 fw flowid 1:23
tc filter add dev $OUTIFACE parent 1:0 prio 1 protocol ip handle 24 fw flowid 1:24
$LOG "Shaper start OK..."
}
stop() {
$LOG "Stop shaper..."
tc qdisc del dev br0 root > /dev/null 2>&1
tc qdisc del dev $OUTIFACE root > /dev/null 2>&1
tc qdisc del dev $OUTIFACE ingress > /dev/null 2>&1
rmmod sch_esfq > /dev/null 2>&1
rmmod sch_sfq > /dev/null 2>&1
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 1
esac
добавляю строчку
tc filter add dev br0 parent 1:0 prio 2 protocol ip handle 6 fw flowid 1:3
вот сюда
if [ "$SHAPER_IN_ENABLE" = "on" ]; then
#filters for marked in prerouting
tc filter add dev br0 parent 1:0 prio 2 protocol ip handle 6 fw flowid 1:3
tc filter add dev br0 parent 1:0 prio 1 protocol ip handle 20 fw flowid 1:20
tc filter add dev br0 parent 1:0 prio 2 protocol ip handle 21 fw flowid 1:21
tc filter add dev br0 parent 1:0 prio 3 protocol ip handle 22 fw flowid 1:22
и shaper перестает ограничивать скорость по параметрам указанным в веб закладке Simple shaper config внутресетевой трафик так и надо ,а внешний нет плиз подскажите