Auteur Sujet: Remplacer sa Livebox par un routeur Ubiquiti Edgemax  (Lu 1527647 fois)

0 Membres et 2 Invités sur ce sujet

Nh3xus

  • Réseau Deux Sarres (57)
  • Abonné MilkyWan
  • *
  • Messages: 3 271
  • Sarrebourg (57)
Remplacer sa Livebox par un routeur Ubiquiti Edgemax
« Réponse #2736 le: 13 juin 2016 à 10:52:33 »
Hello zoc,

As-tu le lien vers ton script de firewall qui prends en charge le changement de préfixe ?

Merci beaucoup :)

zoc

  • Abonné Orange Fibre
  • *
  • Messages: 4 289
  • Antibes (06) / Mercury (73)
Remplacer sa Livebox par un routeur Ubiquiti Edgemax
« Réponse #2737 le: 13 juin 2016 à 12:18:07 »
Non, je n'ai pas de liens: ma configuration IPv6 est très spécifique (avec de nombreux VLANs sur mon réseau local ayant chacun leur /64) et du coup les scripts le sont aussi.

Avant de publier quoi que ce soit, il faudrait que je nettoie tout ça pour en faire une configuration basique. Actuellement je n'ai absolument pas le temps de le faire. Peut-être en juillet pendant mes vacances, mais pas avant.


sylr

  • Abonné Orange Fibre
  • *
  • Messages: 50
  • Bordeaux 33

sylr

  • Abonné Orange Fibre
  • *
  • Messages: 50
  • Bordeaux 33
Remplacer sa Livebox par un routeur Ubiquiti Edgemax
« Réponse #2739 le: 15 juin 2016 à 23:18:34 »
@zoc je suis entrain d'essayer ton client dibbler mais ca n'a pas l'ai de marcher :

root@bdx-val-rt1:~# dibbler-client run
| Dibbler - a portable DHCPv6, version 1.0.1 (CLIENT, Linux port)
| Authors : Tomasz Mrugalski<thomson(at)klub.com.pl>,Marek Senderski<msend(at)o2.pl>
| Licence : GNU GPL v2 only. Developed at Gdansk University of Technology.
| Homepage: http://klub.com.pl/dhcpv6/
2016.06.15 23:15:11 Client Notice    My pid (14454) is stored in /var/lib/dibbler/client.pid
2016.06.15 23:15:11 Client Notice    Detected iface eth1.838/19, MAC=24:a4:3c:3c:c1:59.
2016.06.15 23:15:11 Client Notice    Detected iface eth1.851/18, MAC=24:a4:3c:3c:c1:59.
2016.06.15 23:15:11 Client Notice    Detected iface eth1.840/17, MAC=24:a4:3c:3c:c1:59.
2016.06.15 23:15:11 Client Notice    Detected iface eth1.841/16, MAC=24:a4:3c:3c:c1:59.
2016.06.15 23:15:11 Client Notice    Detected iface eth4/15, MAC=24:a4:3c:3c:c1:5d.
2016.06.15 23:15:11 Client Notice    Detected iface eth3/14, MAC=24:a4:3c:3c:c1:5c.
2016.06.15 23:15:11 Client Notice    Detected iface dummy0/13, MAC=a6:f0:c9:5f:ac:b7.
2016.06.15 23:15:11 Client Notice    Detected iface switch0.198/12, MAC=24:a4:3c:3c:c1:5a.
2016.06.15 23:15:11 Client Notice    Detected iface switch0.199/11, MAC=24:a4:3c:3c:c1:5a.
2016.06.15 23:15:11 Client Notice    Detected iface eth1.832/10, MAC=24:a4:3c:3c:c1:59.
2016.06.15 23:15:11 Client Notice    Detected iface br0/9, MAC=24:a4:3c:3c:c1:59.
2016.06.15 23:15:11 Client Notice    Detected iface eth2/6, MAC=24:a4:3c:3c:c1:5b.
2016.06.15 23:15:11 Client Notice    Detected iface imq0/5, MAC=.
2016.06.15 23:15:11 Client Notice    Detected iface switch0/4, MAC=24:a4:3c:3c:c1:5a.
2016.06.15 23:15:11 Client Notice    Detected iface eth1/3, MAC=24:a4:3c:3c:c1:59.
2016.06.15 23:15:11 Client Notice    Detected iface eth0/2, MAC=24:a4:3c:3c:c1:58.
2016.06.15 23:15:11 Client Notice    Detected iface lo/1, MAC=00:00:00:00:00:00.
2016.06.15 23:15:11 Client Notice    Parsing /etc/dibbler/client.conf config file...
2016.06.15 23:15:11 Client Info      Interface eth1.832/10 configuration has been loaded.
2016.06.15 23:15:11 Client Info      My DUID is 00:01:00:01:1e:f4:6c:40:24:a4:3c:3c:c1:59.
2016.06.15 23:15:11 Client Info      Loading old address database (client-AddrMgr.xml), using built-in routines.
2016.06.15 23:15:11 Client Info      DB timestamp:1466025302, now()=1466025311, db is 9 second(s) old.
2016.06.15 23:15:11 Client Info      All client's 00:01:00:01:1e:f4:6c:40:24:a4:3c:3c:c1:59 leases are not valid.
2016.06.15 23:15:11 Client Notice    Creating control (::) socket on the lo/1 interface.
2016.06.15 23:15:11 Client Notice    Creating socket (addr=fe80::26a4:3cff:fe3c:c159) on eth1.832/10 interface.
2016.06.15 23:15:11 Client Notice    CONFIRM support compiled in.
2016.06.15 23:15:11 Client Info      Creating SOLICIT message with 0 IA(s), no TA and 1 PD(s) on eth1.832/10 interface.
2016.06.15 23:15:11 Client Error     AUTH: protocol 5313592 not supported yet.
2016.06.15 23:15:12 Client Info      Processing msg (SOLICIT,transID=0x19b91,opts: 1 25 8 16 15 11 11 6)
2016.06.15 23:15:12 Client Error     AUTH: protocol 5313592 not supported yet.
2016.06.15 23:15:14 Client Info      Processing msg (SOLICIT,transID=0x19b91,opts: 1 25 8 16 15 11 11 6)
2016.06.15 23:15:14 Client Error     AUTH: protocol 5313592 not supported yet.

Ma conf :

downlink-prefix-ifaces "none"

iface eth1.832 {
pd ### on demande une délégation de prefix ipv6 (c'est un /56)
option 16 hex 00:00:04:0e:00:05:73:61:67:65:6d
option 15 hex 00:2b:46:53:56:44:53:4c:5f:6c:69:76:65:62:6f:78:2e:49:6e:74:65:72:6e:65:74:2e:73:6f:66:74:61:74:68:6f:6d:65:2e:6c:69:76:65:62:6f:78:33
option 11 hex 00:00:00:00:00:00:00:00:00:00:00:xxxxxxxxxx
option 11 hex 00:00:00:00:00:00:00:00:00:00:00:xxxxxxxxxx
}

Est-ce que j'ai loupé un truc ?

zoc

  • Abonné Orange Fibre
  • *
  • Messages: 4 289
  • Antibes (06) / Mercury (73)
Remplacer sa Livebox par un routeur Ubiquiti Edgemax
« Réponse #2740 le: 16 juin 2016 à 06:21:07 »
La règle de firewall pour laisser passer la réponse du serveur DHCP6 ? (Je dis ça parce que je me suis fait avoir aussi la première fois  :P ).

Mes règles WAN6_LOCAL sont les suivantes:
default-action drop
 description "WAN6 to GW"
 rule 1 {
     action accept
     description "Allow Established Sessions"
     log disable
     protocol all
     state {
         established enable
         invalid disable
         new disable
         related enable
     }
 }
 rule 2 {
     action drop
     description "Drop invalid states"
     log disable
     protocol all
     state {
         established disable
         invalid enable
         new disable
         related disable
     }
 }
 rule 3 {
     action accept
     description "Allow ICMP6"
     log disable
     protocol icmpv6
 }
 rule 4 {
     action accept
     description DHCP6
     destination {
         port 546
     }
     log disable
     protocol udp
 }

Accessoirement j'ai également "option dns-server" dans ma config pour l'interface, et également "duid-type duid-ll" en paramètre global. Et evidemment également un script qui va attribuer les IP aux interfaces (dibbler ne le fait pas tout seul):

#!/bin/bash

env > /tmp/dibbler.log 2>&1

if [ "$SRV_MESSAGE" != "REPLY" ]
then
exit 1
fi

ETH0_SUFFIX="01::1"

STATUS_FILE=/run/dibbler.lease

if [ -f "$STATUS_FILE" ]
then
source $STATUS_FILE
fi

TRIM_SIZE=${#PREFIX1}
TRIM_SIZE=$((TRIM_SIZE - 4))
PREFIX1=${PREFIX1:0:TRIM_SIZE}

if [ "$PREFIX1" != "$CURRENT_PREFIX1" ]
then
if [ "$CURRENT_PREFIX1" != "" ]
then
ip addr delete "$CURRENT_PREFIX1$ETH0_SUFFIX/64" dev eth0
fi

echo "CURRENT_PREFIX1=$PREFIX1" > $STATUS_FILE

ip addr add "$PREFIX1$ETH0_SUFFIX/64" dev eth0

service radvd restart >/dev/null 2>&1
fi

Ensuite, pour que l'ERL apprenne tout seul la route par défaut, rajouter dans interfaces ethernet eth1 vif 832 :
ipv6 {
     address {
         autoconf
     }
 }

Et enfin, pour que radvd annonce le préfixe sur eth0 (je n'utilise pas DHCP6 sur mon LAN aucun équipement n'en n'a besoin, et je n'ai pas non plus de serveur DNS en IPv6), la config de radvd dans interfaces ethernet eth0 :
ipv6 {
     dup-addr-detect-transmits 1
     router-advert {
         prefix ::/64 {
         }
     }
 }

sylr

  • Abonné Orange Fibre
  • *
  • Messages: 50
  • Bordeaux 33
Remplacer sa Livebox par un routeur Ubiquiti Edgemax
« Réponse #2741 le: 16 juin 2016 à 10:04:23 »
J'ai un firewall par zone :

Chain VZONE_local_IN (1 references)
 pkts bytes target     prot opt in     out     source               destination         
   58  6032 RETURN     all      lo     any     anywhere             anywhere           
    0     0 ipv6-wan-to-local  all      eth1   any     anywhere             anywhere           
    0     0 RETURN     all      eth1   any     anywhere             anywhere           
    0     0 ipv6-wan-to-local  all      eth1.832 any     anywhere             anywhere           
    0     0 RETURN     all      eth1.832 any     anywhere             anywhere           
   73 23684 DROP       all      any    any     anywhere             anywhere           

Chain VZONE_local_OUT (1 references)
 pkts bytes target     prot opt in     out     source               destination         
   58  6032 RETURN     all      any    lo      anywhere             anywhere           
    0     0 ipv6-local-to-wan  all      any    eth1    anywhere             anywhere           
    0     0 RETURN     all      any    eth1    anywhere             anywhere           
  127 26564 ipv6-local-to-wan  all      any    eth1.832  anywhere             anywhere           
  127 26564 RETURN     all      any    eth1.832  anywhere             anywhere           
  321 49134 DROP       all      any    any     anywhere             anywhere 

Chain VZONE_wan (2 references)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 RETURN     all      eth1.832 any     anywhere             anywhere           
    0     0 RETURN     all      eth1   any     anywhere             anywhere           
    0     0 DROP       all      any    any     anywhere             anywhere   

Chain ipv6-local-to-wan (2 references)
 pkts bytes target     prot opt in     out     source               destination         
  127 26564 RETURN     all      any    any     anywhere             anywhere             /* ipv6-local-to-wan-1 */ state NEW,RELATED,ESTABLISHED
    0     0 DROP       all      any    any     anywhere             anywhere             /* ipv6-local-to-wan-2 */ state INVALID
    0     0 RETURN     all      any    any     anywhere             anywhere             /* ipv6-local-to-wan-3 */
    0     0 LOG        all      any    any     anywhere             anywhere             /* ipv6-local-to-wan-10000 default-action drop */ LOG level warning prefix "[ipv6-local-to-wa-default-D]"
    0     0 DROP       all      any    any     anywhere             anywhere             /* ipv6-local-to-wan-10000 default-action drop */

Chain ipv6-wan-to-local (2 references)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 RETURN     all      any    any     anywhere             anywhere             /* ipv6-wan-to-local-1 */ state RELATED,ESTABLISHED
    0     0 DROP       all      any    any     anywhere             anywhere             /* ipv6-wan-to-local-2 */ state INVALID
    0     0 RETURN     ipv6-icmp    any    any     anywhere             anywhere             /* ipv6-wan-to-local-3 */
    0     0 RETURN     udp      any    any     anywhere             anywhere             /* ipv6-wan-to-local-4 */ udp dpt:dhcpv6-client
    0     0 LOG        all      any    any     anywhere             anywhere             /* ipv6-wan-to-local-10000 default-action drop */ LOG level warning prefix "[ipv6-wan-to-loca-default-D]"
    0     0 DROP       all      any    any     anywhere             anywhere             /* ipv6-wan-to-local-10000 default-action drop */

tcpdump voit partir les requêtes mais rien ne revient effectivement :

root@bdx-val-rt1:~# tcpdump -i eth1.832 -vvvvvv -n ip6
tcpdump: listening on eth1.832, link-type EN10MB (Ethernet), capture size 262144 bytes
10:02:09.005768 IP6 (hlim 1, next-header UDP (17) payload length: 172) fe80::26a4:3cff:fe3c:c159.546 > ff02::1:2.547: [udp sum ok] dhcp6 solicit (xid=64020e (client-ID hwaddr/time type 1 time 519334976 24a43c3cc159) (IA_PD IAID:1 T1:4294967295 T2:4294967295) (elapsed-time 0) (vendor-class) (user-class) (authentication proto: 0, alg: 0, RDM: mono, RD: 0000 0000 0000 0000 ??) (authentication proto: 0, alg: 0, RDM: mono, RD: 0000 0000 0000 0000 ??) (option-request vendor-class user-class authentication))
10:02:10.027988 IP6 (hlim 1, next-header UDP (17) payload length: 172) fe80::26a4:3cff:fe3c:c159.546 > ff02::1:2.547: [udp sum ok] dhcp6 solicit (xid=64020e (client-ID hwaddr/time type 1 time 519334976 24a43c3cc159) (IA_PD IAID:1 T1:4294967295 T2:4294967295) (elapsed-time 100) (vendor-class) (user-class) (authentication proto: 0, alg: 0, RDM: mono, RD: 0000 0000 0000 0000 ??) (authentication proto: 0, alg: 0, RDM: mono, RD: 0000 0000 0000 0000 ??) (option-request vendor-class user-class authentication))
10:02:12.063921 IP6 (hlim 1, next-header UDP (17) payload length: 172) fe80::26a4:3cff:fe3c:c159.546 > ff02::1:2.547: [udp sum ok] dhcp6 solicit (xid=64020e (client-ID hwaddr/time type 1 time 519334976 24a43c3cc159) (IA_PD IAID:1 T1:4294967295 T2:4294967295) (elapsed-time 300) (vendor-class) (user-class) (authentication proto: 0, alg: 0, RDM: mono, RD: 0000 0000 0000 0000 ??) (authentication proto: 0, alg: 0, RDM: mono, RD: 0000 0000 0000 0000 ??) (option-request vendor-class user-class authentication))
10:02:16.109815 IP6 (hlim 1, next-header UDP (17) payload length: 172) fe80::26a4:3cff:fe3c:c159.546 > ff02::1:2.547: [udp sum ok] dhcp6 solicit (xid=64020e (client-ID hwaddr/time type 1 time 519334976 24a43c3cc159) (IA_PD IAID:1 T1:4294967295 T2:4294967295) (elapsed-time 700) (vendor-class) (user-class) (authentication proto: 0, alg: 0, RDM: mono, RD: 0000 0000 0000 0000 ??) (authentication proto: 0, alg: 0, RDM: mono, RD: 0000 0000 0000 0000 ??) (option-request vendor-class user-class authentication))

Je ne vois rien dans les logs du firewall concernant le drop de packet dhcpv6.

zoc

  • Abonné Orange Fibre
  • *
  • Messages: 4 289
  • Antibes (06) / Mercury (73)
Remplacer sa Livebox par un routeur Ubiquiti Edgemax
« Réponse #2742 le: 16 juin 2016 à 10:08:51 »
Personnellement je n'utilise pas les zones (peut-être que je devrais vu le nombre de réseaux avec des règles différentes que j'ai chez moi), donc je ne sais pas dans quelle mesure ça peut influer.

sylr

  • Abonné Orange Fibre
  • *
  • Messages: 50
  • Bordeaux 33
Remplacer sa Livebox par un routeur Ubiquiti Edgemax
« Réponse #2743 le: 16 juin 2016 à 13:17:45 »
Je suis pas un expert mais je n'ai aucune règle spécifique pour DHCP en ipv4 et cela marche donc je suppose que traffic dhcp retour est trusté par la règle qui laisse passer le traffic RELATED.

C'est différent pour le DHCPv6 ?

zoc

  • Abonné Orange Fibre
  • *
  • Messages: 4 289
  • Antibes (06) / Mercury (73)
Remplacer sa Livebox par un routeur Ubiquiti Edgemax
« Réponse #2744 le: 16 juin 2016 à 13:46:27 »
Le client DHCP pour Ipv4 (dhclient) utilise des sockets RAW, et par conséquent il bypasse complètement iptables (donc même si tu bloquais volontairement DHCP ça passerait quand même)...

Ce n'est pas le cas de dibbler qui utilise des sockets "classiques". Après, clairement, ça ne passe pas en related (je suppose que c'est parce que l'adresse de destination est une adresse multicast et que la réponse vient d'une adresse unicast). Donc règle spécifique obligatoire (et je confirme que ça ne marche pas chez moi sans la règle pour DHCP6).

