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.
Hi,
I am new to HTB and in the learning process I want to simulate a slower link on my server to see how qdisc works.
I have a 100Mbit connection.
I want to simulate a 100K connection and to divide traffic between FTP and SMB. (like in HTB user guide).
The problem is that it doesn’t work. I can transfer files with FTP of SAMBA at the wire speed. (Just like when there was no HTB and qdisc). What do I do wrong?
Here is my script:
Code:
#!/bin/bash
tc qdisc del dev eth0 root
iptables -F
iptables -F -t mangle
# qdisc for delay simulation
tc qdisc add dev eth0 root handle 100: htb
tc class add dev eth0 parent 100: classid 100:1 htb rate 100kbps
tc qdisc add dev eth0 parent 100:1 handle 1: htb
tc class add dev eth0 parent 1: classid 1:1 htb rate 100kbps
tc class add dev eth0 parent 1:1 classid 1:10 htb rate 50kbps ceil 100kbps prio 1
tc class add dev eth0 parent 1:1 classid 1:20 htb rate 50kbps ceil 100kbps prio 2
tc qdisc add dev eth0 parent 1:10 handle 22: sfq perturb 10
tc qdisc add dev eth0 parent 1:20 handle 23: sfq perturb 10
I've tried with u32 and with fw filter
Code:
tc filter add dev eth0 parent 1: protocol ip u32 match ip sport 20 0xffff flowid 1:10
tc filter add dev eth0 parent 1: protocol ip u32 match ip sport 139 0xffff flowid 1:20
OR
Code:
iptables -A OUTPUT -o eth0 -t mangle -p tcp --sport 20 -j MARK --set-mark 22
tc filter add dev eth0 parent 1: protocol ip handle 22 fw classid 1:10
iptables -A OUTPUT -o eth0 -t mangle -p tcp --sport 139 -j MARK --set-mark 33
tc filter add dev eth0 parent 1: protocol ip handle 33 fw classid 1:20
if won't work with YOU---LAN setup if you are only working with one interface.
You say it doesn't work if I have 1 NIC? That's not true. Every outbound packet can be shaped. If I have just 2 computers with a crossover cable attached with each other I can shape the outgoing packets. I can shape packets on OUTGOUING and PREROUTING chain of netfilter/iptables.
My problem is that it doesn't work with 2 qdisc (as in HTB User guide - page 6 of 8)
Something like this:
Quote:
# qdisc for delay simulation
tc qdisc add dev eth0 root handle 100: htb
tc class add dev eth0 parent 100: classid 100:1 htb rate 100kbps
uh well i can't figure it out or i'm interpreting the docs in a different way. anyway, i've seen your post in lartc mailing list (and that's the best place where to raise issues like this.
good luck.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.