MyShaper

   

Myshapper (2004 Dominique Voillemot)
License : GPL

Ceci est un init script pour Linux RedHat ou systeme compatible SYSV
qui permet de mettre en oeuvre un shaper sur l'interface ppp0.
Ce shaper va limiter votre bande passante émissions de maniere à en conserver
un peu pour les mails, news, irc, messager (...) et pour
surfer sur vos sites web habituels.
Très utile si vous avez un serveur ou si vous utilisez des applications de
partage de fichier style Edonkey.
Mettez just l'ip de votre serveur mail, news, pop (...) dans
/etc/myshaper.conf, lancez votre connection a internet, lancez myshaper :
./myshaper start
et c'est bon !
Si vous n'avez pas une configuration qui utilise une interface style ppp0
vous pouvez facile éditer les fichiers pour votre configuration.
Le plus important est la table de routage.
Exemple pour ppp0:

###
### AVANT myshaper
###
----
[root@mylinux /]#
[root@mylinux /]# /sbin/route -n
Table de routage IP du noyau
Destination     Passerelle      Genmask         Indic Metric Ref
 Use Iface
80.14.174.1     0.0.0.0         255.255.255.255 UH    0      0        0 ppp0
127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo
0.0.0.0         80.14.174.1     0.0.0.0         UG    0      0        0 ppp0
[root@mylinux /]# /sbin/ifconfig ppp0
ppp0      Lien encap:Protocole Point-à-Point
          inet adr:80.14.174.196  P-t-P:80.14.174.1  Masque:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:309775 errors:0 dropped:0 overruns:0 frame:0
          TX packets:298352 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 lg file transmission:3
          RX bytes:143591980 (136.9 Mb)  TX bytes:79967793 (76.2 Mb)

[root@mylinux /]#
----
###
### MYSHAPER lancera ces commandes (Remplacez my* par le N° ip) :
###
----
###
### MYSHAPER lancera ces commandes (Remplacez my* par le N° ip) :
###
----
[root@mylinux /]#
[root@mylinux /]# /sbin/insmod shaper
[root@mylinux /]# /sbin/shapecfg attach shaper0 ppp0
[root@mylinux /]# /sbin/shapecfg speed shaper0 12000
[root@mylinux /]# /sbin/ifconfig shaper0 80.14.174.196 netmask 255.255.255.255 up
[root@mylinux /]#
#
# Le Shaper est ok mais pour l'intant tout fonctionne comme avant.
# Le but du jeu est maintenant de remplacer ppp0 par shaper0 dans la
# table de routage
#
[root@mylinux /]#
[root@mylinux /]# /sbin/route add 80.14.174.1 shaper0
[root@mylinux /]# /sbin/route del 80.14.174.1 ppp0
[root@mylinux /]# /sbin/route add default gw 80.14.174.1 shaper0
[root@mylinux /]# /sbin/route del default gw 80.14.174.1 ppp0
[root@mylinux /]#
#
# On ajoute maintenant des routes selon vos besoins
#
[root@mylinux /]#
[root@mylinux /]# /sbin/route add mymail ppp0
[root@mylinux /]# /sbin/route add mynews ppp0
[root@mylinux /]# /sbin/route add myirc ppp0
[root@mylinux /]# /sbin/route add mymsn ppp0
[root@mylinux /]#
----
###
### APRES myshaper (Pas de changement à l'interface ppp0)
###
----
[root@mylinux /]#
[root@mylinux /]# /sbin/ifconfig shaper0
shaper0   Lien encap:Protocole Point-à-Point
          inet adr:80.14.174.196  Masque:255.255.255.255
          UP RUNNING  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:177783 errors:0 dropped:0 overruns:0 carrier:0
          collisions:22665 lg file transmission:10
          RX bytes:0 (0.0 b)  TX bytes:42574550 (40.6 Mb)

[root@mylinux /]#
#
# Remarquez à la dernière ligne "RX bytes:0 (0.0 b)"
# Rappelez vous que le shaper fonctionne seulement en émission.
#
[root@mylinux /]#
[root@mylinux /]# /sbin/route
Kernel routing Table
Destination     Passerelle      Genmask         Indic Metric Ref    Use Iface
80.14.174.1     0.0.0.0           255.255.255.255 UH    0      0        0 shaper0
127.0.0.0         0.0.0.0           255.0.0.0                  U     0      0        0 lo
0.0.0.0              80.14.174.1  0.0.0.0                   UG    0      0        0 shaper0
mymail             0.0.0.0           255.255.255.255 UH    0      0        0 ppp0
mynews           0.0.0.0           255.255.255.255 UH    0      0        0 ppp0
myirc                0.0.0.0           255.255.255.255 UH    0      0        0 ppp0
mymsn             0.0.0.0           255.255.255.255 UH    0      0        0 ppp0
[root@mylinux /]#
[root@mylinux /]# /sbin/ifconfig shaper0
shaper0   Lien encap:Protocole Point-à-Point
          inet adr:80.14.174.196  Masque:255.255.255.255
          UP RUNNING  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:177783 errors:0 dropped:0 overruns:0 carrier:0
          collisions:22665 lg file transmission:10
          RX bytes:0 (0.0 b)  TX bytes:42574550 (40.6 Mb)

[root@mylinux /]#
----
###
###
###
Maintenant vous devriez etre capable de faire votre propre shaper
Bonne chance
Dominique -  26/01/2004
Downloads :

Rpm package

Tar.gz package



     Dominique Voillemot  ©  2004