kgersen

  • Modérateur
  • Abonné Bbox fibre
  • *
  • Messages: 9 092
  • Paris (75)
Remplacer sa Livebox par un routeur Ubiquiti Edgemax
« Réponse #2745 le: 16 juin 2016 à 14:35:15 »
la réponse DHCPv6 n'est pas de type 'related' ou 'established'  comme le retour d'une connexion tcp ou udp normale mais bien un flux propre entrant udp (port src: 547, port dst: 546). donc a traiter comme tel dans le firewall.

Le solicit emis (port src: 546, port dst: 547) est a destination de "ff02::1:2" qui est la "Link-Local Scope Multicast Address"  de "All-dhcp-agents".

Dans le cas présent, un dump du packet envoyé pourrait éclairer la situation.

voici ce qu'envoi une vrai Livebox:

Frame 305: 204 bytes on wire (1632 bits), 204 bytes captured (1632 bits) on interface 0
Ethernet II, Src: Sagemcom_xx:xx:xx (00:37:b7:xx:xx:xx), Dst: IPv6mcast_01:00:02 (33:33:00:01:00:02)
802.1Q Virtual LAN, PRI: 6, CFI: 0, ID: 832
Internet Protocol Version 6, Src: fe80::237:b7ff:xxxx:xxxx, Dst: ff02::1:2
User Datagram Protocol, Src Port: 546 (546), Dst Port: 547 (547)
DHCPv6
    Message type: Solicit (1)
    Transaction ID: 0x04372a
    Client Identifier
        Option: Client Identifier (1)
        Length: 10
        Value: 000300010037b7xxxxxx
        DUID: 000300010037b7xxxxxx
        DUID Type: link-layer address (3)
        Hardware type: Ethernet (1)
        Link-layer address: 00:37:b7:xx:xx:xx
    Option Request
        Option: Option Request (6)
        Length: 4
        Value: 000b0017
        Requested Option code: Authentication (11)
        Requested Option code: DNS recursive name server (23)
    Elapsed time
        Option: Elapsed time (8)
        Length: 2
        Value: 0508
        Elapsed time: 12880 ms
    Authentication
        Option: Authentication (11)
        Length: 22
        Value: 0000000000000000000000667469zzzzzz
        Protocol: 0
        Algorithm: 0
        RDM: 0
        Replay Detection: 0000000000000000
        Authentication Information: 667469zzzzzzz
    User Class
        Option: User Class (15)
        Length: 45
        Value: 002b46535644534c5f6c697665626f782e496e7465726e65...
    Vendor Class
        Option: Vendor Class (16)
        Length: 11
        Value: 0000040e0005736167656d
        Enterprise ID: SAGEMCOM SAS  (1038)
        vendor-class-data: sagem
    Identity Association for Prefix Delegation
        Option: Identity Association for Prefix Delegation (25)
        Length: 12
        Value: b7xxxxxx000000e1000001518
        IAID: b7xxxxxx
        T1: 3600
        T2: 5400

ou xxxxxx = @mac de la livebox et zzzzz = identifiant Orange (fti/zzzzzz).
on notera quand l'@ mac est utilisé comme identifiant (IAID) du PD.

zoc

  • Abonné Orange Fibre
  • *
  • Messages: 4 289
  • Antibes (06) / Mercury (73)
Remplacer sa Livebox par un routeur Ubiquiti Edgemax
« Réponse #2746 le: 16 juin 2016 à 14:40:10 »
on notera quand l'@ mac est utilisé comme identifiant (IAID) du PD.
En pratique avec dibbler ça marche sans préciser l'IAID du PD (je ne sais pas ce que prend dibbler dans ce cas là, je n'ai pas regardé). Et pour le DUID, celui calculé par dibbler à partir de l'@Mac du port de l'ERL convient également.


sylr

  • Abonné Orange Fibre
  • *
  • Messages: 50
  • Bordeaux 33
Remplacer sa Livebox par un routeur Ubiquiti Edgemax
« Réponse #2747 le: 16 juin 2016 à 14:46:56 »
@zoc est-ce que ton client dibbler est patché pour envoyer en priorité 6 ?