Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 10-11-2005, 06:21 PM   #1
Registered: Apr 2004
Distribution: Debian
Posts: 143

Rep: Reputation: 15
Question tc qdisc and multiple external IPs

Hello, there. I created a (mildly sloppy) prioritization script some time ago that looks somewhat like this:


export PORT=$1
export PROTOCOL=$2
export TYPE=$3
export PRIORITY=$4
export MESSAGE=$5
case "$PRIORITY" in

if [ "$TYPE" = "src" -o "$TYPE" = "both" ]; then
    $IPTABLES -t mangle -A POSTROUTING -p $PROTOCOL --sport $PORT -j CLASSIFY --set-class $PRIORITY
if [ "$TYPE" = "dst" -o "$TYPE" = "both" ]; then
    $IPTABLES -t mangle -A POSTROUTING -p $PROTOCOL --dport $PORT -j CLASSIFY --set-class $PRIORITY


tc qdisc add dev $EXT_IFC root handle 1: prio
tc qdisc add dev $EXT_IFC parent 1:1 handle 10: sfq
tc qdisc add dev $EXT_IFC parent 1:2 handle 20: sfq
tc qdisc add dev $EXT_IFC parent 1:3 handle 30: tbf rate 650kbit burst 2048 latency 50ms

prioritize 1:65535 tcp both low
prioritize 1:65535 udp both low
$IPTABLES -t mangle -A POSTROUTING -p tcp --tcp-flags ALL ACK -m state --state ESTABLISHED -m length --length 40:100 -j CLASSIFY --set-class 1:1
prioritize 22000 tcp src high
prioritize 80 tcp both normal
prioritize 6112 udp both normal
prioritize 4000 tcp both normal
It's not the most elegant thing ever created but it has successfully prioritized traffic on my network for more than a year.

However, we have recently obtained a total of seven external static IP addresses and I am now trying to accomplish some more complex routing. The complicating element is the fact that my external interface (eth0) now has an additional six incarnations (eth0:0, eth0:1, ..., eth0:5) to accomodate the new IP addresses. As a result, the tc qdisc lines show above aren't sufficient; they only shape eth0's traffic and not the traffic on the other interfaces.

Creating a new set of qdiscs for the other interfaces doesn't seem to be a good approach either. Our connection is a 1.5Mb/768Kb cable line; hence, handle "30:" above is capped at 650Kbit. This is designed to prevent non-interactive connections (FTP transfers, BitTorrent clients, Windows Update, etc.) from consuming the entire upstream and killing any chance we have of sending ACK packets or sending data for more interactive tasks (web browsing, SSH, Diablo II, etc.). For this reason, I would like to be able to shape all of the traffic leaving on any of these interfaces (eth0, eth0:0, ..., eth0:5) using the same set of qdiscs.

So, the question is: how do I do this? Any references to documents or whatnot which may help me in solving this problem would be appreciated.

Old 10-12-2005, 03:57 PM   #2
Registered: Apr 2004
Distribution: Debian
Posts: 143

Original Poster
Rep: Reputation: 15
Perhaps I should confirm one of my assumptions. I am under the impression that the new interfaces (eth0:0, eth0:1, ..., eth0:5) are truly being treated as distinct. Am I correct in my assumption that I can't just add qdiscs to eth0 and have it pool for me? I just checked tc on my machine:
*******@*******:/etc/rc.d# tc qdisc
qdisc prio 1: dev eth0 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
qdisc sfq 10: dev eth0 parent 1:1 limit 128p quantum 1514b
qdisc sfq 20: dev eth0 parent 1:2 limit 128p quantum 1514b
qdisc tbf 30: dev eth0 parent 1:3 rate 650Kbit burst 2Kb lat 48.8ms
qdisc pfifo_fast 0: dev eth1 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
This output would suggest to me that I can simply use the script I posted (since there aren't entries for "dev eth0:0" or any of the like). Is this true?
Old 10-12-2005, 07:49 PM   #3
Registered: Apr 2004
Distribution: Debian
Posts: 143

Original Poster
Rep: Reputation: 15
My question seems to have been answered here:

In short, the answer to the question I posed in my second post is "yes."


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple External IPs with iptables tvynr Linux - Networking 11 11-08-2005 02:31 PM
Question about iptables and multiple external IPs tvynr Linux - Networking 2 10-12-2005 07:48 PM
ADSL and multiple external static IPs adasko Linux - Networking 3 09-15-2005 07:01 PM
dhcp and multiple external IPs inc0gs Linux - Networking 4 06-15-2005 02:27 PM
how to define a specific range of IPs and/or multiple IPs in an iptables rule?... TheHellsMaster Linux - Security 9 09-20-2004 10:06 AM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 09:14 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration