Auteur Sujet: Ubiquiti ER Ipv6 dhcp6 en 2.X  (Lu 29323 fois)

0 Membres et 1 Invité sur ce sujet

KalNightmare

  • Abonné Orange Fibre
  • *
  • Messages: 128
  • Massy 91
Ubiquiti ER Ipv6 dhcp6 en 2.X
« le: 24 juillet 2019 à 14:10:50 »
Bonjour,

Pour ceux que ça intéresse, j'ai commencé le travail pour utiliser le client dhcp fourni dans les version 2.X pour avoir l'ipv6.
Bien sur, il faut un switch qui applique la COS.

Je suis partie de ça https://github.com/dario-spagnolo/ipv6-scripts et du script radvd fait par zoc pour dibbler.


Le fichier /etc/dhcp3/dhclient6_eth0_832.conf qui reproduit le fonctionnement de la livebox
option dhcp6.auth code 11 = string;
option dhcp6.vendorclass code 16 = string;
option dhcp6.userclass code 15 = string;

#Replace eth0 with your external interface (VLAN must be 832 for Orange)
interface "eth0.832" {
#Orange France specific options
        send dhcp6.vendorclass  00:00:04:0e:00:05:73:61:67:65:6d;
        send dhcp6.userclass 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:34;
send dhcp6.vendor-opts 00:00:05:58:00:06:00:0e:49:50:56:36:5f:52:45:51:55:45:53:54:45:44;       

        #Authentication to Orange France DHCP server (meme valeur pour ipv4)
send dhcp6.auth 00:00:00:00:00:00:00:00:00:00:00:1a:09:00:00:xx:xx....;
       
        #Replace xx:xx:xx:xx:xx:xx with the MAC address of your external interface
send dhcp6.client-id 00:03:00:01:xx:xx:xx:xx:xx:xx;

request dhcp6.auth, dhcp6.vendor-opts, dhcp6.name-servers, dhcp6.domain-search;
}

Le fichier  /etc/dhcp3/dhclient-exit-hooks.d/dhclient-ipv6
#!/bin/bash

# vim:tw=80:tabstop=2:shiftwidth=2

# Copyright (c) 2012-present, Phil Dibowitz <phil@ipom.com>
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
#  * Redistributions of source code must retain the above copyright notice,
#    this list of conditions and the following disclaimer.
#  * Redistributions in
#    binary form must reproduce the above copyright notice, this list of
#    conditions and the following disclaimer in the documentation and/or other
#    materials provided with the distribution.
#  * Neither the name of the author nor the names of its contributors may be
#    used to endorse or promote products derived from this software without
#    specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.

#
# You can find the latest version of this at:
#   https://github.com/jaymzh/v6-gw-scripts
#
# Will, given a 'dhclient -6 -P ...' on $EXT_IFACE and assign the prefix
# given to the $INT_IFACE, and twiddle radvd.
#
# For radvd, it takes /etc/radvd.conf.tmpl, replaces "__PREFIX__" with your
# prefix, and - if it's different from /etc/radvd.conf - replaces the config
# file and restarts the daemon.
#

ipv6_prefix_setup() {
  current_ip=$(ip -6 addr show dev eth1 scope global |\
               awk '/inet6/ {print $2}')
  current_prefix=$(echo $current_ip | sed -e 's@::1/64@::/64@')

  new_ip=$(echo $new_ip6_prefix | sed -e 's@::/56@::1/64@g')

  echo "Current IP :" $current_ip >> /tmp/dhclient6.log
  echo "New IP :" $new_ip >> /tmp/dhclient6.log

  if [ "$new_ip" != "$current_ip" ]
  then
     if [ "$current_ip" != "" ]
     then
       ip addr delete "$current_ip" dev eth1
     fi

  ip addr add "$new_ip" dev eth1
  service radvd restart >/dev/null 2>&1
  fi
}

#if [ "$interface" != "$EXT_IFACE" ] ; then
#  return
#fi

case "$reason" in
  BOUND6|REBIND6)
    # We will get called twice here - once for the temp address
    # and once for the prefix. We only care about the prefix.
    if [ ! -z "$new_ip6_prefix" ] ; then
  echo -e "\n\n\nEntering ipv6-setup" >> /tmp/dhclient6.log
  echo "Received prefix : " $new_ip6_prefix  >> /tmp/dhclient6.log
      ipv6_prefix_setup
    fi
    ;;
esac

Et le dernier fichier /etc/systemd/system/dhclient6.service (penser a changer si le wan n'est pas eth0)
[Unit]
Description=dhclient for sending DUID IPv6
Wants=network.target
Before=network.target

[Service]
Type=forking
ExecStart=/sbin/dhclient -6 -P -nw -cf /etc/dhcp3/dhclient6_eth0_832.conf -pf /var/run/dhclient6_eth0_832.pid -lf /var/run/dhclient6_eth0_832.leases eth0.832

[Install]
WantedBy=multi-user.target

une fois les fichiers créer :
systemctl daemon-reload
systemctl start dhclient6
systemctl enable dhclient6

zoc

  • Abonné Orange Fibre
  • *
  • Messages: 4 283
  • Antibes (06) / Mercury (73)
Ubiquiti ER Ipv6 dhcp6 en 2.X
« Réponse #1 le: 24 juillet 2019 à 14:27:33 »
Très beau travail.

Du coup, pour être en mesure d'utiliser un firmware sans aucune modification, et sans un switch pour la CoS, il ne manque plus que l'inclusion dans le noyau des "Network Priority cgroup" ( https://www.kernel.org/doc/Documentation/cgroup-v1/net_prio.txt )

pinomat

  • Abonné Orange Fibre
  • *
  • Messages: 209
  • THIONVILLE 57
Ubiquiti ER Ipv6 dhcp6 en 2.X
« Réponse #2 le: 09 août 2019 à 12:11:35 »
Bonjour,

Un grand merci pour ce tuto IPv6 que je valide à 100%. Cela fonctionne parfaitement, même si le service dhclient6 ne démarre pas correctement après un redémarrage du router (le service démarre après dhcpd3 dans ma config), faudrait creuser quand les VLAN sont correctement montés.
Les seules manipulations que j'ai effectué après ma configuration de base pour Internet et la TV sont : création des fichiers sur base de la configuration KalNightmare, le marquage CoS, l'ajout des lignes se trouvant dans le fichier config.txt (à modifier selon  et un reboot de l'ER-6P.

ERRATUM 27/08/2019 : La configuration ci-dessous n'est pas stable en cas de changement de configuration. J'ai apporté une correction ici : https://lafibre.info/remplacer-livebox/ubiquiti-er-ipv6-dhcp6-en-2-x/msg678674/#msg678674

Pour mes tests, j'ai utilisé parfois ces quelques fonctions dhcpdv6 :
release dhcpv6-pd interface eth4.832
delete dhcpv6-pd duid
renew dhcpv6-pd interface eth4.832

Erreur dhclient6 (dhclient6.png) :
ubnt@ubnt:~$ sudo -i systemctl status dhclient6
* dhclient6.service - dhclient for sending DUID IPv6
   Loaded: loaded (/etc/systemd/system/dhclient6.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Thu 2016-11-03 18:16:46 CET; 2 years 9 months ago
  Process: 278 ExecStart=/sbin/dhclient -6 -P -nw -cf /etc/dhcp3/dhclient6_eth4_832.conf -pf /var/run/

Nov 03 18:16:46 ubnt systemd[1]: Starting dhclient for sending DUID IPv6...
Nov 03 18:16:46 ubnt dhclient[278]: Cannot find device "eth4.832"
Nov 03 18:16:46 ubnt systemd[1]: dhclient6.service: Control process exited, code=exited status=1
Nov 03 18:16:46 ubnt systemd[1]: Failed to start dhclient for sending DUID IPv6.
Nov 03 18:16:46 ubnt systemd[1]: dhclient6.service: Unit entered failed state.
Nov 03 18:16:46 ubnt systemd[1]: dhclient6.service: Failed with result 'exit-code'.
ubnt@ubnt:~$

Configuration des interfaces du routeur (à corriger si configuration différente) :
ETH0 (LAN)
ETH4 (WAN) / ETH4.832 (VLAN Internet) / ETH4.840 (VLAN IPTV)

Configuration à ajouter au router ER6-P (config.txt) :
#### Rechercher ####!!!! pour les informations dépendant de la configuration/fournisseur #

###########################################################
### Configuration IPv6                                  ###
### RQ : Nécessite de forcer le marquage CoS 6          ###
### pour les flux DHCPv6 en sortie sur le switch/router ###
###########################################################

edit firewall ipv6-name WAN6_IN
set default-action drop
set rule 10 action accept
set rule 10 description "allow established"
set rule 10 protocol all
set rule 10 state established enable
set rule 10 state related enable

set rule 20 action accept
set rule 20 description "allow ICMPv6"
set rule 20 protocol icmpv6

set rule 30 action drop
set rule 30 description "drop invalid packets"
set rule 30 protocol all
set rule 30 state invalid enable
top

edit firewall ipv6-name WAN6_LOCAL
set default-action drop
set rule 10 action accept
set rule 10 description "allow established"
set rule 10 protocol all
set rule 10 state established enable
set rule 10 state related enable

set rule 20 action accept
set rule 20 description "allow ICMPv6"
set rule 20 protocol icmpv6

set rule 30 action accept
set rule 30 description "allow DHCPv6 client/server"
set rule 30 destination port 547
set rule 30 source port 546
set rule 30 protocol udp

set rule 40 action drop
set rule 40 description "drop invalid packets"
set rule 40 protocol all
set rule 40 state invalid enable
top

####!!!! Remplacer l'interface eth4 (WAN) si nécesssaire ####
set interfaces ethernet eth4 vif 832 firewall in ipv6-name WAN6_IN
set interfaces ethernet eth4 vif 832 firewall local ipv6-name WAN6_LOCAL

####!!!! Remplacer l'interface eth0 (LAN) si nécesssaire ####
set interfaces ethernet eth0 ipv6 address autoconf

###########################################
# active le client ipv6 sur eth4.832      #
# configure dhcpv6-pd sur eth4.832        #
###########################################
####!!!! Remplacer par le préfixe /56 délégué d'orange ####
####!!!! Remplacer l'interface eth4 (WAN) si nécesssaire ####
set interfaces ethernet eth4 vif 832 ipv6 router-advert prefix xxxx:xxxx:xxxx::/56
set interfaces ethernet eth4 vif 832 dhcpv6-pd pd 0 prefix-length 56
set interfaces ethernet eth4 vif 832 dhcpv6-pd pd 0 interface eth0 host-address ::1
set interfaces ethernet eth4 vif 832 dhcpv6-pd pd 0 interface eth0 prefix-id ::1
set interfaces ethernet eth4 vif 832 dhcpv6-pd pd 0 interface eth0 service slaac

###########################################
# paramétrage de la route par défaut      #
###########################################
####!!!! Remplacer l'interface eth4 (LAN) si nécesssaire ####
set protocols static route6 ::/0 next-hop fe80::ba0:bab interface eth4.832

##########################################
# paramétrage d'un réseau ipv6 pour eth0 #
##########################################
####!!!! Remplacer par le préfixe /56 délégué d'Orange xxxx:xxxx:xxxx + ajouté 8 bits (yyyy) au choix ####
####!!!! Remplacer l'interface eth0 (LAN) si nécesssaire ####
set interfaces ethernet eth0 ipv6 router-advert prefix xxxx:xxxx:xxxx:yyyy:1::/64
commit;save;exit

#############################################
# Reboot obligatoire après config dhclient6 #
#############################################

Je ferai un post avec un Tuto complet Fibre Orange Internet + TV + IPv6 SANS LIVEBOX. Sachant que, quand je parle télé, j'ai testé le IPTV+replay+Netflix+VoD.

Ma config :
Router : EdgeMax Ubiquiti ER-6P v2.0.6
Switch : Cisco SG350-28P
Module SFP Fibre Orange
« Modifié: 27 août 2019 à 16:15:22 par pinomat »

nicox11

  • Abonné Orange Fibre
  • *
  • Messages: 190
  • Toulouse (31)
Ubiquiti ER Ipv6 dhcp6 en 2.X
« Réponse #3 le: 11 août 2019 à 14:43:35 »
Très intéressant. Plus qu'à attendre que la branche 2.X soit plus stable.

fttmeh

  • Abonné Orange Fibre
  • *
  • Messages: 242
  • Hauts-de-Seine
Ubiquiti ER Ipv6 dhcp6 en 2.X
« Réponse #4 le: 18 août 2019 à 15:00:58 »
Bonjour,

Pour ceux que ça intéresse, j'ai commencé le travail pour utiliser le client dhcp fourni dans les version 2.X pour avoir l'ipv6.
Bien sur, il faut un switch qui applique la COS.


Merci !

Avec cela je n'ai plus besoin d'installer dibbler.

Comme en IPv6 on peut utiliser ip6tables pour forcer la COS à 6, j'ai modifié le fichier de configuration de démarrage de dhclient pour ne plus avoir besoin d'un switch:

(L'ONT est branché sur eth1)

#/etc/systemd/system/dhclient6.service
[Unit]
Description=dhclient for sending DUID IPv6
After=network.target

[Service]
Type=forking
ExecStartPre=/sbin/ip6tables -t mangle -F
ExecStartPre=/sbin/ip6tables -t mangle -I POSTROUTING -p udp --dport dhcpv6-server -j CLASSIFY --set-class 0:6
ExecStart=/sbin/dhclient -6 -P -nw -cf /etc/dhcp3/dhclient6_eth1_832.conf -pf /var/run/dhclient6_eth1_832.pid -lf /var/run/dhclient6_eth1_832.leases eth1.832
NonBlocking=yes                               
Restart=always
RestartSec=60

[Install]
WantedBy=multi-user.target

En partant de ton script, je l'ai modifié pour prendre en compte plusieurs VLANs internes. L'objectif est de donner un prefix /64 à chacune.

/etc/dhcp3/dhclient-exit-hooks.d/dhclient-ipv6
#  /etc/dhcp3/dhclient-exit-hooks.d/dhclient-ipv6

# Interfaces that should obtain a /64 prefix
ipv6_interfaces=(eth0.100 eth0.200 eth0.300)
int_addr="::1"

###

ipv6_prefix_setup() {
# $1 is the ethernet interface
# $2 is the suffix to use
ethiface=$1
suffix=$2

current_ip=$(ip -6 addr show dev $ethiface scope global | awk '/inet6/ {print $2}' | grep -v '^fd' )
current_prefix=$(echo $current_ip | sed -e 's@::.*/64@::/64@')
 
new_ip=$( echo $new_ip6_prefix | sed -e 's/00::\/.*//g' )
new_ip="$new_ip$suffix"

if [ "$new_ip" != "$current_ip" ]
then
if [ "$current_ip" != "" ]
then
/sbin/ip -6 addr delete "$current_ip" dev $ethiface
fi
/sbin/ip -6 addr add "$new_ip" dev $ethiface
 
fi
}

case "$reason" in
  BOUND6|REBIND6)
    # We will get called twice here - once for the temp address
    # and once for the prefix. We only care about the prefix.
    if [ ! -z "$new_ip6_prefix" ] ; then
for interface in "${ipv6_interfaces[@]}"
do
suffix=$( echo ${interface} | /usr/bin/md5sum | awk '{ print substr($1,3,2) }' )
suffix="$suffix$int_addr/64"
ipv6_prefix_setup ${interface} $suffix
done
/bin/systemctl restart radvd.service >/dev/null 2>&1
    fi
    ;;
esac
« Modifié: 18 août 2019 à 18:19:16 par fttmeh »

barichon

  • Abonné Free fibre
  • *
  • Messages: 65
  • Levallois-Perret 92300
Ubiquiti ER Ipv6 dhcp6 en 2.X
« Réponse #5 le: 22 août 2019 à 20:35:15 »
Hello,

Question rapide, ou trouver le /56 délégué d'Orange autre que dans la livebox qui est dans ma cave depuis 3 ans ?

Par avance merci pour votre aide.

Catalyst

  • Abonné FAI autre
  • *
  • Messages: 191
Ubiquiti ER Ipv6 dhcp6 en 2.X
« Réponse #6 le: 22 août 2019 à 21:45:05 »
Hello,

Question rapide, ou trouver le /56 délégué d'Orange autre que dans la livebox qui est dans ma cave depuis 3 ans ?

Par avance merci pour votre aide.

De mémoire, le préfixe délégué à la LBox est le 1er des 256 subnets /64  du /56. Par exemple, si tu connais le /64 de la LBox :

2A01:CB1D:1A1:9600::/64 - préfixe délégué à la LBox
2A01:CB1D:1A1:96::/56 - préfixe alloué à la ligne
2A01:CB1D:1A1:96FF::/64 - 256° et dernier préfixe alloué à la ligne


En pingant 2A01:CB1D:1A1:96FF::1 depuis l'extérieur, si ça arrive sur le routeur c'est confirmé.

Edit : prefixes corrigés ...
« Modifié: 22 août 2019 à 22:36:02 par Catalyst »

barichon

  • Abonné Free fibre
  • *
  • Messages: 65
  • Levallois-Perret 92300
Ubiquiti ER Ipv6 dhcp6 en 2.X
« Réponse #7 le: 22 août 2019 à 22:09:49 »
aie pas certain de comprendre l'ipv6 de livebox est: 2a01:cb00:f01:bd00::1/64

fttmeh

  • Abonné Orange Fibre
  • *
  • Messages: 242
  • Hauts-de-Seine
Ubiquiti ER Ipv6 dhcp6 en 2.X
« Réponse #8 le: 22 août 2019 à 22:31:26 »
aie pas certain de comprendre l'ipv6 de livebox est: 2a01:cb00:f01:bd00::1/64

Ton prefix doit être 2a01:cb00:f01:bd::/56, tu peux utiliser de 2a01:cb00:f01:bd00::/64 jusqu'à 2a01:cb00:f01:bdff::/64

barichon

  • Abonné Free fibre
  • *
  • Messages: 65
  • Levallois-Perret 92300
Ubiquiti ER Ipv6 dhcp6 en 2.X
« Réponse #9 le: 22 août 2019 à 23:21:01 »
Merci, ipv6-test ne me valide toujours pas la connectivité IPv6  :-\

Ci-joint mes config, vous pouvez me filer un coup de main svp ::)?

ETH0 LAN
ETH1: WAN

J'ai un switch qui est bracnhé sur ETH0 (sans cos6), j'ai installé les ligne iptable comme indiqué ci-dessus pour faire la cos6 au niveau de mon ubiquity.

Ici la sortie du status dhclient6:

root@ubnt:/home/ubnt# systemctl status dhclient6
* dhclient6.service - dhclient for sending DUID IPv6
   Loaded: loaded (/etc/systemd/system/dhclient6.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2019-08-24 08:41:45 CEST; 20min ago
 Main PID: 31298 (dhclient)
   CGroup: /system.slice/dhclient6.service
           `-31298 /sbin/dhclient -6 -P -nw -cf /etc/dhcp3/dhclient6_eth1_832.conf -pf /var/run/dhclient6_eth1_832.pid -lf /var/run/dhclient6_eth1_832.leases eth1.832

Aug 24 08:43:58 ubnt dhclient[31298]: XMT: Solicit on eth1.832, interval 116580ms.
Aug 24 08:45:54 ubnt dhclient[31298]: XMT: Solicit on eth1.832, interval 120200ms.
Aug 24 08:47:55 ubnt dhclient[31298]: XMT: Solicit on eth1.832, interval 109860ms.
Aug 24 08:49:45 ubnt dhclient[31298]: XMT: Solicit on eth1.832, interval 113160ms.
Aug 24 08:51:38 ubnt dhclient[31298]: XMT: Solicit on eth1.832, interval 113690ms.
Aug 24 08:53:32 ubnt dhclient[31298]: XMT: Solicit on eth1.832, interval 124200ms.
Aug 24 08:55:36 ubnt dhclient[31298]: XMT: Solicit on eth1.832, interval 122350ms.
Aug 24 08:57:39 ubnt dhclient[31298]: XMT: Solicit on eth1.832, interval 119860ms.
Aug 24 08:59:38 ubnt dhclient[31298]: XMT: Solicit on eth1.832, interval 129350ms.
Aug 24 09:01:48 ubnt dhclient[31298]: XMT: Solicit on eth1.832, interval 127250ms.

P.S: J'ai une IPV6 sur eth0

Plz help :(
« Modifié: 24 août 2019 à 09:07:43 par barichon »

barichon

  • Abonné Free fibre
  • *
  • Messages: 65
  • Levallois-Perret 92300
Ubiquiti ER Ipv6 dhcp6 en 2.X
« Réponse #10 le: 25 août 2019 à 22:46:39 »
Bon... j'abandonne, j'ai passé mon week-end dessus... rien à faire ça ne fonctionne pas.

 >:(

pinomat

  • Abonné Orange Fibre
  • *
  • Messages: 209
  • THIONVILLE 57
Ubiquiti ER Ipv6 dhcp6 en 2.X
« Réponse #11 le: 26 août 2019 à 08:53:20 »
Bon... j'abandonne, j'ai passé mon week-end dessus... rien à faire ça ne fonctionne pas.

 >:(

Bonjour,

J'ai effectivement le même problème. J'ai changé d'interface WAN, refait uniquement la configuration IPv6 et le routage a, semble-t-il sauté, impossible à remettre en route.
Pour ton info, j'étais partie sur une configuration vierge (hard reset) pour que cela fonctionne. Je regarderai ça dans les prochaines semaines. Je soupçonne un problème de routage, mais il faut trouver qui fait quoi exactement...  Les interfaces du routeur et mon PC récupère bien des adresses IPv6, le ping résoud bien les DNS de google, mais le retour ne se fait pas... Dans show ipv6 neighbors, on a surtout ça : fe80::ba0:bab dev eth5.832  FAILED ce qui explique pourquoi on a plus d'IPv6.

Bon courage.