Commit baab5fc2 authored by Leigh Stoller's avatar Leigh Stoller

A bunch of changes attempting to deal with testbed networks that are

bigger then a /24 network, as in Utah's network. Mostly the changes
are how we deal with the reverse zone file creation and what gets
stuck into the named.conf file. Prior to this commit, we assumed a
single /24 network, cause thats how it looks in an elabinelab
experiment (which is where its critical to have the named config files
generated automatically).

But with the changes to support a single control network, the named
setup inside elabinelab is bigger then a /24 and the reverse files
have to be created and populated correctly.
parent ebee26da
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2005 University of Utah and the Flux Group.
# Copyright (c) 2000-2006 University of Utah and the Flux Group.
# All rights reserved.
#
......@@ -67,7 +67,7 @@ install-real: resolv.conf \
$(NAMEDB_DIR)/localhost.rev \
$(NAMEDB_DIR)/$(OURDOMAIN).db.head \
$(NAMEDB_DIR)/$(OURDOMAIN).internal.db.head \
$(addprefix $(NAMEDB_DIR)/reverse/, $(REVFILES))
$(addprefix $(NAMEDB_DIR)/reverse/, $(wildcard *.db.head))
$(INSTALL_DATA) resolv.conf $(ETCDIR)/resolv.conf
clean:
......
......@@ -40,10 +40,7 @@ view "internal" {
file "named.root";
};
zone "%internal_network_dotted_reverse%.in-addr.arpa" in {
type master;
file "reverse/%internal_network_dotted%.db";
};
%internal_network_reverse_zones%
};
view "external" {
......@@ -66,9 +63,6 @@ view "external" {
file "named.root";
};
zone "%external_network_dotted_reverse%.in-addr.arpa" in {
type master;
file "reverse/%external_network_dotted%.db";
};
%external_network_reverse_zones%
};
......@@ -2,7 +2,7 @@
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2004 University of Utah and the Flux Group.
# Copyright (c) 2000-2004, 2006 University of Utah and the Flux Group.
# All rights reserved.
#
use Getopt::Std;
......@@ -85,6 +85,11 @@ my ($ia, $ib, $ic, $id) =
my ($ea, $eb, $ec, $ed) =
($EXTERNAL_TESTBED_NETWORK =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)/);
my ($ima, $imb, $imc, $imd) =
($TESTBED_NETMASK =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)/);
my ($ema, $emb, $emc, $emd) =
($EXTERNAL_TESTBED_NETMASK =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)/);
$infile = shift @ARGV || exit &usage;
open(IF,"<$infile") or
......@@ -119,6 +124,28 @@ while (<IF>) {
print $1 . "};\n";
}
}
elsif ($2 eq "internal_network_reverse_zones") {
for (my $i = $ic; $i <= $ic + (255 - $imc); $i++) {
my $dotted = "${ia}.${ib}.${i}";
my $dotted_reverse = "${i}.${ib}.${ia}";
print $1 . "zone \"${dotted_reverse}.in-addr.arpa\" in {\n";
print $1 . "\ttype master;\n";
print $1 . "\tfile \"reverse/${dotted}.db\";\n";
print $1 . "};\n";
}
}
elsif ($2 eq "external_network_reverse_zones") {
for (my $i = $ec; $i <= $ec + (255 - $emc); $i++) {
my $dotted = "${ea}.${eb}.${i}";
my $dotted_reverse = "${i}.${eb}.${ea}";
print $1 . "zone \"${dotted_reverse}.in-addr.arpa\" in {\n";
print $1 . "\ttype master;\n";
print $1 . "\tfile \"reverse/${dotted}.db\";\n";
print $1 . "};\n";
}
}
else {
die("*** $0:\n".
" Unknown special tag in named template file!\n");
......
......@@ -2,7 +2,7 @@
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2005 University of Utah and the Flux Group.
# Copyright (c) 2000-2006 University of Utah and the Flux Group.
# All rights reserved.
#
use Getopt::Std;
......@@ -49,67 +49,87 @@ use libdb;
#
# This is for the dotted and reverse dotted notation needed for the
# reverse maps. This is probably all wrong ...
# XXX only right for a /24?
# reverse maps. This is probably all wrong ...
#
# XXX I assume that the netmask falls between /16 and /24 ...
#
my ($ia, $ib, $ic, $id) =
($TESTBED_NETWORK =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)/);
my ($ea, $eb, $ec, $ed) =
($EXTERNAL_TESTBED_NETWORK =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)/);
$infile = shift @ARGV || exit &usage;
my ($ima, $imb, $imc, $imd) =
($TESTBED_NETMASK =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)/);
my ($ema, $emb, $emc, $emd) =
($EXTERNAL_TESTBED_NETMASK =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)/);
my $internal_revfile = "${ia}.${ib}.${ic}.db.head";
my $external_revfile = "${ea}.${eb}.${ec}.db.head";
$infile = shift @ARGV || exit &usage;
#
# Create internal version.
# Generate a set of maps for all indicies in the 3rd octet.
#
print "Generating internal reverse lookup file ...\n";
system("cp -f reverse.head $internal_revfile") == 0 or
die("Unable to copy $infile to $internal_revfile\n");
open(REV, ">>$internal_revfile")
or die("Unable to open $internal_revfile for appending!\n");
# XXX assumes /24
my $BOSSNODE_ADDR = $1 if ($BOSSNODE_IP =~ /\d+\.\d+\.\d+\.(\d+)/);
my $USERNODE_ADDR = $1 if ($USERNODE_IP =~ /\d+\.\d+\.\d+\.(\d+)/);
my $FSNODE_ADDR = $1 if ($FSNODE_IP =~ /\d+\.\d+\.\d+\.(\d+)/);
print REV "\n";
print REV "${BOSSNODE_ADDR}\tIN\tPTR\tboss.${OURDOMAIN}.\n";
print REV "${USERNODE_ADDR}\tIN\tPTR\tops.${OURDOMAIN}.\n";
if ($FSNODE_IP ne $USERNODE_IP) {
print REV "${FSNODE_ADDR}\tIN\tPTR\tfs.${OURDOMAIN}.\n";
for (my $i = $ic; $i <= $ic + (255 - $imc); $i++) {
my $internal_revfile = "${ia}.${ib}.${i}.db.head";
#
# Create internal version.
#
print "Generating internal reverse lookup file ...\n";
system("cp -f reverse.head $internal_revfile") == 0 or
die("Unable to copy $infile to $internal_revfile\n");
open(REV, ">>$internal_revfile")
or die("Unable to open $internal_revfile for appending!\n");
print REV "\n";
# Need to put boss/ops into the proper zone file.
if ($BOSSNODE_IP =~ /\d+\.\d+\.$i\.(\d+)/) {
print REV "${1}\tIN\tPTR\tboss.${OURDOMAIN}.\n";
}
if ($USERNODE_IP =~ /\d+\.\d+\.$i\.(\d+)/) {
print REV "${1}\tIN\tPTR\tops.${OURDOMAIN}.\n";
}
if ($FSNODE_IP ne $USERNODE_IP &&
$FSNODE_IP =~ /\d+\.\d+\.$i\.(\d+)/) {
print REV "${1}\tIN\tPTR\tfs.${OURDOMAIN}.\n";
}
close(REV);
}
close(REV);
# No need is just one big IP space.
exit(0)
if ($TESTBED_NETWORK eq $EXTERNAL_TESTBED_NETWORK);
#
# Create external version.
# Generate a set of maps for all indicies in the 3rd octet.
#
print "Generating external reverse lookup file ...\n";
system("cp -f reverse.head $external_revfile") == 0 or
die("Unable to copy $infile to $external_revfile\n");
open(REV, ">>$external_revfile")
or die("Unable to open $external_revfile for appending!\n");
# XXX assumes /24
$BOSSNODE_ADDR = $1 if ($EXTERNAL_BOSSNODE_IP =~ /\d+\.\d+\.\d+\.(\d+)/);
$USERNODE_ADDR = $1 if ($EXTERNAL_USERNODE_IP =~ /\d+\.\d+\.\d+\.(\d+)/);
$FSNODE_ADDR = $1 if ($EXTERNAL_FSNODE_IP =~ /\d+\.\d+\.\d+\.(\d+)/);
print REV "\n";
print REV "${BOSSNODE_ADDR}\tIN\tPTR\tboss.${OURDOMAIN}.\n";
print REV "${USERNODE_ADDR}\tIN\tPTR\tops.${OURDOMAIN}.\n";
if ($EXTERNAL_FSNODE_IP ne $EXTERNAL_USERNODE_IP) {
print REV "${FSNODE_ADDR}\tIN\tPTR\tfs.${OURDOMAIN}.\n";
for (my $i = $ec; $i <= $ec + (255 - $emc); $i++) {
my $external_revfile = "${ea}.${eb}.${i}.db.head";
#
# Create external version.
#
print "Generating external reverse lookup file ...\n";
system("cp -f reverse.head $external_revfile") == 0 or
die("Unable to copy $infile to $external_revfile\n");
open(REV, ">>$external_revfile")
or die("Unable to open $external_revfile for appending!\n");
print REV "\n";
# Need to put boss/ops into the proper zone file.
if ($EXTERNAL_BOSSNODE_IP =~ /\d+\.\d+\.$i\.(\d+)/) {
print REV "${1}\tIN\tPTR\tboss.${OURDOMAIN}.\n";
}
if ($EXTERNAL_USERNODE_IP =~ /\d+\.\d+\.$i\.(\d+)/) {
print REV "${1}\tIN\tPTR\tops.${OURDOMAIN}.\n";
}
if ($EXTERNAL_FSNODE_IP ne $EXTERNAL_USERNODE_IP &&
$EXTERNAL_FSNODE_IP =~ /\d+\.\d+\.$i\.(\d+)/) {
print REV "${1}\tIN\tPTR\tfs.${OURDOMAIN}.\n";
}
close(REV);
}
close(REV);
exit(0);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment