Welcome to Catalin(ux) M. BOIE's page!
Here you can find some work of mine on Linux kernel & other stuff.

E-mail: catab # embedromix dot ro
Phone: +40-745-048374
RSS feed for this site
IPv6 Ready
My Fedora repository: rpm -Uhv http://kernel.embedromix.ro/dinorepo-0.0.9-1.noarch.rpm
For comercial support and customizations, contact us at: Embedromix

[Home]  [Networking]  [Crypto]  [Linux kernel patches]  [Userspace]  [Docs]  [CV/Resume]  [Links

Name Description Links
IFB A mini howto on how to shape on incoming packets and distribute packets on multiple interfaces, sharing bandwidth. ifb.html
RAID mini HOWTO A mini howto describing linear, 0, 1, 5 and 6, using mdadm. RAID.html
git mini HOWTO A mini howto describing how to use git. git.html
LVM mini HOWTO A mini howto describing how to use LVM. LVM.html
IPv6 mini howtos Some mini howtos to easy IPv6 implementation. ipv6.html
Random stuff Some usefull one-liners. random.html

Description: How to shape packets using IFB and sharing bandwidth between
	multiple interfaces, with lot's of comments.
Author: Catalin(ux) M. BOIE 
Date: 2014-10-15
Web: http://kernel.embedromix.ro/
Version: 0.1


Let's assume the following:

- You have a router (router1) that has some pppoe connections and eth0
	to internet.
- You want to use HTB to limit traffic towards this pppoe interfaces,
	sharing the bandwidth between them.
- Let's assume 2.2.2.0/24 on pppoe interfaces.

Please note:
- From pppoe devices to outside, you use normal egress limiting support.


How to do it:

# We preapre ifb0, this is where shaping of packets from eth0 to pppoeX will
# take place.
tc qdisc del dev ifb0 root
tc qdisc add dev ifb0 root handle 1: htb default 2000
tc class add dev ifb0 parent 1: classid 1:1 htb rate 800kbit

# this is for 2.2.2.1
tc class add dev ifb0 parent 1:1 classid 1:21 htb rate 30kbit
# this is for 2.2.2.2
tc class add dev ifb0 parent 1:1 classid 1:22 htb rate 30kbit
# and so on

# default
tc class add dev ifb0 parent 1:1 classid 1:2000 htb rate 100kbit

# Now, come filters
tc filter add dev ifb0 parent 1: protocol ip prio 1 u32 \
	match ip dst 2.2.2.1/32 flowid 1:21
tc filter add dev ifb0 parent 1: protocol ip prio 1 u32 \
	match ip dst 2.2.2.2/32 flowid 1:22
# and so on
# VERY IMPORTANT TO UNDERSTAND ifb: packets will go back to interface
# they come from, here eth0.


# Add on ingress a redirect to ifb0
tc qdisc del dev eth0
tc qdisc del dev eth0 ingress
tc qdisc add dev eth0 ingress
# Please ignore "flow 1:10", it doesn't count.
tc filter add dev eth0 parent ffff: protocol ip prio 1 u32 \
	match ip dst 2.2.2.0/24 flowid 1:10 \
	action mirred egress redirect dev ifb0