aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoachim Tingvold <joachim@tingvold.com>2017-04-07 21:21:43 +0200
committerJoachim Tingvold <joachim@tingvold.com>2017-04-07 21:21:43 +0200
commit80e7346876c24dc68ff10fd3ec77b62165ed501a (patch)
tree66a8b6eeb3a1aafc3949cef35662d8737dcc76cc
parent6bea366658a912a777be2a3748fe49475f7ce73f (diff)
Fix FAP-config in DHCP.
-rwxr-xr-xbootstrap/make-dhcpd.pl66
-rwxr-xr-xbootstrap/make-dhcpd6.pl10
-rwxr-xr-xinclude/config.pm.dist10
3 files changed, 74 insertions, 12 deletions
diff --git a/bootstrap/make-dhcpd.pl b/bootstrap/make-dhcpd.pl
index 3dbefbd..7bd1a5c 100755
--- a/bootstrap/make-dhcpd.pl
+++ b/bootstrap/make-dhcpd.pl
@@ -19,6 +19,7 @@ my $dhcpd_conf = $dhcpd_base . "dhcpd.conf";
my $dhcpd_pxeconf = $dhcpd_base . "v4-pxe-boot.conf";
my $dhcpd_wlc_conf = $dhcpd_base . "v4-wlc.conf";
my $dhcpd_voip_conf = $dhcpd_base . "v4-voip.conf";
+my $dhcpd_fap_conf = $dhcpd_base . "v4-fap.conf";
# primary
my $pri_range = Net::IP->new($nms::config::pri_net_v4) or die ("pri_range fail");
@@ -101,6 +102,7 @@ include "/etc/dhcp/v4-generated-include.conf";
include "$dhcpd_pxeconf";
include "$dhcpd_wlc_conf";
include "$dhcpd_voip_conf";
+include "$dhcpd_fap_conf";
EOF
close DHCPDFILE;
@@ -144,7 +146,7 @@ class "access-points" {
# I.e if "Access Point", you have to use (0, 12)
match if substring (option vendor-class-identifier, 0, 12) = "Access Point";
vendor-option-space WLC;
- option WLC.controller-address "$nms::config::wlc1";
+ option WLC.controller-address "$nms::config::wlc1_v4";
}
EOF
close WLCFILE;
@@ -164,18 +166,72 @@ class "cisco-voip-lan" {
match if substring (option vendor-class-identifier, 0, 28) = "Cisco Systems, Inc. IP Phone";
vendor-option-space CiscoVOIP;
log( info, concat( "LOLOPHONE: " , option vendor-class-identifier ));
- option CiscoVOIP.cm-tftp-server $nms::config::voip1;
- next-server $nms::config::voip1;
+ option CiscoVOIP.cm-tftp-server $nms::config::voip1_v4;
+ next-server $nms::config::voip1_v4;
}
class "cisco-voip-wlan" {
match if substring (option vendor-class-identifier, 0, 33) = "Cisco Systems Inc. Wireless Phone";
vendor-option-space CiscoVOIP;
log( info, concat( "BANANAPHONE: " , option vendor-class-identifier ));
- option CiscoVOIP.cm-tftp-server $nms::config::voip1;
- next-server $nms::config::voip1;
+ option CiscoVOIP.cm-tftp-server $nms::config::voip1_v4;
+ next-server $nms::config::voip1_v4;
}
EOF
close VOIPFILE;
}
+# Create FAP/Gondul config
+if ( not -f $dhcpd_fap_conf )
+{
+ print STDERR "Creating file " . $dhcpd_fap_conf . "\n";
+ open FAPFILE, ">" . $dhcpd_fap_conf or die ( $! . " " . $dhcpd_fap_conf);
+
+ print FAPFILE <<"EOF";
+# Define structure of option 43 ( Zero Touch Protocol options)
+option space ztp;
+#option ztp.image-file-name code 0 = text;
+option ztp.config-file-name code 1 = text;
+option ztp.image-file-type code 2 = text;
+option ztp.transfer-mode code 3 = text;
+option ztp.alt-image-file-name code 4 = text;
+option ztp-encapsulation code 43 = encapsulate ztp;
+
+# define option 150 - TFTP server (used for defining HTTP server for option 43)
+option option-150 code 150 = { ip-address };
+
+# define option 60 - used for classifying ZTP clients ("vendor class identifier")
+option vendor-class-identifier code 60 = text;
+
+# set short leasetime, so that it times out at reboot
+default-lease-time 120;
+max-lease-time 120;
+
+# define ranges
+group {
+ # No DDNS
+ ddns-updates off;
+ ddns-hostname = none;
+ ddns-domainname = none;
+
+ # supershort leasetime
+ default-lease-time 120;
+ max-lease-time 120;
+
+ # ZTP Settings
+ option option-150 $nms::config::fap_server_v4;
+ option tftp-server-name "$nms::config::fap_server_v4";
+ option ztp.transfer-mode "http";
+ option ztp.config-file-name = concat("api/config/", (option agent.circuit-id));
+
+ #option ztp.image-file-name "files/jinstall-ex-2200-14.1X53-D15.2-domestic-signed.tgz";
+
+
+}
+
+EOF
+ close FAPFILE;
+}
+
+
+
diff --git a/bootstrap/make-dhcpd6.pl b/bootstrap/make-dhcpd6.pl
index f678c14..dc3f8b9 100755
--- a/bootstrap/make-dhcpd6.pl
+++ b/bootstrap/make-dhcpd6.pl
@@ -134,7 +134,7 @@ set vendor-string = option vendor-class-identifier;
class "access-points" {
match if substring (option vendor-class-identifier, 0, 8) = "Access Point";
vendor-option-space AP;
- option AP.server-address $nms::config::wlc1;
+ option AP.server-address $nms::config::wlc1_v6;
}
EOF
close WLCFILE;
@@ -154,16 +154,16 @@ class "cisco-voip-lan" {
match if substring (option vendor-class-identifier, 0, 28) = "Cisco Systems, Inc. IP Phone";
vendor-option-space CiscoVOIP;
log( info, concat( "LOLOPHONE: " , option vendor-class-identifier ));
- option CiscoVOIP.cm-tftp-server $nms::config::voip1;
- next-server $nms::config::voip1;
+ option CiscoVOIP.cm-tftp-server $nms::config::voip1_v6;
+ next-server $nms::config::voip1_v6;
}
class "cisco-voip-wlan" {
match if substring (option vendor-class-identifier, 0, 33) = "Cisco Systems Inc. Wireless Phone";
vendor-option-space CiscoVOIP;
log( info, concat( "BANANAPHONE: " , option vendor-class-identifier ));
- option CiscoVOIP.cm-tftp-server $nms::config::voip1;
- next-server $nms::config::voip1;
+ option CiscoVOIP.cm-tftp-server $nms::config::voip1_v6;
+ next-server $nms::config::voip1_v6;
}
EOF
close VOIPFILE;
diff --git a/include/config.pm.dist b/include/config.pm.dist
index c4a9d8d..f10757c 100755
--- a/include/config.pm.dist
+++ b/include/config.pm.dist
@@ -99,13 +99,19 @@ our @extra_nets = (
);
# add WLC's
-our $wlc1 = "185.110.148.14";
+our $wlc1_v4 = "185.110.148.14";
+our $wlc1_v6 = "f00d::1";
# add VOIP-server
-our $voip1 = "<removed>"; # TODO: Remove before publishing "goodiebag"
+our $voip1_v4 = "<removed>"; # TODO: Remove before publishing "goodiebag"
+our $voip1_v6 = "<removed>"; # TODO: Remove before publishing "goodiebag"
# PXE-server (rest of bootstrap assumes $sec_v4/$sec_v6)
our $pxe_server_v4 = $sec_v4;
our $pxe_server_v6 = $sec_v6;
+# FAP-server (Gondul)
+our $fap_server_v4 = "<removed>"; # TODO: Remove before publishing "goodiebag"
+our $fap_server_v6 = "<removed>"; # TODO: Remove before publishing "goodiebag"
+
1;