I always had an interrest in network traffic shaping, but since Apple released IOS5 my interrest intensified. Althought I didn't understand it at first, the 'issue' is fotostream.
Whenever me or my wife came home from an event where we took pictures with our iPhones, our home internet became really slow. At first we didn't see this pattern, but after a while it became clear.
tcpdump showed that our phones were very active pushing data to the internet for quite a while. Fotostream.
Having a router that routes traffic between the internet and all my PC's, phones, etc allows to do great traffic shaping by using the HTB qdisc in both directions. However if your router is a PC itself, it's impossible to use HTB to do traffic shaping on it's own inbound network traffic. I came up with a funny solution: use Virtual Ethernet devices to introduce an additional bridge. Assume your PC's current network config consists of a singe NIC, like this:
eth0 your physical NIC with IP 192.168.1.1 and LAN your Ethernet network. Now consider changing this to:
veth1 a pair of Virtual Ethernet devices, and
br0 a bridge with
eth0 it's ports. Now we have the same logical Ethernet structure in terms of functionality, but with a veth0 and an veth1 device with which we can do HTB based traffic shaping:
veth0outbound traffic can be shaped using HTB
veth1outbound traffic can als be shaped using HTB, but this is actually your servers inbound traffic!!!
The commands to make this alle happen:
ip link add name veth0 type veth peer name veth1 brctl addbr br0 brctl addif br0 eth0 brctl addif br0 veth1 ifconfig br0 up ifconfig eth0 up ifconfig veth1 up ifconfig veth0 192.168.1.1