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 # 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. # All rights reserved.
# #
...@@ -67,7 +67,7 @@ install-real: resolv.conf \ ...@@ -67,7 +67,7 @@ install-real: resolv.conf \
$(NAMEDB_DIR)/localhost.rev \ $(NAMEDB_DIR)/localhost.rev \
$(NAMEDB_DIR)/$(OURDOMAIN).db.head \ $(NAMEDB_DIR)/$(OURDOMAIN).db.head \
$(NAMEDB_DIR)/$(OURDOMAIN).internal.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 $(INSTALL_DATA) resolv.conf $(ETCDIR)/resolv.conf
clean: clean:
......
...@@ -40,10 +40,7 @@ view "internal" { ...@@ -40,10 +40,7 @@ view "internal" {
file "named.root"; file "named.root";
}; };
zone "%internal_network_dotted_reverse%.in-addr.arpa" in { %internal_network_reverse_zones%
type master;
file "reverse/%internal_network_dotted%.db";
};
}; };
view "external" { view "external" {
...@@ -66,9 +63,6 @@ view "external" { ...@@ -66,9 +63,6 @@ view "external" {
file "named.root"; file "named.root";
}; };
zone "%external_network_dotted_reverse%.in-addr.arpa" in { %external_network_reverse_zones%
type master;
file "reverse/%external_network_dotted%.db";
};
}; };
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# #
# EMULAB-COPYRIGHT # 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. # All rights reserved.
# #
use Getopt::Std; use Getopt::Std;
...@@ -85,6 +85,11 @@ my ($ia, $ib, $ic, $id) = ...@@ -85,6 +85,11 @@ my ($ia, $ib, $ic, $id) =
my ($ea, $eb, $ec, $ed) = my ($ea, $eb, $ec, $ed) =
($EXTERNAL_TESTBED_NETWORK =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)/); ($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; $infile = shift @ARGV || exit &usage;
open(IF,"<$infile") or open(IF,"<$infile") or
...@@ -119,6 +124,28 @@ while (<IF>) { ...@@ -119,6 +124,28 @@ while (<IF>) {
print $1 . "};\n"; 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 { else {
die("*** $0:\n". die("*** $0:\n".
" Unknown special tag in named template file!\n"); " Unknown special tag in named template file!\n");
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# #
# EMULAB-COPYRIGHT # 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. # All rights reserved.
# #
use Getopt::Std; use Getopt::Std;
...@@ -49,67 +49,87 @@ use libdb; ...@@ -49,67 +49,87 @@ use libdb;
# #
# This is for the dotted and reverse dotted notation needed for the # This is for the dotted and reverse dotted notation needed for the
# reverse maps. This is probably all wrong ... # reverse maps. This is probably all wrong ...
# XXX only right for a /24? #
# XXX I assume that the netmask falls between /16 and /24 ...
# #
my ($ia, $ib, $ic, $id) = my ($ia, $ib, $ic, $id) =
($TESTBED_NETWORK =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)/); ($TESTBED_NETWORK =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)/);
my ($ea, $eb, $ec, $ed) = my ($ea, $eb, $ec, $ed) =
($EXTERNAL_TESTBED_NETWORK =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)/); ($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"; $infile = shift @ARGV || exit &usage;
my $external_revfile = "${ea}.${eb}.${ec}.db.head";
# #
# Create internal version. # Generate a set of maps for all indicies in the 3rd octet.
# #
print "Generating internal reverse lookup file ...\n"; for (my $i = $ic; $i <= $ic + (255 - $imc); $i++) {
system("cp -f reverse.head $internal_revfile") == 0 or my $internal_revfile = "${ia}.${ib}.${i}.db.head";
die("Unable to copy $infile to $internal_revfile\n");
#
open(REV, ">>$internal_revfile") # Create internal version.
or die("Unable to open $internal_revfile for appending!\n"); #
print "Generating internal reverse lookup file ...\n";
# XXX assumes /24 system("cp -f reverse.head $internal_revfile") == 0 or
my $BOSSNODE_ADDR = $1 if ($BOSSNODE_IP =~ /\d+\.\d+\.\d+\.(\d+)/); die("Unable to copy $infile to $internal_revfile\n");
my $USERNODE_ADDR = $1 if ($USERNODE_IP =~ /\d+\.\d+\.\d+\.(\d+)/);
my $FSNODE_ADDR = $1 if ($FSNODE_IP =~ /\d+\.\d+\.\d+\.(\d+)/); open(REV, ">>$internal_revfile")
or die("Unable to open $internal_revfile for appending!\n");
print REV "\n"; print REV "\n";
print REV "${BOSSNODE_ADDR}\tIN\tPTR\tboss.${OURDOMAIN}.\n";
print REV "${USERNODE_ADDR}\tIN\tPTR\tops.${OURDOMAIN}.\n"; # Need to put boss/ops into the proper zone file.
if ($FSNODE_IP ne $USERNODE_IP) { if ($BOSSNODE_IP =~ /\d+\.\d+\.$i\.(\d+)/) {
print REV "${FSNODE_ADDR}\tIN\tPTR\tfs.${OURDOMAIN}.\n"; 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. # No need is just one big IP space.
exit(0) exit(0)
if ($TESTBED_NETWORK eq $EXTERNAL_TESTBED_NETWORK); 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"; for (my $i = $ec; $i <= $ec + (255 - $emc); $i++) {
system("cp -f reverse.head $external_revfile") == 0 or my $external_revfile = "${ea}.${eb}.${i}.db.head";
die("Unable to copy $infile to $external_revfile\n");
#
open(REV, ">>$external_revfile") # Create external version.
or die("Unable to open $external_revfile for appending!\n"); #
print "Generating external reverse lookup file ...\n";
# XXX assumes /24 system("cp -f reverse.head $external_revfile") == 0 or
$BOSSNODE_ADDR = $1 if ($EXTERNAL_BOSSNODE_IP =~ /\d+\.\d+\.\d+\.(\d+)/); die("Unable to copy $infile to $external_revfile\n");
$USERNODE_ADDR = $1 if ($EXTERNAL_USERNODE_IP =~ /\d+\.\d+\.\d+\.(\d+)/);
$FSNODE_ADDR = $1 if ($EXTERNAL_FSNODE_IP =~ /\d+\.\d+\.\d+\.(\d+)/); open(REV, ">>$external_revfile")
or die("Unable to open $external_revfile for appending!\n");
print REV "\n"; print REV "\n";
print REV "${BOSSNODE_ADDR}\tIN\tPTR\tboss.${OURDOMAIN}.\n";
print REV "${USERNODE_ADDR}\tIN\tPTR\tops.${OURDOMAIN}.\n"; # Need to put boss/ops into the proper zone file.
if ($EXTERNAL_FSNODE_IP ne $EXTERNAL_USERNODE_IP) { if ($EXTERNAL_BOSSNODE_IP =~ /\d+\.\d+\.$i\.(\d+)/) {
print REV "${FSNODE_ADDR}\tIN\tPTR\tfs.${OURDOMAIN}.\n"; 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); 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