Здравеите, опитвам се да направа разпределение на трафика. Имам машина която прави NAT със два интерфейса eth0 - локална мрежа и eth1 - интернет. Написал съм един скрипт но незнам къде е проблема. Ето го и него.
----------------------------------------------------------
#!/bin/sh
DEV=eth0
RATEDN=512
RATEUP=128
if [ "$1" = "status" ]
then
echo "[qdisc]"
tc -s qdisc show dev $DEV
echo "[class]"
tc -s class show dev $DEV
echo "[filter]"
tc -s filter show dev $DEV
exit
fi
tc qdisc del dev $DEV root 2>/dev/null 1>/dev/null
tc qdisc del dev $DEV ingress 2>/dev/null 1>/dev/null
iptables -t mangle -X PREROUTING 2>/dev/null 1>/dev/null
if [ "$1" == "stop" ]; then
exit
fi
tc qdisc add dev $DEV root handle 1: htb default 24
tc class add dev $DEV parent 1: classid 1:1 htb rate 9Mbit
tc class add dev $DEV parent 1: classid 1:20 htb rate $[$RATEDN/4]kbit ceil ${RATEDN}kbit prio 0
tc class add dev $DEV parent 1: classid 1:21 htb rate $[$RATEDN/4]kbit ceil ${RATEDN}kbit prio 0
tc class add dev $DEV parent 1: classid 1:22 htb rate $[$RATEDN/4]kbit ceil ${RATEDN}kbit prio 0
tc class add dev $DEV parent 1: classid 1:23 htb rate $[$RATEDN/4]kbit ceil ${RATEDN}kbit prio 0
tc class add dev $DEV parent 1: classid 1:24 htb rate $[$RATEDN/40]kbit ceil ${RATEDN}kbit prio 1
tc class add dev $DEV parent 1: classid 1:25 htb rate 8Mbit ceil 9Mbit prio 0
tc qdisc add dev $DEV parent 1:20 handle 20: sfq perturb 10
tc qdisc add dev $DEV parent 1:21 handle 21: sfq perturb 10
tc qdisc add dev $DEV parent 1:22 handle 22: sfq perturb 10
tc qdisc add dev $DEV parent 1:23 handle 23: sfq perturb 10
tc qdisc add dev $DEV parent 1:24 handle 24: sfq perturb 10
tc qdisc add dev $DEV parent 1:25 handle 25: sfq perturb 10
tc filter add dev $DEV parent 1
protocol ip prio 1 handle 1 fw classid 1:20
tc filter add dev $DEV parent 1
protocol ip prio 1 handle 2 fw classid 1:21
tc filter add dev $DEV parent 1
protocol ip prio 1 handle 3 fw classid 1:22
tc filter add dev $DEV parent 1
protocol ip prio 1 handle 4 fw classid 1:23
tc filter add dev $DEV parent 1
protocol ip prio 1 handle 5 fw classid 1:24
tc filter add dev $DEV parent 1
protocol ip prio 1 handle 6 fw classid 1:25
iptables -t mangle -A PREROUTING -s 192.168.0.3 -d ! 192.168.0.0/24 -j MARK --set-mark 0x1
iptables -t mangle -A PREROUTING -s 192.168.0.5 -d ! 192.168.0.0/24 -j MARK --set-mark 0x2
iptables -t mangle -A PREROUTING -s 192.168.0.6 -d ! 192.168.0.0/24 -j MARK --set-mark 0x3
iptables -t mangle -A PREROUTING -s 192.168.0.9 -d ! 192.168.0.0/24 -j MARK --set-mark 0x4
iptables -t mangle -A PREROUTING -s 192.168.0.0/24 -d 192.168.0.0/24 -j MARK --set-mark 0x6
----------------------------------------------------------
Ще съм много благодарен, някои да помогне.
'>