Skip to contentSkip to conversation

Help with prioritizing internet Cafe Terminals

LARTC Craig Main 3 participants 5 messages Nov 17, 2004 – Nov 20, 2004

lore
Share & tools
lore

Craig Main

author
#0 lore raw

Hi All,

I am new to tc so please forgive me. I have read as much documentation as I can get my hands on, but I still have problems with getting the rules right. Here is my scenario:

Internet Cafe/Office

4 Internet Cafe Terminals
3 Office Terminals

Leased Line connectivity at 64Kbps.

What I would like to have:

All Cafe terminals have priority to the internet over the office machines. Each cafe terminal must not be able to have all the bandwidth if other cafe terminals are online. If all cafe terminals are online at once, the bandwidth must be shared evenly amongst them. All Office Terminals must have the lease priority.

I hope this makes sense.

I anyone in a position to help me here?

TIA

Craig
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

#1 lore raw
Quoted 9 lines · Craig Main

All Cafe terminals have priority to the internet over the office machines. Each cafe terminal must not be able to have all the bandwidth if other cafe terminals are online. If all cafe terminals are online at once, the bandwidth must be shared evenly amongst them. All Office Terminals must have the lease priority.

I hope this makes sense.

I anyone in a position to help me here?

My Fair NAT script [1] comes very close to that. It can share available bandwidth evenly among your machines; however, it can't give your cafe a higher priority than your office. A workaround for that might be to put all office machines together in a group, so all of them together would get the same priority and bandwidth as a single cafe terminal.

If the script isn't suitable for your network, it may serve as an example. At least the documentation or the class graphics should give you some idea how to create your own shaping setup.

HTH
Andreas

[1] http://www.metamorpher.de/fairnat/
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

author
#2 lore raw
In reply to Craig Main

I have out together the following script, can those in the know please comment on what I have done and whether it will achieve what I am looking for. Many thanks.

#!/bin/bash

tc qdisc del dev eth1 root

tc qdisc add dev eth1 root handle 1: htb default 12

tc class add dev eth1 parent 1: classid 1:1 htb rate 64kbit ceil 64kbit burst 20k

tc class add dev eth1 parent 1: classid 1:2 htb rate 15kbit ceil 64kbit prio 0 burst 20k
tc class add dev eth1 parent 1: classid 1:3 htb rate 15kbit ceil 64kbit prio 0 burst 20k
tc class add dev eth1 parent 1: classid 1:4 htb rate 15kbit ceil 64kbit prio 0 burst 20k
tc class add dev eth1 parent 1: classid 1:5 htb rate 15kbit ceil 64kbit prio 0 burst 20k

tc class add dev eth1 parent 1: classid 1:12 htb rate 4kbit ceil 64kbit prio 1

tc filter add dev eth1 protocol ip parent 1: prio 1 handle 1 fw classid 1:2 tc filter add dev eth1 protocol ip parent 1: prio 1 handle 2 fw classid 1:3 tc filter add dev eth1 protocol ip parent 1: prio 1 handle 3 fw classid 1:4 tc filter add dev eth1 protocol ip parent 1: prio 1 handle 4 fw classid 1:5

iptables -F PREROUTING -t mangle

iptables -A PREROUTING -t mangle -i eth0 -p tcp -s 192.168.0.1 -j MARK --set-mark 1
iptables -A PREROUTING -t mangle -i eth0 -p tcp -s 192.168.0.2 -j MARK --set-mark 1
iptables -A PREROUTING -t mangle -i eth0 -p tcp -s 192.168.0.3 -j MARK --set-mark 1
iptables -A PREROUTING -t mangle -i eth0 -p tcp -s 192.168.0.4 -j MARK --set-mark 1
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

#3 lore raw
In reply to Craig Main
Quoted 5 lines · Craig Main

I have out together the following script, can those in the know please comment on what I have done and whether it will achieve what I am looking for. Many thanks.

<snip>

Quoted 6 lines

iptables -F PREROUTING -t mangle

iptables -A PREROUTING -t mangle -i eth0 -p tcp -s 192.168.0.1 -j MARK --set-mark 1
iptables -A PREROUTING -t mangle -i eth0 -p tcp -s 192.168.0.2 -j MARK --set-mark 1

You are giving all your addresses the same MARK? I don't think that's what you want.

Quoted 4 lines

iptables -A PREROUTING -t mangle -i eth0 -p tcp -s 192.168.0.3 -j MARK --set-mark 1
iptables -A PREROUTING -t mangle -i eth0 -p tcp -s 192.168.0.4 -j MARK --set-mark 1

Signature · 8 lines
Jason Boxman
Perl Programmer / *NIX Systems Administrator
Shimberg Center for Affordable Housing | University of Florida
http://edseek.com/ - Linux and FOSS stuff

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
author
#4 lore raw
In reply to Craig Main

That was a typo on my part...I am more interested in the actual tc commands and setups. Will they do what I want?

Thanks
C

Quoted 24 lines · Jason Boxman
Quoted 5 lines · Craig Main

I have out together the following script, can those in the know please comment on what I have done and whether it will achieve what I am looking for. Many thanks.

<snip>

Quoted 6 lines

iptables -F PREROUTING -t mangle

iptables -A PREROUTING -t mangle -i eth0 -p tcp -s 192.168.0.1 -j MARK --set-mark 1
iptables -A PREROUTING -t mangle -i eth0 -p tcp -s 192.168.0.2 -j MARK --set-mark 1

You are giving all your addresses the same MARK? I don't think that's what you want.

Quoted 4 lines

iptables -A PREROUTING -t mangle -i eth0 -p tcp -s 192.168.0.3 -j MARK --set-mark 1
iptables -A PREROUTING -t mangle -i eth0 -p tcp -s 192.168.0.4 -j MARK --set-mark 1

--

Quoted 9 lines

Jason Boxman
Perl Programmer / *NIX Systems Administrator Shimberg Center for Affordable Housing | University of Florida
http://edseek.com/ - Linux and FOSS stuff

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/