# mv /usr/local/sbin/dhcp6c /usr/local/sbin/dhcp6c.bak
# curl https://wiki.virtit.fr/lib/exe/fetch.php/kb:linux:pfsense:dhcp6c -o /usr/local/sbin/dhcp6c.new
# chmod +x /usr/local/sbin/dhcp6c.new
# ln -s /usr/local/sbin/dhcp6c /usr/local/sbin/dhcp6c.new
General ConfigurationRemonter ensuite à DHCP6 Client Configuration et cocher Configuration Override, compléter Configuration File Override avec la valeur "/usr/local/etc/dhcp6c_wan_custom.conf".
- Enable: yes
- Description: FTTH
- IPv4 Configuration Type: DHCP
- IPv6 Configuration Type: DHCP6
- MAC Address: La MAC de la box
- MTU: vide
- MSS: vide
- Speed and Duplex: Default
DHCP Client Configuration
- Options: cocher uniquement "Configuration Override"
- Configuration File Override: /usr/local/etc/dhcp4c_wan_custom.conf
DHCP6 Client Configuration
- Options: d'abord ne cocher que "Advanced Configuration" et paramétrer comme suit:
- Use IPv4 connectivity as parent interface: no
- Request only an IPv6 prefix: no
- DHCPv6 Prefix Delegation size: 64
- Send IPv6 prefix hint: no
- Debug: no
- Do not wait for a RA: yes
- Do not allow PD/Address release: no
Advanced DHCP6 Client Configuration
- Information only: no
- Send options: ia-pd 1, raw-option 16 00:00:a0:0c:00:40:6e:65:75:66:62:6f:78:5f:4e:42:36:56:41:43:2d:46:58:43 (c'est une valeur générique mais fonctionnelle)
- Request Options: domain-name-servers, domain-name
- Scripts: vide
- Identity Association Statement Non-Temporary Address Allocation: no
- Identity Association Statement Prefix Delegation: yes, id-assoc pd ID = 1, IPv6 prefix = ::/0
- Prefix interface statement sla-len = 8
- Prefix Interface: FTTH
Reserved Networks
- Block private networks and loopback addresses: yes
- Block bogon networks: yes
interface "igc1" {
supersede interface-mtu 0;
send host-name "";
send dhcp-class-identifier "neufbox_NB6VAC-FXC";
request subnet-mask, routers, domain-name-servers, host-name, merit-dump, domain-name, root-path, broadcast-address, nis-domain, ntp-servers;
require subnet-mask, routers, merit-dump, nis-domain, domain-name-servers;
script "/usr/local/sbin/pfSense-dhclient-script";
}
interface igc1 {
send raw-option 16 00:00:a0:0c:00:40:6e:65:75:66:62:6f:78:5f:4e:42:36:56:41:43:2d:46:58:43;
send ia-pd 1;
request domain-name-servers;
script "/var/etc/dhcp6c_wan_dhcp6withoutra_script.sh";
};
id-assoc pd 1{
prefix ::/00 0 0;
prefix-interface igc0{
sla-id 10;
sla-len 8;
};
};
General Configuration
- Enable: yes
- Description: FTTLA
- IPv4 Configuration Type: DHCP
- IPv6 Configuration Type: None
- MAC Address: vide
- MTU: vide
- MSS: vide
- Speed and Duplex: Default
DHCP Client Configuration
- Tout laisser par défaut
Reserved Networks
- Block private networks and loopback addresses: yes
- Block bogon networks: yes
Protocol | Source | Port | Destination | Port | Gateway | Queue | Description | Options |
IPv6 UDP | * | * | * | 546-547 | * | none | Allow DHCPv6 Requests | None |
IPv4 IGMP | * | * | 224.0.0.0/4 | * | * | none | Allow IGMP Multicast Traffic | Allow IP options |
IPv4 PIM | * | * | 224.0.0.0/4 | * | * | none | Allow PIM Multicast Traffic | Allow IP options |
IPv4 UDP | * | * | 224.0.0.0/4 | * | * | none | Allow UDPMulticast Traffic | Allow IP options |
IPv4 TCP | * | * | * | * | 1287-1290 | none | Allow additional ports for STB | Allow IP options |
Interface | Description | Type | Threshold | Networks |
FTTH | FTTH_UP | Upstream Interface | 1 | 0.0.0.0/0 |
LAN | FTTH_DOWN | Downstream Interface | 1 | 0.0.0.0/0 |
pkg install lighttpd
On va ensuite configurer le service:cd /usr/local/etc/lighttpd/
On vérifie qu'il y a bien un fichier lighttpd.conf.sample dans le dossier, au cas où. Puis on édite lighttpd.conf pour avoir uniquement le contenu suivant:server.modules = (On s'assure que le dossier /var/www existe, et on crée l'arborescence:
"mod_access",
"mod_alias",
"mod_redirect",
"mod_rewrite"
)
server.document-root = "/var/www"
server.upload-dirs = ( "/tmp" )
server.errorlog = "/var/log/lighttpd/error.log"
server.pid-file = "/var/run/lighttpd.pid"
server.username = "www"
server.groupname = "www"
server.tag = "lighttpd"
index-file.names = ( "index.php" )
url.access-deny = ( "~", ".inc" )
static-file.exclude-extensions = ( ".php" )
server.dir-listing = "disable"
include "conf.d/mime.conf"
server.port = 80
$HTTP["scheme"] == "http" {
$HTTP["url"] =~ "^(/api/1.0/.*)" {
url.rewrite-once = ( "/?method=(.*)$" => "/api/1.0/$1.xml")
}
}
mkdir -p /var/www/api/1.0/
cd /var/www/api/1.0/
On doit retrouver les fichiers suivants, à récupérer depuis la box SFR avec les URL associées:Fichier | URL |
system.getInfo.xml | http://192.168.1.1/api/1.0/?method=system.getInfo |
ftth.getInfo.xml | http://192.168.1.1/api/1.0/?method=ftth.getInfo |
wan.getInfo.xml | http://192.168.1.1/api/1.0/?method=wan.getInfo |
lan.getHostsList.xml | http://192.168.1.1/api/1.0/?method=lan.getHostsList |
tv.getInfo.xml | http://192.168.1.1/api/1.0/?method=tv.getInfo |
usb.getInfo.xml | http://192.168.1.1/api/1.0/?method=usb.getInfo |
<rsp stat="ok" version="1.0">
<host type="stb" name="STB7" ip="<IP LAN du décodeur>" mac="<MAC du décodeur>" iface="lan1" probe="60" alive="2843" status="online"/>
</rsp>
Et j'ai créé une réservation d'IP dans Services > DHCP Server > LAN > DHCP Static Mappings for this Interface<?php
header('Content-Type: application/xml; charset=utf-8');
if (isset($_GET['method'])){
$method = $_GET['method'];
switch ($method) {
case "system.getInfo":
echo file_get_contents('system.getInfo.xml');
break;
case 'lan.getHostsList':
echo file_get_contents('lan.getHostsList.xml');
break;
case 'wan.getInfo':
echo file_get_contents('wan.getInfo.xml');
break;
case 'ftth.getInfo':
echo file_get_contents('ftth.getInfo.xml');
break;
case 'usb.getInfo':
echo file_get_contents('usb.getInfo.xml');
break;
case 'tv.getInfo':
echo file_get_contents('tv.getInfo.xml');
break;
}
return;
}
?>
On teste que tout fonctionne en lançant la commande:/usr/local/sbin/lighttpd -Df /usr/local/etc/lighttpd/lighttpd.conf
Et on tente d'accéder aux pages avec les URLs citées plus haut. Si tout fonctionne, on ajoute le service lighttpd au démarrage, pour cela System > Package Manager > Available Packages et rechercher "Shellcmd", l'installer.