documentation:infrastructure:exemple_sames

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Prochaine révision
Révision précédente
documentation:infrastructure:exemple_sames [2011/06/20 11:54]
maethor créée
documentation:infrastructure:exemple_sames [2012/09/17 08:15] (Version actuelle)
Ligne 55: Ligne 55:
  
  
-__**Schéma de la passerelle**__+__**Schéma de la passerelle**__ 
  
-{{:essaimage:infrastructure:gateway2.jpg|}} 
  
-//InfosLes IPs données dans ces exemples ne correspondent pas aux IPs réellement utilisées sur notre réseau.//+{{:documentation:infrastructure:gateway2.jpg}}
  
-Aujourd'hui FDN nous livre un bloc de 128 IP publiques (80.68.167.128/25) découpées en 4 blocs de 32 IPs (un /27 par connexion ppp).\\ 
-ppp0 --> 80.68.167.128/27\\ 
-ppp1 --> 80.68.167.160/27\\ 
-ppp2 --> 80.68.167.192/27\\ 
-ppp3 --> 80.68.167.224/27\\ 
  
-Si l'on veut utiliser la même interface physique pour monter plusieurs connexions ppp il faut utiliser les vlan, car lors de la négociation pppoe avec le serveur, le serveur n'accepte qu'une connexion ppp par adresse MAC.\\ +//Infos: Les IPs données dans ces exemples ne correspondent pas aux IPs réellement utilisées sur notre réseau.// 
-Pour cela Il faut avoir installé le paquet vlan (voir vconfig) pour pouvoir utiliser les vlan sur une debian.\\+
  
-http://www.linux-france.org/prj/inetdoc/cours/routage.inter-vlan/routage.inter-vlan.typical.html 
  
 +Aujourd'hui FDN nous livre un bloc de 128 IP publiques (80.68.167.128/25) découpées en 4 blocs de 32 IPs (un /27 par connexion ppp).\\  ppp0 –> 80.68.167.128/27\\  ppp1 –> 80.68.167.160/27\\  ppp2 –> 80.68.167.192/27\\  ppp3 –> 80.68.167.224/27
  
-__configuration du fichier interface__ 
  
-//alix:/# cat /etc/network/interfaces//+Si l'on veut utiliser la même interface physique pour monter plusieurs connexions ppp il faut utiliser les vlan, car lors de la négociation pppoe avec le serveur, le serveur n'accepte qu'une connexion ppp par adresse MAC.\\  Pour cela Il faut avoir installé le paquet vlan (voir vconfig) pour pouvoir utiliser les vlan sur une debian.
  
- # This file describes the network interfaces available on your system 
- # and how to activate them. For more information, see interfaces(5). 
-  
- # The loopback network interface 
- auto lo eth0 eth1 eth2 
- iface lo inet loopback 
-  
- iface eth0 inet static 
-     post-up iptables-restore < /etc/iptables.up.rules 
-     address 192.168.2.1 
-     netmask 255.255.255.0 
-     broadcast 192.168.2.255 
-     network 192.168.2.0 
-  
- auto eth0.101 
- iface eth0.101 inet static 
-         address 192.168.101.2 
-         netmask 255.255.255.0 
-         broadcast 192.168.101.255 
-         network 192.168.101.0 
-         hwaddress ether 00:0d:b9:1d:3f:d7 
-  
- auto eth0.102 
- iface eth0.102 inet static 
-         address 192.168.102.2 
-         netmask 255.255.255.0 
-         broadcast 192.168.102.255 
-         network 192.168.102.0 
-         hwaddress ether 00:0d:b9:1d:3f:d8 
-  
- auto eth0.103 
- iface eth0.103 inet static 
-         address 192.168.103.2 
-         netmask 255.255.255.0 
-         broadcast 192.168.103.255 
-         network 192.168.103.0 
-         hwaddress ether 00:0d:b9:1d:3f:d9 
-  
- auto eth0.104 
- iface eth0.104 inet static 
-         address 192.168.104.2 
-         netmask 255.255.255.0 
-         broadcast 192.168.104.255 
-         network 192.168.104.0 
-         hwaddress ether 00:0d:b9:1d:3f:da 
-  
- # LAN Private Network 
- iface eth1 inet static 
-         address 192.168.1.1 
-         netmask 255.255.255.0 
-         broadcast 192.168.1.255 
-         network 192.168.1.0 
-  
- # LAN Publique Network 
- iface eth2 inet static 
-         address 80.68.167.129 
-         netmask 255.255.255.128 
-         broadcast 80.68.167.255 
-         network 80.68.167.128 
  
-__Définition de 4 tables iproute, une par connexion ppp (WAN1,WAN2,WAN3 et WAN4)__+[[http://www.linux-france.org/prj/inetdoc/cours/routage.inter-vlan/routage.inter-vlan.typical.html|http://www.linux-france.org/prj/inetdoc/cours/routage.inter-vlan/routage.inter-vlan.typical.html]] 
  
-//alix:/# cat /etc/iproute2/rt_tables// 
  
-+__configuration du fichier interface__ 
- # reserved values +
-+
- 255     local +
- 254     main +
- 253     default +
- 0       unspec +
-  +
- 201 WAN1 +
- 202 WAN2 +
- 203 WAN3 +
- 204 WAN4+
  
-__script de routage lancé au boot__ 
  
-//alix:/# cat /etc/init.d/routing//+//alix:/# cat /etc/network/interfaces//  
 +<code> 
 +# This file describes the network interfaces available on your system 
 +# and how to activate them. For more information, see interfaces(5). 
 + 
 +# The loopback network interface 
 +auto lo eth0 eth1 eth2 
 +iface lo inet loopback 
 + 
 +iface eth0 inet static 
 +    post-up iptables-restore </etc/iptables.up.rules 
 +    address 192.168.2.1 
 +    netmask 255.255.255.0 
 +    broadcast 192.168.2.255 
 +    network 192.168.2.0 
 + 
 +auto eth0.101 
 +iface eth0.101 inet static 
 +        address 192.168.101.2 
 +        netmask 255.255.255.0 
 +        broadcast 192.168.101.255 
 +        network 192.168.101.0 
 +        hwaddress ether 00:0d:b9:1d:3f:d7 
 + 
 +auto eth0.102 
 +iface eth0.102 inet static 
 +        address 192.168.102.2 
 +        netmask 255.255.255.0 
 +        broadcast 192.168.102.255 
 +        network 192.168.102.0 
 +        hwaddress ether 00:0d:b9:1d:3f:d8 
 + 
 +auto eth0.103 
 +iface eth0.103 inet static 
 +        address 192.168.103.2 
 +        netmask 255.255.255.0 
 +        broadcast 192.168.103.255 
 +        network 192.168.103.0 
 +        hwaddress ether 00:0d:b9:1d:3f:d9 
 + 
 +auto eth0.104 
 +iface eth0.104 inet static 
 +        address 192.168.104.2 
 +        netmask 255.255.255.0 
 +        broadcast 192.168.104.255 
 +        network 192.168.104.0 
 +        hwaddress ether 00:0d:b9:1d:3f:da 
 + 
 +# LAN Private Network 
 +iface eth1 inet static 
 +        address 192.168.1.1 
 +        netmask 255.255.255.0 
 +        broadcast 192.168.1.255 
 +        network 192.168.1.0 
 + 
 +# LAN Publique Network 
 +iface eth2 inet static 
 +        address 80.68.167.129 
 +        netmask 255.255.255.128 
 +        broadcast 80.68.167.255 
 +        network 80.68.167.128 
 +</code> 
 + 
 + 
 +__Définition de 4 tables iproute, une par connexion ppp (WAN1,WAN2,WAN3 et WAN4)__  
 + 
 + 
 +//alix:/# cat /etc/iproute2/rt_tables//  
 +<code> 
 +
 +# reserved values 
 +
 +255     local 
 +254     main 
 +253     default 
 +0       unspec 
 + 
 +201 WAN1 
 +202 WAN2 
 +203 WAN3 
 +204 WAN4 
 +</code> 
 + 
 + 
 +__script de routage lancé au boot__  
 + 
 + 
 +//alix:/# cat /etc/init.d/routing//  
 +<code> 
 +#!/bin/sh 
 + 
 +PATH=/sbin:/bin:/usr/bin 
 + 
 +do_stop () { 
 +        ip route flush cache 
 +
 + 
 +do_start () { 
 +        ip route flush table WAN1 
 +        ip route flush table WAN2 
 +        ip route flush table WAN3 
 +        ip route flush table WAN4 
 + 
 +        # Table WAN1 
 +        ip route add 127.0.0.0/8 dev lo table WAN1 
 +        ip route add 80.68.167.128/25 dev eth2 proto kernel scope link src 80.68.167.129 table WAN1 
 +        ip route add 192.168.101.0/24 dev eth0.101 proto kernel scope link src 192.168.101.2 table WAN1 
 +        ip route add 192.168.102.0/24 dev eth0.102 proto kernel scope link src 192.168.102.2 table WAN1 
 +        ip route add 192.168.103.0/24 dev eth0.103 proto kernel scope link src 192.168.103.2 table WAN1 
 +        ip route add 192.168.104.0/24 dev eth0.104 proto kernel scope link src 192.168.104.2 table WAN1 
 +        ip route add 192.168.1.0/24 dev eth1 proto kernel scope link src 192.168.1.1 table WAN1 
 + 
 +        # Table WAN2 
 +        ip route add 127.0.0.0/8 dev lo table WAN2 
 +        ip route add 80.68.167.128/25 dev eth2 proto kernel scope link src 80.68.167.129 table WAN2 
 +        ip route add 192.168.101.0/24 dev eth0.101 proto kernel scope link src 192.168.101.2 table WAN2 
 +        ip route add 192.168.102.0/24 dev eth0.102 proto kernel scope link src 192.168.102.2 table WAN2 
 +        ip route add 192.168.103.0/24 dev eth0.103 proto kernel scope link src 192.168.103.2 table WAN2 
 +        ip route add 192.168.104.0/24 dev eth0.104 proto kernel scope link src 192.168.104.2 table WAN2 
 +        ip route add 192.168.1.0/24 dev eth1 proto kernel scope link src 192.168.1.1 table WAN2 
 + 
 +        # Table WAN3 
 +        ip route add 127.0.0.0/8 dev lo table WAN3 
 +        ip route add 80.68.167.128/25 dev eth2 proto kernel scope link src 80.68.167.129 table WAN3 
 +        ip route add 192.168.101.0/24 dev eth0.101 proto kernel scope link src 192.168.101.2 table WAN3 
 +        ip route add 192.168.102.0/24 dev eth0.102 proto kernel scope link src 192.168.102.2 table WAN3 
 +        ip route add 192.168.103.0/24 dev eth0.103 proto kernel scope link src 192.168.103.2 table WAN3 
 +        ip route add 192.168.104.0/24 dev eth0.104 proto kernel scope link src 192.168.104.2 table WAN3 
 +        ip route add 192.168.1.0/24 dev eth1 proto kernel scope link src 192.168.1.1 table WAN3 
 + 
 +        # Table WAN4 
 +        ip route add 127.0.0.0/8 dev lo table WAN4 
 +        ip route add 80.68.167.128/25 dev eth2 proto kernel scope link src 80.68.167.129 table WAN4 
 +        ip route add 192.168.101.0/24 dev eth0.101 proto kernel scope link src 192.168.101.2 table WAN4 
 +        ip route add 192.168.102.0/24 dev eth0.102 proto kernel scope link src 192.168.102.2 table WAN4 
 +        ip route add 192.168.103.0/24 dev eth0.103 proto kernel scope link src 192.168.103.2 table WAN4 
 +        ip route add 192.168.104.0/24 dev eth0.104 proto kernel scope link src 192.168.104.2 table WAN4 
 +        ip route add 192.168.1.0/24 dev eth1 proto kernel scope link src 192.168.1.1 table WAN4 
 + 
 +        ip route add 127.0.0.0/8 dev lo 
 + 
 +        # DEMARRAGE des connexions PPPOE 
 +        pon dsl-provider1 
 +        pon dsl-provider2 
 +        pon dsl-provider3 
 +        pon dsl-provider4 
 +
 + 
 +case "$1" in 
 +  start) 
 +    do_start 
 +    exit 0 
 +    ;; 
 +  restart|reload|force-reload) 
 +    echo "Error: argument '$1' not supported">&
 +    exit 3 
 +    ;; 
 +  stop) 
 +    do_stop 
 +    exit 0 
 +    ;; 
 +  *) 
 +    echo "Usage: $0 start|stop">&
 +    exit 3 
 +    ;; 
 +esac 
 +</code> 
 + 
 + 
 +__configuration des fichiers dsl-provider1, 2 , 3 et 4____\\  __  
 + 
 + 
 +//alix:~# cat /etc/ppp/peers/dsl-provider1//''\\  ''  
 + 
 + 
 +<code> 
 +noipdefault 
 +defaultroute 
 + 
 +hide-password 
 +lcp-echo-interval 15 
 +lcp-echo-failure 5 
 + 
 +connect /bin/true 
 +noauth 
 +persist 
 +mtu 1462 
 + 
 +noaccomp 
 + 
 +default-asyncmap 
 + 
 +plugin rp-pppoe.so eth0.101 
 +user "sameswireless.line1@fdn.nerim"'' 
 +</code> 
 + 
 + 
 +__script de routage lors du montage d'une connexion ppp__  
 + 
 + 
 +//alix:~# cat /etc/ppp/ip-up.d/routing//'' 
 +<code> 
 +#!/bin/sh 
 + 
 +PATH=/sbin:/bin 
 + 
 +WAN=WAN1 
 +NETW=80.68.167.128 
 +MAXUP0=700 
 +MAXUP1=600 
 + 
 +if [ "$PPP_LOCAL" = 80.70.120.108 ]; then 
 +WAN=WAN1 
 +NETW=80.68.167.128 
 +elif [ "$PPP_LOCAL" = 80.70.120.135 ]; then 
 +WAN=WAN2 
 +NETW=80.68.167.160 
 +elif [ "$PPP_LOCAL" = 80.70.120.179 ]; then 
 +WAN=WAN3 
 +NETW=80.68.167.192 
 +elif [ "$PPP_LOCAL" = 80.70.120.218 ]; then 
 +WAN=WAN4 
 +NETW=80.68.167.224 
 +fi 
 + 
 +ip route add $PPP_REMOTE dev $PPP_IFACE proto kernel scope link src $PPP_LOCAL table $WAN 
 +ip route add default dev $PPP_IFACE scope link table $WAN 
 + 
 +tc qdisc del dev $PPP_IFACE root handle 1: htb 
 + 
 +tc qdisc add dev $PPP_IFACE root handle 1: htb default 100 
 +tc class add dev $PPP_IFACE parent 1: classid 1:1 htb rate 100000Kbit ceil 100000Kbit burst 1023975b cburst 126575b prio 0 quantum 60000 
 +tc class add dev $PPP_IFACE parent 1:1 classid 1:2 htb rate 800kbit ceil 800kbit burst 6Kb cburst 2224b quantum 60000 
 + 
 +tc class add dev $PPP_IFACE parent 1:2 classid 1:10  htb rate 500kbit ceil ${MAXUP0}kbit burst 48Kb prio 1 quantum 60000 
 +tc qdisc add dev $PPP_IFACE parent 1:10 handle 10: sfq perturb 10 
 + 
 +tc class add dev $PPP_IFACE parent 1:2 classid 1:3  htb rate 200kbit ceil ${MAXUP0}kbit burst 24Kb prio 2 quantum 60000 
 + 
 +tc class add dev $PPP_IFACE parent 1:3 classid 1:100  htb rate 100kbit ceil ${MAXUP1}kbit burst 24Kb prio 3 quantum 60000 
 +tc qdisc add dev $PPP_IFACE parent 1:100 handle 100: sfq perturb 10 
 + 
 +tc qdisc del dev $PPP_IFACE ingress 
 +tc qdisc add dev $PPP_IFACE handle ffff: ingress 
 +tc filter replace dev $PPP_IFACE parent ffff: protocol ip prio 50 u32 match ip src 0.0.0.0/0 police rate 10000kbit burst 500k drop flowid :1 
 + 
 +tc filter add dev $PPP_IFACE parent 1:0 protocol ip prio 1 handle 0x01/0xF fw flowid 1:10 
 + 
 +ip rule del from 80.68.167.128/27 table $WAN 
 +ip rule del from 80.68.167.160/27 table $WAN 
 +ip rule del from 80.68.167.192/27 table $WAN 
 +ip rule del from 80.68.167.224/27 table $WAN 
 + 
 +ip rule add from $NETW/27 table $WAN 
 +</code>
  
- #!/bin/sh 
-  
- PATH=/sbin:/bin:/usr/bin 
-  
- do_stop () { 
-         ip route flush cache 
- } 
-  
- do_start () { 
-         ip route flush table WAN1 
-         ip route flush table WAN2 
-         ip route flush table WAN3 
-         ip route flush table WAN4 
-  
-         # Table WAN1 
-         ip route add 127.0.0.0/8 dev lo table WAN1 
-         ip route add 80.68.167.128/25 dev eth2 proto kernel scope link src 80.68.167.129 table WAN1 
-         ip route add 192.168.101.0/24 dev eth0.101 proto kernel scope link src 192.168.101.2 table WAN1 
-         ip route add 192.168.102.0/24 dev eth0.102 proto kernel scope link src 192.168.102.2 table WAN1 
-         ip route add 192.168.103.0/24 dev eth0.103 proto kernel scope link src 192.168.103.2 table WAN1 
-         ip route add 192.168.104.0/24 dev eth0.104 proto kernel scope link src 192.168.104.2 table WAN1 
-         ip route add 192.168.1.0/24 dev eth1 proto kernel scope link src 192.168.1.1 table WAN1 
-  
-         # Table WAN2 
-         ip route add 127.0.0.0/8 dev lo table WAN2 
-         ip route add 80.68.167.128/25 dev eth2 proto kernel scope link src 80.68.167.129 table WAN2 
-         ip route add 192.168.101.0/24 dev eth0.101 proto kernel scope link src 192.168.101.2 table WAN2 
-         ip route add 192.168.102.0/24 dev eth0.102 proto kernel scope link src 192.168.102.2 table WAN2 
-         ip route add 192.168.103.0/24 dev eth0.103 proto kernel scope link src 192.168.103.2 table WAN2 
-         ip route add 192.168.104.0/24 dev eth0.104 proto kernel scope link src 192.168.104.2 table WAN2 
-         ip route add 192.168.1.0/24 dev eth1 proto kernel scope link src 192.168.1.1 table WAN2 
-  
-         # Table WAN3 
-         ip route add 127.0.0.0/8 dev lo table WAN3 
-         ip route add 80.68.167.128/25 dev eth2 proto kernel scope link src 80.68.167.129 table WAN3 
-         ip route add 192.168.101.0/24 dev eth0.101 proto kernel scope link src 192.168.101.2 table WAN3 
-         ip route add 192.168.102.0/24 dev eth0.102 proto kernel scope link src 192.168.102.2 table WAN3 
-         ip route add 192.168.103.0/24 dev eth0.103 proto kernel scope link src 192.168.103.2 table WAN3 
-         ip route add 192.168.104.0/24 dev eth0.104 proto kernel scope link src 192.168.104.2 table WAN3 
-         ip route add 192.168.1.0/24 dev eth1 proto kernel scope link src 192.168.1.1 table WAN3 
-  
-         # Table WAN4 
-         ip route add 127.0.0.0/8 dev lo table WAN4 
-         ip route add 80.68.167.128/25 dev eth2 proto kernel scope link src 80.68.167.129 table WAN4 
-         ip route add 192.168.101.0/24 dev eth0.101 proto kernel scope link src 192.168.101.2 table WAN4 
-         ip route add 192.168.102.0/24 dev eth0.102 proto kernel scope link src 192.168.102.2 table WAN4 
-         ip route add 192.168.103.0/24 dev eth0.103 proto kernel scope link src 192.168.103.2 table WAN4 
-         ip route add 192.168.104.0/24 dev eth0.104 proto kernel scope link src 192.168.104.2 table WAN4 
-         ip route add 192.168.1.0/24 dev eth1 proto kernel scope link src 192.168.1.1 table WAN4 
-  
-         ip route add 127.0.0.0/8 dev lo 
-  
-         # DEMARRAGE des connexions PPPOE 
-         pon dsl-provider1 
-         pon dsl-provider2 
-         pon dsl-provider3 
-         pon dsl-provider4 
- } 
-  
-  
- case "$1" in 
-   start) 
-     do_start 
-     exit 0 
-     ;; 
-   restart|reload|force-reload) 
-     echo "Error: argument '$1' not supported" >&2 
-     exit 3 
-     ;; 
-   stop) 
-     do_stop 
-     exit 0 
-     ;; 
-   *) 
-     echo "Usage: $0 start|stop" >&2 
-     exit 3 
-     ;; 
- esac 
  • documentation/infrastructure/exemple_sames.1308563666.txt.gz
  • Dernière modification: 2012/09/17 08:15
  • (modification externe)