Dear all,
I am trying to write a QoS script that sends to a low priority class all
inbound traffic (from the internet) that is addressed to a device in my
home network with IP address 192.168.1.22. The rest of the traffic
should go a default high priority class.
The script I am using is not working, and would like to ask if anyone
could give me a hint. What I am observing is that no packets are
transmitted by the ifb device, so I suspect that it is the filters that
are failing. My box is also doing NAT, so a possible reason could be
that I am trying to classify the packets using the internal address
before the NAT overwrites the destination address to my LAN's private
address, but I am not sure.
As I said, any help is greatly appreciated.
Best Regards
Daniel
This is the script I am using:
#!/bin/bash
# Variable definition
ETH=eth1
IFB=ifb1
IP_LP="192.168.1.22/32"
DL_RATE="900kbit" # My real downstream is 1Mbps
HP_RATE="890kbit"
LP_RATE="10kbit"
TC="tc"
IPTABLES="iptables"
# Loading the required modules
insmod ifb
insmod sch_htb
insmod sch_ingress
insmod ipt_IMQ
insmod cls_fw
# Bringing up the $IFB interface
ifconfig $IFB up
# Adding the HTB scheduler to the ingress interface
$TC qdisc add dev $IFB root handle 1: htb default 11
# add main rate limit classes
$TC class add dev $IFB parent 1: classid 1:1 htb rate $DL_RATE
# add leaf classes: set the maximum bandwidth that each priority class
can get, and the maximum borrowing they can do
$TC class add dev $IFB parent 1:1 classid 1:10 htb rate $LP_RATE ceil
$DL_RATE
$TC class add dev $IFB parent 1:1 classid 1:11 htb rate $HP_RATE ceil
$DL_RATE
# filter traffic into classes by fwmark
$TC filter add dev $IFB parent 1:0 prio 0 protocol ip handle 10 fw
flowid 1:10 # packets with MARK 10 go to classid 1:10
$TC filter add dev $IFB parent 1:0 prio 0 protocol ip handle 11 fw
flowid 1:11 # packets with MARK 11 go to classid 1:11
# add MYSHAPER-IN chain to the mangle table in iptables
$IPTABLES -t mangle -N MYSHAPER-IN # create a user
defined chain in the mangle table
$IPTABLES -t mangle -I PREROUTING -i $ETH -j MYSHAPER-IN # insert a
rule in the PREROUTING chain to jump to our chain
# add fwmark entries to classify different types of traffic - Set fwmark
according to the priority.
$IPTABLES -t mangle -A MYSHAPER-IN -d $IP_LP -j MARK --set-mark
10 # rule to mark packets addressed to the low prio host
$IPTABLES -t mangle -A MYSHAPER-IN -m mark --mark 0 -j MARK --set-mark
11 # rule to mark any unmarked packets as high prio
# finally, instruct these packets to go through the $IFB device we set
up above
$IPTABLES -t mangle -A MYSHAPER-IN -j IMQ
_______________________________________________
openwrt-users mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-users