Trickle - Simple Traffic Shaping
Trickle is a super-easy bandwidth limiter. It runs in userspace, so it's easy to install and does not require any extra kernel modules or firewall tweaks.
Ubuntu has trickle available via Apt or Aptitude:
apt-get install trickle
To use trickle simply put it before any network command that you want to run. You specify upstream bandwith with -u and downstream with -d:
trickle -u 10 -d 50 your_command
I use Trickle mostly with rsync or scp. For example, say want to copy a large file and your maximum upstream bandwidth is 150 KB/s and you want to use only 75 KB/s for your copy operation:
trickle -u 75 scp my_big_file.iso host.example.com:.
Newer versions of Rsync already have a "--bwlimit" option, so you may not need to use Trickle. To use trickle with rsync you will need to use the -e option in rsync:
rsync -a -e "trickle -u 75 ssh" my_directory firstname.lastname@example.org:/home/user/backups/.