Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to be able to set up two xen guests like this:

xen-create-image --size=10Gb --swap=512Mb --ip= --force --memory=256Mb --arch=i386 --debootstrap


xen-create-image --size=10Gb --swap=512Mb --ip= --force --memory=256Mb --arch=i386 --debootstrap

(the difference is the ips '' and '') I want to set it up so that '' has dial-up speed and '' has unshaped connection speed to I don't know anything about traffic shaping, or what i need to install to do this. So i guess when you answer be ultra noobie-concerned.

    #! /bin/bash

# reinit
tc qdisc del dev $NETCARD root handle 1
tc qdisc add dev $NETCARD root handle 1: htb default 9999

# create the default class
tc class add dev $NETCARD parent 1:0 classid 1:9999 htb rate $(( $MAXBANDWIDTH ))kbit ceil $(( $MAXBANDWIDTH ))kbit burst 5k prio 9999

# control bandwidth per IP
declare -A ipctrl
# define list of IP and bandwidth (in kilo bits per seconds) below

for ip in "${!ipctrl[@]}"
    mark=$(( mark + 1 ))

    # traffic shaping rule
    tc class add dev $NETCARD parent 1:0 classid 1:$mark htb rate $(( $bandwidth ))kbit ceil $(( $bandwidth ))kbit burst 5k prio $mark

    # netfilter packet marking rule
    iptables -t mangle -A INPUT -i $NETCARD -s $ip -j CONNMARK --set-mark $mark

    # filter that bind the two
    tc filter add dev $NETCARD parent 1:0 protocol ip prio $mark handle $mark fw flowid 1:$mark

    echo "IP $ip is attached to mark $mark and limited to $bandwidth kbps"

#propagate netfilter marks on connections
iptables -t mangle -A POSTROUTING -j CONNMARK --restore-mark

i did see this above, but i don't know what config file i need to edit.

So just to be clear. I want two ip's to access the same site, but one ip has dial-up speed and the other has untouched. Thanks so mcuh!

share|improve this question

I use my pfsense firewall for this..

ipfw and freebsd rocks for this type of thing over the Linux's

Hope you try this out :D

share|improve this answer
But this is not the question asked... – drumfire Feb 14 '13 at 22:47

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.