Skip to contentSkip to conversation

1 MBS per server Linux router

LARTC Trevor Warren 2 participants 5 messages Jun 25, 2003

lore
Share & tools
lore
#0 lore raw

Hello,

If you just wanna reduce the b/w pipe per server wrr could be a
simplistic implementation that would work.

For real functionality see htb which works like a charm. For something
more complex see cbq.

Trevor

Quoted 23 lines · Jean-Francois Levesque

Hello everyone!

I would like to do a linux router to limit the connection for some servers to 1 mbs per server.

[SERVERS] ---> [Linux "1MBS per server" router] ---> ((((Internet))))

I did some searches about routing and bandwidth on the net and the solution seems to be 'tc'. Well, 'tc' is not very easy to understand so I tried 'tcng'. I installed it and it seems to work fine (able to generate the 'tc' rules and tcsim is working).

Now, my question is what type of configuration do I need? I read some doc about tcng and I saw the "fifo", "tbf", "SLB"... I need a rate so it's not "fifo". How do I configure the others?

Thanks for your help!

Jean-Francois

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

Signature · 9 lines
( >-        LINUX, It's all about CHOICE      -< )
/~\    __        [email protected]       __   /~\
|  \) /  Pre Sales Consultant - Red Hat     \ (/ |
|_|_  \    9820349221(M) | 22881326(O)      / _|_|
       \___________________________________/

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

Hello Jean,

For all that i know your tcng config would be perfectly fine. I will
mail you my 4000 node config. Please try the same out and lemme know it if works for you.

Trevor

Quoted 71 lines · Jean-Francois Levesque

Hi!

I have done that script to test my router :

#include "fields.tc"
#include "ports.tc"

#define INTERFACE eth0
#define LIMITEDRATE 1kBps

dev INTERFACE {
    egress {
                                                                                                                                                            
        /* In class selection path, the filters come first!  DSmark */
                                                                                                                                                            
        class ( <$AB10CL> )    if ip_dst = 10.1.1.10 || ip_src = 
10.1.1.10;
        class ( <$AB11CL> )    if ip_dst = 10.1.1.11 || ip_src = 
10.1.1.11;
        class ( <$AB12CL> )    if ip_dst = 10.1.1.12 || ip_src = 
10.1.1.12;
        class ( <$other> )  if 1 ;
                                                                                                                                                            
        /* section in which we configure the qdiscs and classes */
                                                                                                                                                            
        htb () {
            class ( rate 10kBps, ceil 10kBps ) {
                $AB10CL   = class ( rate LIMITEDRATE, ceil LIMITEDRATE ) 

{ sfq; } ;
$AB11CL = class ( rate LIMITEDRATE, ceil LIMITEDRATE )
{ sfq; } ;
$AB12CL = class ( rate LIMITEDRATE, ceil LIMITEDRATE )

{ sfq; } ;
                $other    = class ( rate 1kBps, ceil 1kBps ) { sfq; } ;
            }
        }
    }
}

I have plugged my machine behind the router but I see no difference when I download :-(

What is wrong with that script?

If this is not working, I'll try wrr.

Thanks!

Jean-Francois

Quoted 11 lines · Trevor Warren

Hello,

If you just wanna reduce the b/w pipe per server wrr could be a simplistic implementation that would work.

For real functionality see htb which works like a charm. For something more complex see cbq.

Trevor

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

Signature · 9 lines
( >-        LINUX, It's all about CHOICE      -< )
/~\    __        [email protected]       __   /~\
|  \) /  Pre Sales Consultant - Red Hat     \ (/ |
|_|_  \    9820349221(M) | 22881326(O)      / _|_|
       \___________________________________/

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
#2 lore raw
In reply to Trevor Warren

Hello everyone!

I would like to do a linux router to limit the connection for some servers to 1 mbs per server.

[SERVERS] ---> [Linux "1MBS per server" router] ---> ((((Internet))))

I did some searches about routing and bandwidth on the net and the solution seems to be 'tc'. Well, 'tc' is not very easy to understand so I tried 'tcng'. I installed it and it seems to work fine (able to generate the 'tc' rules and tcsim is working).

Now, my question is what type of configuration do I need? I read some doc about tcng and I saw the "fifo", "tbf", "SLB"... I need a rate so it's not "fifo". How do I configure the others?

Thanks for your help!

Jean-Francois

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

#3 lore raw
In reply to Trevor Warren

Hi!

I have done that script to test my router :

#include "fields.tc"
#include "ports.tc"

#define INTERFACE eth0
#define LIMITEDRATE 1kBps

dev INTERFACE {
    egress {
                                                                                                                                                            
        /* In class selection path, the filters come first!  DSmark */
                                                                                                                                                            
        class ( <$AB10CL> )    if ip_dst = 10.1.1.10 || ip_src = 
10.1.1.10;
        class ( <$AB11CL> )    if ip_dst = 10.1.1.11 || ip_src = 
10.1.1.11;
        class ( <$AB12CL> )    if ip_dst = 10.1.1.12 || ip_src = 
10.1.1.12;
        class ( <$other> )  if 1 ;
                                                                                                                                                            
        /* section in which we configure the qdiscs and classes */
                                                                                                                                                            
        htb () {
            class ( rate 10kBps, ceil 10kBps ) {
                $AB10CL   = class ( rate LIMITEDRATE, ceil LIMITEDRATE ) 

{ sfq; } ;
$AB11CL = class ( rate LIMITEDRATE, ceil LIMITEDRATE )
{ sfq; } ;
$AB12CL = class ( rate LIMITEDRATE, ceil LIMITEDRATE )

{ sfq; } ;
                $other    = class ( rate 1kBps, ceil 1kBps ) { sfq; } ;
            }
        }
    }
}

I have plugged my machine behind the router but I see no difference when I download :-(

What is wrong with that script?

If this is not working, I'll try wrr.

Thanks!

Jean-Francois

Quoted 11 lines · Trevor Warren

Hello,

If you just wanna reduce the b/w pipe per server wrr could be a simplistic implementation that would work.

For real functionality see htb which works like a charm. For something more complex see cbq.

Trevor

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

#4 lore raw
In reply to Trevor Warren
Quoted 10 lines · Trevor Warren

Hello Jean,

For all that i know your tcng config would be perfectly fine. I will mail you my 4000 node config. Please try the same out and lemme know it if works for you.

Trevor

It's not working :-( Maybe because of my iptables rules :

[root@ROUTER-1MBS root]# iptables --list -nv
Chain INPUT (policy ACCEPT 51 packets, 3356 bytes)
pkts bytes target prot opt in out source
destination

    0     0 ACCEPT     all  --  lo     *       0.0.0.0/0            

0.0.0.0/0
31278 46M ACCEPT all -- eth0 * 0.0.0.0/0
0.0.0.0/0 state RELATED,ESTABLISHED
20169 1467K ACCEPT all -- eth1 * 0.0.0.0/0
0.0.0.0/0 state RELATED,ESTABLISHED

    0     0 ACCEPT     tcp  --  eth0   *       0.0.0.0/0            
0.0.0.0/0          tcp dpt:22
    2   120 ACCEPT     tcp  --  eth1   *       0.0.0.0/0            
0.0.0.0/0          tcp dpt:22
    0     0 DROP       tcp  --  eth1   *       0.0.0.0/0            
0.0.0.0/0
    0     0 DROP       udp  --  eth1   *       0.0.0.0/0            
0.0.0.0/0
    9   540 DROP       tcp  --  eth0   *       0.0.0.0/0            

0.0.0.0/0
726 93117 DROP udp -- eth0 * 0.0.0.0/0
0.0.0.0/0

Chain FORWARD (policy ACCEPT 15056 packets, 5691K bytes)
pkts bytes target prot opt in out source
destination
17956 1693K ACCEPT all -- eth1 * 0.0.0.0/0
0.0.0.0/0

Chain OUTPUT (policy ACCEPT 31785 packets, 2347K bytes)
pkts bytes target prot opt in out source
destination

    0     0 ACCEPT     all  --  *      lo      0.0.0.0/0            

0.0.0.0/0
[root@ROUTER-1MBS root]#

eth0 Link encap:Ethernet HWaddr 00:50:BA:87:42:8D

          inet addr:192.168.0.230  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:53801 errors:0 dropped:0 overruns:0 frame:0
          TX packets:35241 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:52861850 (50.4 Mb)  TX bytes:3140165 (2.9 Mb)
          Interrupt:9 Base address:0xb000

eth1 Link encap:Ethernet HWaddr 00:E0:18:FF:6F:F4

          inet addr:10.1.1.1  Bcast:10.1.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:38410 errors:0 dropped:0 overruns:0 frame:0
          TX packets:30721 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:3724993 (3.5 Mb)  TX bytes:7650950 (7.2 Mb)
          Interrupt:10 Base address:0xd000

eth0 is the company local network and eth1 is my local network where I have 10.1.1.12 (my PC) and 10.1.1.1 (the router).

I didn't patch the kernel, it's normal? I have RH9 with kernel "Linux ROUTER-1MBS 2.4.20-8 #1 Thu Mar 13 17:54:28 EST 2003 i686 i686 i386 GNU/Linux". Should I change something in kernel?

I have tried htb.init but it's not working :-(

Jean-Francois

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