Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: Debian,Slackware,FreeBSD,CentOS,Red Hat,Windows Server 2008
Posts: 133
Rep:
Traffic shaping with htb
Hi,
I'm implementing a script to do traffic shaping and here are my rules:
tc qdisc add dev eth0 root handle 1:0 htb
tc class add dev eth0 parent 1:0 classid 1:1 htb rate 2kbit ceil 2kbit
tc class add dev eth0 parent 1:0 classid 1:2 htb rate 500kbit ceil 500kbit
tc qdisc add dev eth0 parent 1:1 sfq perturb 10
tc qdisc add dev eth0 parent 1:2 sfq perturb 10
tc filter add dev eth0 parent 1:0 protocol ip prio 1 handle 256 fw flowid 1:1
tc filter add dev eth0 parent 1:0 protocol ip prio 1 handle 1536 fw flowid 1:2
and for the purpose of testing, I did some testing rules on iptables as follows:
iptables -t mangle -N internet_256
iptables -A PREROUTING -t mangle -m mac --mac-source XX-XX-XX-XX-XX-XX -j internet_256
iptables -t mangle -A internet_256 -j MARK --set-mark 256
iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
Like when a client has the above mac address it'll be redirected to the internet_256 rules and then will be marked with 256. I'm not sure why its not working properly. Any advise?
On the iptables MARK, try using hexadecimal - so --set-mark 0x100 (for 256 in tc) and give that a try. I seem to remember having is problem in the past and just checking my scripts source, this is how I resolved the issue.
On the iptables MARK, try using hexadecimal - so --set-mark 0x100 (for 256 in tc) and give that a try. I seem to remember having is problem in the past and just checking my scripts source, this is how I resolved the issue.
Distribution: Debian,Slackware,FreeBSD,CentOS,Red Hat,Windows Server 2008
Posts: 133
Original Poster
Rep:
Thank you, but it didn't work.
This should work in case I add the following line:
iptables -t mangle -A PREROUTING -j MARK --set-mark 0x100
Which is not what I want, I only want certian mac address to be included into this, if I do the following:
iptables -t mangle -A PREROUTING -m mac --mac-source XX:XX:XX:XX -j MARK --set-mark 0x100
Also I doesn't work.
From searching around I found that you have something like the following:
tc filter add dev eth0 parent 1:0 protocol ip prio 1 u32 match u16 0x0800 0xffff at -2 match u16 0x4E83 0xffff at -4 match u32 0x0800271C 0xffffffff at -8 flowid 1:1
but also didn't work. I'm not sure what I'm missing,
Any ideas? any suggestions?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.