For those of you who would like to automate this approach and convert a hosts file into a router configuration, here's a short PERL script to do it:
#
# hostsToCisco.pl: converts hosts file into router configuration
#
# Stdin: hosts file
# Stdout: IOS configuration
#
our @line,$i;
while (<>) {
@line = split(/\s+/,$_);
next unless $line[0] eq "127.0.0.1";
for ($i = 1; $i < $#line; $i++) {
last if $line[$i] =~ /\#/;
print "ip host $line[$i] 127.0.0.1\n"
}
}
No comments:
Post a Comment