Hi folks. Let''s say I would like to make some bandwidth control on my network using HTB. I have 2 clients: PC1: 192.168.100.2 PC2: 192.168.100.3 Server: 192.168.100.1 This has 2 NIC''s eth1 is local and eth2 is connected to the internet. It could be nice to have a script, where you could specify, how much bandwidth you want for a specific host on a network, like, PC1 has 10/100 MBit network, but only has 256/128, when surfing the net. PC2 has the same network ofc, but 768/384 when surfing/downloading assuming the shared connection is 1024/512. I am currently running wondershaper1.1a which works prefectly, but i wish, it could be more specific. Could also be nice, if it would be someway possible to check on the clients IP or MAC address to verify, if it''s "really them". Like it''s only PC1 and PC2 who have access to the server in the 192.168.*.* segment. Hope i make myself clear. My server runs redhat 9 in cmd mode/no GUI. Iptables installed script, as firewall. I think a script as i described, could be very complex to write, therefore i ask, whoever is here, for help. Thank you all in advance. Regards Rune Johannesen Denmark _______________________________________________ LARTC mailing list / LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
Dnia poniedziałek 06 wrzesień 2004 23:56, Cow napisał:> Hi folks. > > Let''s say I would like to make some bandwidth control on my network > using HTB. I have 2 clients:[...]> I think a script as i described, could be very complex to write, > therefore i ask, whoever is here, for help. > Thank you all in advance.Hello all, my first post here, maybe even I will help someone;) I assume that you want somethink like: data from server to LAN (PC1,PC2) unshaped (full 100mbit) data from Internet to LAN shaped Then all you need to do is make classes with source 192.168.0.1 and destination 192.168.0.2(3) and 100mbit rate and then make classes with destination 192.168.0.2(3) with download rate. I believe that you understand what I am thinkig of. Or you can use iptables and mark traffic going from server to LAN, and other mark for traffic in FORWARD chain. (iptables -t mangle -A FORWARD -j MARK --set-mark SOME_MARK) When using iptables you will be able to shape upload speed, just mark traffic in forward going from PC1/2 with output interface eth2 (-o eth2) - it will be hosts upload. I won''t write you full script, make it yourself, visit LARTC and firstly try "htb.init" for simple class creation. Good fun! -- .: Jakub Głazik (zytek) .: email:zytek@ostrow-wlkp.net .: JID:zytek@azazel.ostrow-wlkp.net .: http://www.misiaj.sie.pl [obsolete] _______________________________________________ LARTC mailing list / LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
I''ve tryed to make a script, some of you, who thinks it looks ok? DEV=eth2 DOWNLINK=1024 UPLINK=512 DOWN1=768 UP1=384 DOWN2=256 UP2=128 tc qdisc add dev $DEV root handle 1: htb default 20 tc class add dev $DEV parent 1: classid 1:1 htb rate ${UPLINK}kbit burst 6k tc class add dev $DEV parent 1:1 classid 1:10 htb rate ${UPLINK}kbit \ burst 6k prio 1 tc class add dev $DEV parent 1:1 classid 1:20 htb rate ${UP1}kbit \ burst 6k prio 2 tc class add dev $DEV parent 1:1 classid 1:30 htb rate ${UP2}kbit \ burst 6k prio 2 tc qdisc add dev $DEV parent 1:10 handle 10: sfq perturb 10 tc qdisc add dev $DEV parent 1:20 handle 20: sfq perturb 10 tc qdisc add dev $DEV parent 1:30 handle 30: sfq perturb 10 tc filter add dev $DEV parent 1: protocol ip prio 16 u32 \ match ip src 192.168.0.2 flowid 1:20 tc filter add dev $DEV parent 1: protocol ip prio 16 u32 \ match ip src 192.168.0.3 flowid 1:30 Not tested yet... If it works, feel free to letting me know, how to make something like this, just for download rate. If it doesn''t work, please let me know, what you think is wrong. - Rune Johannesen _______________________________________________ LARTC mailing list / LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
> You might want to check out this script > http://www.geocities.com/jame_sj I just noticed a bug (that I need to > figure out...) in it but this should give a start..Looks nice, want to share the bug with me? :-)> > James >_______________________________________________ LARTC mailing list / LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
>by zytek >Hello all, my first post here, maybe even I will help someone;)>I assume that you want somethink like: >data from server to LAN (PC1,PC2) unshaped (full 100mbit) >data from Internet to LAN shapedCorrect.>Then all you need to do is make classes with source 192.168.0.1 and >destination 192.168.0.2(3) and 100mbit rate and then make classes with >destination 192.168.0.2(3) with download rate. I believe that youunderstand>what I am thinkig of.I do, but could you write an example please, so i have something to make it from? :-)>Or you can use iptables and mark traffic going from server to LAN, andother>mark for traffic in FORWARD chain. (iptables -t mangle -A FORWARD -jMARK>--set-mark SOME_MARK) >When using iptables you will be able to shape upload speed, just marktraffic>in forward going from PC1/2 with output interface eth2 (-o eth2) - itwill be>hosts upload.Again, an example would be nice.. i have no idea on how to use MARK command with iptables, even i know a great deal about iptables in general.>I won''t write you full script, make it yourself, visit LARTC andfirstly try>"htb.init" for simple class creation. Good fun!Fair enough, i wouldn''t exspect anyone to write a full script for me, but i would exspect someone to make me an example for instance, how i can shape PC1''s download/upload rate to 256/128 KBit, so i atleast have something to help me going. _______________________________________________ LARTC mailing list / LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
Am Tuesday 07 September 2004 23:18 schrieb Cow:> zytec: (?) > > I assume that you want somethink like: > > data from server to LAN (PC1,PC2) unshaped (full 100mbit) > > data from Internet to LAN shaped > > Correct.Not really an example, but you may have a look at my script [1]. It solves the 100Mbit LAN vs internet traffic by using a class setup which looks like [2], which reminds me that I did a modification to wondershaper once [3] that does the same. I think this modification was reported to work, however I haven''t tested it nor do I support it. Maybe it serves as an example... I''m using a fat HTB class which knows the true interface bandwidth (100MBit isn''t actually right, you should measure what rates you really get). Then there''s a child class for the internet traffic and one for the actual LAN traffic. If HTB works correctly, this way you get full speed for LAN-only transfers, without letting them interfere with the internet traffic. The script [1] is the one I''m (more or less) actively working on; it doesn''t support custom rates per user yet, but that''s something that''ll be added for sure in one of the next releases. HTH Andreas [1] http://www.metamorpher.de/fairnat/ [2] http://www.metamorpher.de/files/wshaper-over-lan.png [3] http://www.metamorpher.de/files/wshaper-over-lan.htb _______________________________________________ LARTC mailing list / LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/