transmission:l2tp

Différences

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

Lien vers cette vue comparative

Les deux révisions précédentes Révision précédente
Prochaine révision
Révision précédente
transmission:l2tp [2020/11/08 18:31] – [Travaux de la fédé] sthibaultransmission:l2tp [2026/06/02 22:06] (Version actuelle) – [Documentation] sthibaul
Ligne 1: Ligne 1:
 ====== L2TP ====== ====== L2TP ======
  
-L2TP est un protocole qui permet de livrer une collecte (par exemple ADSL). On fait tourner un serveur L2TP, et il reçoit depuis l'opérateur de collecte les sessions des abonnés.+L2TP (Layer 2 Tunneling Protocol) est un protocole qui permet de livrer une collecte (par exemple ADSL). On fait tourner un serveur L2TP (appelé LNS, L2TP Network Server), et il reçoit depuis l'opérateur de collecte (appelé LAC, L2TP access concentrator) les sessions des abonnés.
  
 +Le principe est que le routeur de l'abonné utilise PPP sur sa connexion internet (sur l'ONT ou sur le modem xDSL) avec le login et mot de passe renseigné par nous ; l'équipement qui est de l'autre côté du fil, appelé BAS (Broadband Access Server) voit la forme du login (ce qui est tout à la fin après le `@`) et fait remonter via le protocole L2TP l'ouverture de session au bon premier fournisseur. Celui-ci (un LAC) regarde un peu avant dans le login, pour faire remonter au bon deuxième fournisseur (un autre LAC), etc. de proche en proche jusqu'au fournisseur final (le LNS) qui correspond exactement à la partie après `@` dans le login, qui décapsule le protocole L2TP, et traite le PPP qui est dedans. Ainsi, l'abonné n'y voit que du feu, il a l'impression de parler "directement" PPP avec le LNS, alors que c'est transporté par L2TP.
 ===== Voir aussi... ===== ===== Voir aussi... =====
  
Ligne 27: Ligne 28:
 ===== Travaux de la fédé ===== ===== Travaux de la fédé =====
  
-  * On travaille avec l2tpns +* On travaille avec l2tpns 
-    * https://code.ffdn.org/l2tpns/l2tpns  +  * https://code.ffdn.org/l2tpns/l2tpns 
-    * https://lists.ffdn.org/wws/info/l2tpns +  * https://salsa.debian.org/debian/l2tpns/-/commits/master 
-    * https://bugs.debian.org/929610 +  * https://lists.ffdn.org/wws/info/l2tpns 
-    * https://bugs.debian.org/cgi-bin/pkgreport.cgi?archive=both;package=l2tpns+  * https://bugs.debian.org/cgi-bin/pkgreport.cgi?archive=both;package=l2tpns 
 +  * Ancien upstream: https://github.com/bodea/l2tpns puis http://git.sameswireless.fr/l2tpns.git et puis aussi https://sourceforge.net/projects/l2tpns/ 
 ===== Documentation ===== ===== Documentation =====
  
   * [[https://www.grenode.net/Documentation_technique/R%C3%A9seau/Collecte_xDSL/#l2tp]]   * [[https://www.grenode.net/Documentation_technique/R%C3%A9seau/Collecte_xDSL/#l2tp]]
 +
 +  * Le principe du protocole L2TP:
 +    * Lors de la connexion du premier abonné, le fournisseur ouvre d'abord un tunnel:
 +      * Le LAC envoie un paquet SCCRQ (Start-Control-Connection-Request)
 +      * Le LNS répond avec un paquet SCCRP (Start-Control-Connection-Reply)
 +      * Le LAC répond avec un paquet SCCCN (Start-Control-Connection-Connected)
 +      * Le LNS répond avec un simple acquittement (appelé ZLB, Zero-Length Body)
 +    * Lors de la connexion d'un abonné, le fournisseur utilise un tunnel existant (ou qu'il vient d'ouvrir) et:
 +      * Le LAC envoie un paquet ICRQ (Incoming-Call-Request)
 +      * Le LNS répond avec un paquet ICRP (Incoming-Call-Reply)
 +      * Le LAC répond avec un paquet ICCN (Incoming-Call-Connected)
 +      * Le LNS répond avec un simple acquittement (appelé ZLB, Zero-Length Body)
 +    * Les trames PPP sont ensuite transmises inchangées entre l'abonné et le LNS (avec une simple encapsulation L2TP le long du chemin), leur permettant ainsi de faire leur négociation LCP+CHAP/PAP+IPCP indépendamment des fournisseurs intermédiaires.
 +
 +  * Une subtilité, c'est que pour pouvoir connaître le login de l'abonné, le BAS est obligé de commencer la négociation LCP+CHAP/PAP avec le client. Après avoir relayé la session à l'équipement LAC suivant, ce dernier doit recommencer pour connaître le login, et de même pour les suivants jusqu'au LNS final ; l'abonné se retrouve ainsi à devoir recommencer la négociation de multiples fois, ce qui peut le faire perdre patience s'il y a beaucoup de relais. Avec l'option de proxy LCP et auth, au moment où un LAC établit son relai, il fournit le résultat de la négociation au suivant, qui n'a ainsi pas besoin de recommencer la négociation. Idéalement tout le monde relaie au suivant, permettant ainsi à la session de remonter très rapidement jusqu'au LNS final qui a juste à finir la négociation (éventuellement amender la négociation LCP si elle ne lui plaît pas tout à fait).
 +
 +  * Enregistrer un tcpdump dans des fichiers pour analyse post-mortem en utilisant une rotation des fichiers de sortie toutes les heures sur un mois:
 +
 +```
 +sudo tcpdump -w /var/tmp/dump%d-%H.pcap -G 3600
 +```
 +
 +  * Observer les négociations en tous genre (pas de trafic ipv4, ipv6, echo, ccp, mlppp):
 +
 +```
 +sudo tcpdump -v -n -i any 'udp and port 1701 and (len <= 40 or (
 +       ( not (( udp[8] & 0x40 == 0 ) and udp[16] == 0x00 and udp[17] == 0x21) )
 +   and ( not (( udp[8] & 0x40 == 0 ) and udp[16] == 0xFF and udp[17] == 0x03 and udp[18] == 0x00 and udp[19] == 0x21) )
 +   and ( not (( udp[8] & 0x40 != 0 ) and udp[18] == 0x00 and udp[19] == 0x21) )
 +   and ( not (( udp[8] & 0x40 != 0 ) and udp[18] == 0xFF and udp[19] == 0x03 and udp[20] == 0x00 and udp[21] == 0x21) )
 +
 +   and ( not (( udp[8] & 0x40 == 0 ) and udp[16] == 0x00 and udp[17] == 0x57) )
 +   and ( not (( udp[8] & 0x40 == 0 ) and udp[16] == 0xFF and udp[17] == 0x03 and udp[18] == 0x00 and udp[19] == 0x57) )
 +   and ( not (( udp[8] & 0x40 != 0 ) and udp[18] == 0x00 and udp[19] == 0x57) )
 +   and ( not (( udp[8] & 0x40 != 0 ) and udp[18] == 0xFF and udp[19] == 0x03 and udp[20] == 0x00 and udp[21] == 0x57) )
 +
 +   and ( not (( udp[8] & 0x40 == 0 ) and udp[16] == 0x00 and udp[17] == 0x3d) )
 +   and ( not (( udp[8] & 0x40 == 0 ) and udp[16] == 0xFF and udp[17] == 0x03 and udp[18] == 0x00 and udp[19] == 0x3d) )
 +   and ( not (( udp[8] & 0x40 != 0 ) and udp[18] == 0x00 and udp[19] == 0x3d) )
 +   and ( not (( udp[8] & 0x40 != 0 ) and udp[18] == 0xFF and udp[19] == 0x03 and udp[20] == 0x00 and udp[21] == 0x3d) )
 +
 +   and ( not (( udp[8] & 0x40 == 0 ) and udp[16] == 0x80 and udp[17] == 0xfd) )
 +   and ( not (( udp[8] & 0x40 == 0 ) and udp[16] == 0xFF and udp[17] == 0x03 and udp[18] == 0x80 and udp[19] == 0xfd) )
 +   and ( not (( udp[8] & 0x40 != 0 ) and udp[18] == 0x80 and udp[19] == 0xfd) )
 +   and ( not (( udp[8] & 0x40 != 0 ) and udp[18] == 0xFF and udp[19] == 0x03 and udp[20] == 0x80 and udp[21] == 0xfd) )
 +
 +   and ( not (( udp[8] & 0x40 == 0 ) and udp[18] == 0x9 ) )
 +   and ( not (( udp[8] & 0x40 == 0 ) and udp[16] == 0xFF and udp[17] == 0x03 and udp[20] == 0x9 ) )
 +   and ( not (( udp[8] & 0x40 != 0 ) and udp[20] == 0x9 ) )
 +   and ( not (( udp[8] & 0x40 != 0 ) and udp[18] == 0xFF and udp[19] == 0x03 and udp[22] == 0x9 ) )
 +
 +   and ( not (( udp[8] & 0x40 == 0 ) and udp[18] == 0xa ) )
 +   and ( not (( udp[8] & 0x40 == 0 ) and udp[16] == 0xFF and udp[17] == 0x03 and udp[20] == 0xa ) )
 +   and ( not (( udp[8] & 0x40 != 0 ) and udp[20] == 0xa ) )
 +   and ( not (( udp[8] & 0x40 != 0 ) and udp[18] == 0xFF and udp[19] == 0x03 and udp[22] == 0xa ) )
 +) )'
 +```
 +
 +  * Observer les messages de contrôle L2TP (établissement de tunnel/sessoin)
 +
 +```
 +sudo tcpdump -v -n -i any 'udp and port 1701 and (len <= 40 or ( udp[8] & 0x80 != 0 ))'
 +```
 +
 +  * Observer un tunnel en particulier:
 +
 +```
 +sudo tcpdump -v -n -i any 'udp and port 1701
 +    and ( ( ( udp[8] & 0x40 == 0 ) and udp[10] = 0 and udp[11] = 10 ) or
 +          ( ( udp[8] & 0x40 != 0 ) and udp[12] = 0 and udp[13] = 10 ) )
 +          '
 +```
 +
 +  * Observer une session en particulier:
 +
 +```
 +sudo tcpdump -v -n -i any 'udp and port 1701
 +    and ( ( ( udp[8] & 0x40 == 0 ) and udp[12] = 0 and udp[13] = 123 ) or
 +          ( ( udp[8] & 0x40 != 0 ) and udp[14] = 0 and udp[15] = 123 ) )
 +          '
 +```
 +
 +  * Observer les logins pap/chap:
 +
 +```
 +tcpdump -n -vvv   -i any 'udp and port 1701 and
 +   (udp[8] & 0x80) == 0 and
 +       ((udp[16] == 0xc0 or udp[16] == 0xc2) and udp[17] == 0x23)  
 +     or  ((udp[18] == 0xc0 or udp[18] == 0xc2) and udp[19] == 0x23) )'
 +```
 +
 +
 +  * Observer le dhcpv6:
 +
 +```
 +sudo tcpdump -v -n -i any 'udp and port 1701
 +    and (    ( ( udp[8] & 0x40 != 0 ) and udp[18] == 0x00 and udp[19] == 0x57 and udp[26] == 0x11 and udp[60] == 0x2 and ( udp[61] == 0x22 or udp[61] == 0x23 ) )
 +          or ( ( udp[8] & 0x40 == 0 ) and udp[16] == 0x00 and udp[17] == 0x57 and udp[24] == 0x11 and udp[58] == 0x2 and ( udp[59] == 0x22 or udp[59] == 0x23 ) ) )
 +          '
 +
 +```
 +
 +  * Observer les RS/RA:
 +
 +```
 +sudo tcpdump -v -n -i any 'udp and port 1701
 +    and (    ( ( udp[8] & 0x40 != 0 ) and udp[18] == 0x00 and udp[19] == 0x57 and udp[26] == 58 and ( udp[60] == 134 or udp[60] == 133 ) )
 +          or ( ( udp[8] & 0x40 == 0 ) and udp[16] == 0x00 and udp[17] == 0x57 and udp[24] == 58 and ( udp[58] == 134 or udp[58] == 133 ) ) )
 +          '
 +```
 +
  • transmission/l2tp.1604860275.txt.gz
  • Dernière modification : 2020/11/08 18:31
  • de sthibaul