Skip to content

Instantly share code, notes, and snippets.

@paulgwebster-oe
Last active March 3, 2022 13:10
Show Gist options
  • Save paulgwebster-oe/c82f414e4e8e90cde02b9bf80a529be0 to your computer and use it in GitHub Desktop.
Save paulgwebster-oe/c82f414e4e8e90cde02b9bf80a529be0 to your computer and use it in GitHub Desktop.
dhcpv6 config
interface ng0 {
send ia-pd 0;
request domain-name-servers,domain-name,ntp-servers,sip-server-address;
# sip-domain-name,nis-server-address,nis-domain-name,nisp-server-address,nisp-domain-name,bcmcs-server-address,bcmcs-domain-namedomain-name-servers,domain-name,ntp-servers,sip-server-address,sip-domain-name,nis-server-address,nis-domain-name,nisp-server-address,nisp-domain-name;
script "/usr/local/etc/mpd5/mpd-dhcp6.script";
};
id-assoc pd {
prefix-interface ue0 {
sla-id 1;
};
};
Mar/03/2022 12:50:21: extracted an existing DUID from /var/db/dhcp6c_duid: 00:01:00:01:29:b2:a8:5b:80:fa:5b:4b:45:30
Mar/03/2022 12:50:21: <3>[interface] (9)
Mar/03/2022 12:50:21: <5>[ng0] (3)
Mar/03/2022 12:50:21: <3>begin of closure [{] (1)
Mar/03/2022 12:50:21: <3>[send] (4)
Mar/03/2022 12:50:21: <3>[ia-pd] (5)
Mar/03/2022 12:50:21: <3>[0] (1)
Mar/03/2022 12:50:21: <3>end of sentence [;] (1)
Mar/03/2022 12:50:21: <3>[request] (7)
Mar/03/2022 12:50:21: <3>[domain-name-servers] (19)
Mar/03/2022 12:50:21: <3>[,] (1)
Mar/03/2022 12:50:21: <3>[domain-name] (11)
Mar/03/2022 12:50:21: <3>[,] (1)
Mar/03/2022 12:50:21: <3>[ntp-servers] (11)
Mar/03/2022 12:50:21: <3>[,] (1)
Mar/03/2022 12:50:21: <3>[sip-server-address] (18)
Mar/03/2022 12:50:21: <3>end of sentence [;] (1)
Mar/03/2022 12:50:21: <3>comment [# sip-domain-name,nis-server-address,nis-domain-name,nisp-server-address,nisp-domain-name,bcmcs-server-address,bcmcs-domain-namedomain-name-servers,domain-name,ntp-servers,sip-server-address,sip-domain-name,nis-server-address,nis-domain-name,nisp-server-address,nisp-domain-name;] (279)
Mar/03/2022 12:50:21: <3>[script] (6)
Mar/03/2022 12:50:21: <3>["/usr/local/etc/mpd5/mpd-dhcp6.script"] (38)
Mar/03/2022 12:50:21: <3>end of sentence [;] (1)
Mar/03/2022 12:50:21: <3>end of closure [}] (1)
Mar/03/2022 12:50:21: <3>end of sentence [;] (1)
Mar/03/2022 12:50:21: <3>[id-assoc] (8)
Mar/03/2022 12:50:21: <13>[pd] (2)
Mar/03/2022 12:50:21: <13>begin of closure [{] (1)
Mar/03/2022 12:50:21: <3>[prefix-interface] (16)
Mar/03/2022 12:50:21: <5>[ue0] (3)
Mar/03/2022 12:50:21: <3>begin of closure [{] (1)
Mar/03/2022 12:50:21: <3>[sla-id] (6)
Mar/03/2022 12:50:21: <3>[1] (1)
Mar/03/2022 12:50:21: <3>end of sentence [;] (1)
Mar/03/2022 12:50:21: <3>end of closure [}] (1)
Mar/03/2022 12:50:21: <3>end of sentence [;] (1)
Mar/03/2022 12:50:21: <3>end of closure [}] (1)
Mar/03/2022 12:50:21: <3>end of sentence [;] (1)
Mar/03/2022 12:50:21: called
Mar/03/2022 12:50:21: called
Mar/03/2022 12:50:21: <3>[interface] (9)
Mar/03/2022 12:50:21: <5>[ng0] (3)
Mar/03/2022 12:50:21: <3>begin of closure [{] (1)
Mar/03/2022 12:50:21: <3>[send] (4)
Mar/03/2022 12:50:21: <3>[ia-pd] (5)
Mar/03/2022 12:50:21: <3>[0] (1)
Mar/03/2022 12:50:21: <3>end of sentence [;] (1)
Mar/03/2022 12:50:21: <3>[request] (7)
Mar/03/2022 12:50:21: <3>[domain-name-servers] (19)
Mar/03/2022 12:50:21: <3>[,] (1)
Mar/03/2022 12:50:21: <3>[domain-name] (11)
Mar/03/2022 12:50:21: <3>[,] (1)
Mar/03/2022 12:50:21: <3>[ntp-servers] (11)
Mar/03/2022 12:50:21: <3>[,] (1)
Mar/03/2022 12:50:21: <3>[sip-server-address] (18)
Mar/03/2022 12:50:21: <3>end of sentence [;] (1)
Mar/03/2022 12:50:21: <3>comment [# sip-domain-name,nis-server-address,nis-domain-name,nisp-server-address,nisp-domain-name,bcmcs-server-address,bcmcs-domain-namedomain-name-servers,domain-name,ntp-servers,sip-server-address,sip-domain-name,nis-server-address,nis-domain-name,nisp-server-address,nisp-domain-name;] (279)
Mar/03/2022 12:50:21: <3>[script] (6)
Mar/03/2022 12:50:21: <3>["/usr/local/etc/mpd5/mpd-dhcp6.script"] (38)
Mar/03/2022 12:50:21: <3>end of sentence [;] (1)
Mar/03/2022 12:50:21: <3>end of closure [}] (1)
Mar/03/2022 12:50:21: <3>end of sentence [;] (1)
Mar/03/2022 12:50:21: <3>[id-assoc] (8)
Mar/03/2022 12:50:21: <13>[pd] (2)
Mar/03/2022 12:50:21: <13>begin of closure [{] (1)
Mar/03/2022 12:50:21: <3>[prefix-interface] (16)
Mar/03/2022 12:50:21: <5>[ue0] (3)
Mar/03/2022 12:50:21: <3>begin of closure [{] (1)
Mar/03/2022 12:50:21: <3>[sla-id] (6)
Mar/03/2022 12:50:21: <3>[1] (1)
Mar/03/2022 12:50:21: <3>end of sentence [;] (1)
Mar/03/2022 12:50:21: <3>end of closure [}] (1)
Mar/03/2022 12:50:21: <3>end of sentence [;] (1)
Mar/03/2022 12:50:21: <3>end of closure [}] (1)
Mar/03/2022 12:50:21: <3>end of sentence [;] (1)
Mar/03/2022 12:50:21: called
Mar/03/2022 12:50:21: called
Mar/03/2022 12:50:21: reset a timer on ng0, state=INIT, timeo=0, retrans=891
Mar/03/2022 12:50:22: Sending Solicit
Mar/03/2022 12:50:22: a new XID (317d39) is generated
Mar/03/2022 12:50:22: set client ID (len 14)
Mar/03/2022 12:50:22: set elapsed time (len 2)
Mar/03/2022 12:50:22: set option request (len 8)
Mar/03/2022 12:50:22: set IA_PD
Mar/03/2022 12:50:22: send solicit to ff02::1:2%ng0
Mar/03/2022 12:50:22: reset a timer on ng0, state=SOLICIT, timeo=0, retrans=1091
Mar/03/2022 12:50:22: receive advertise from fe80::22e0:9cff:fe1f:e801%ng0 on ng0
Mar/03/2022 12:50:22: get DHCP option server ID, len 10
Mar/03/2022 12:50:22: DUID: 00:03:00:01:20:e0:9c:1f:e8:01
Mar/03/2022 12:50:22: get DHCP option client ID, len 14
Mar/03/2022 12:50:22: DUID: 00:01:00:01:29:b2:a8:5b:80:fa:5b:4b:45:30
Mar/03/2022 12:50:22: get DHCP option IA_PD, len 41
Mar/03/2022 12:50:22: IA_PD: ID=0, T1=604800, T2=1209600
Mar/03/2022 12:50:22: get DHCP option IA_PD prefix, len 25
Mar/03/2022 12:50:22: IA_PD prefix: 2a00:23c7:5530:3300::/56 pltime=315360000 vltime=315360000
Mar/03/2022 12:50:22: server ID: 00:03:00:01:20:e0:9c:1f:e8:01, pref=-1
Mar/03/2022 12:50:22: reset timer for ng0 to 0.997965
Mar/03/2022 12:50:23: picked a server (ID: 00:03:00:01:20:e0:9c:1f:e8:01)
Mar/03/2022 12:50:23: Sending Request
Mar/03/2022 12:50:23: a new XID (4ac8ce) is generated
Mar/03/2022 12:50:23: set client ID (len 14)
Mar/03/2022 12:50:23: set server ID (len 10)
Mar/03/2022 12:50:23: set elapsed time (len 2)
Mar/03/2022 12:50:23: set option request (len 8)
Mar/03/2022 12:50:23: set IA_PD prefix
Mar/03/2022 12:50:23: set IA_PD
Mar/03/2022 12:50:23: send request to ff02::1:2%ng0
Mar/03/2022 12:50:23: reset a timer on ng0, state=REQUEST, timeo=0, retrans=909
Mar/03/2022 12:50:23: receive reply from fe80::22e0:9cff:fe1f:e801%ng0 on ng0
Mar/03/2022 12:50:23: get DHCP option server ID, len 10
Mar/03/2022 12:50:23: DUID: 00:03:00:01:20:e0:9c:1f:e8:01
Mar/03/2022 12:50:23: get DHCP option client ID, len 14
Mar/03/2022 12:50:23: DUID: 00:01:00:01:29:b2:a8:5b:80:fa:5b:4b:45:30
Mar/03/2022 12:50:23: get DHCP option IA_PD, len 41
Mar/03/2022 12:50:23: IA_PD: ID=0, T1=604800, T2=1209600
Mar/03/2022 12:50:23: get DHCP option IA_PD prefix, len 25
Mar/03/2022 12:50:23: IA_PD prefix: 2a00:23c7:5530:3300::/56 pltime=315360000 vltime=315360000
Mar/03/2022 12:50:23: Received REPLY for REQUEST
Mar/03/2022 12:50:23: make an IA: PD-0
Mar/03/2022 12:50:23: create a prefix 2a00:23c7:5530:3300::/56 pltime=315360000, vltime=315360000
Mar/03/2022 12:50:23: invalid prefix length 56 + 16 + 64
Mar/03/2022 12:50:23: executes /usr/local/etc/mpd5/mpd-dhcp6.script
Mar/03/2022 12:50:23: script "/usr/local/etc/mpd5/mpd-dhcp6.script" terminated
Mar/03/2022 12:50:23: removing an event on ng0, state=REQUEST
Mar/03/2022 12:50:23: removing server (ID: 00:03:00:01:20:e0:9c:1f:e8:01)
Mar/03/2022 12:50:23: got an expected reply, sleeping.
ng0: flags=88d1<UP,POINTOPOINT,RUNNING,NOARP,SIMPLEX,MULTICAST> metric 0 mtu 1492
inet6 fe80::82fa:5bff:fe4b:4530%ng0 prefixlen 64 scopeid 0x7
inet 86.175.79.91 --> 172.16.12.106 netmask 0xffffffff
nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
#!/usr/bin/env perl
use warnings;
use strict;
use v5.28.0;
use Data::Dumper;
# Open a log handle
open(my $fh,'>>','/var/log/mpd.log');
say $fh "DHCPv6!";
my $net;
#my @keys = qw(interface type address gateway unknown:1 ns1 ns2 unknown:2 unknown:3);
my @keys = ();
my $known_key_count = scalar(@keys);
my $passed_arg_count = scalar(@ARGV);
foreach my $i (1..$passed_arg_count) {
my $index = $i-1;
my $index_name = 'ipv6';
$net->{"$index_name:$index"} = $ARGV[$index];
}
say $fh "ARGS Detected: ".Dumper($net);
say $fh "ENVS Detected: ".Dumper(%ENV);
if ($fh) { close($fh); }
exit 0;
Internet6:
Destination Gateway Flags Netif Expire
::/96 ::1 UGRS lo0
::1 link#2 UHS lo0
::ffff:0.0.0.0/96 ::1 UGRS lo0
fe80::/10 ::1 UGRS lo0
fe80::%re0/64 link#1 U re0
fe80::82fa:5bff:fe4b:4530%re0 link#1 UHS lo0
fe80::%lo0/64 link#2 U lo0
fe80::1%lo0 link#2 UHS lo0
fe80::%ue0/64 link#3 U ue0
fe80::a2ce:c8ff:fe15:2474%ue0 link#3 UHS lo0
fe80::%wlan0/64 link#4 U wlan0
fe80::228:f8ff:febe:4c5e%wlan0 link#4 UHS lo0
fe80::%ng0/64 link#7 U ng0
fe80::82fa:5bff:fe4b:4530%ng0 link#7 UHS lo0
ff02::/16 ::1 UGRS lo0
DHCPv6!
ARGS Detected: $VAR1 = undef;
ENVS Detected: $VAR1 = 'PDINFO';
$VAR2 = '2a00:23c7:5530:3300::/56';
$VAR3 = 'REASON';
$VAR4 = 'REQUEST';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment