This commit is contained in:
2024-10-13 23:32:58 +02:00
parent 30627b25b3
commit dbfba56f66
38 changed files with 3897 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
!
end

View File

@@ -0,0 +1,2 @@
do reload in 1
end

View File

@@ -0,0 +1,2 @@
do reload in 1
end

View File

@@ -0,0 +1,3 @@
@echo off
cls
perl convert.pl convert.txt network-confg

View File

@@ -0,0 +1,66 @@
#!/bin/perl
$i=@ARGV;
die "Zu wenige Parameter!\nconvert.pl <Eingabedatei> <Ausgabedatei>" if $i<2;
print "\n";
print "Eingabedatei $ARGV[0]\n";
print "Ausgabedatei $ARGV[1]\n";
open IN, "<$ARGV[0]";
open OUT, ">$ARGV[1]";
@INF=<IN>;
foreach (@INF) {
chomp;
router() if ($_ =~ /^!!ROUTER/);
router() if ($_ =~ /^!!SWITCH/);
router() if ($_ =~ /^!!FIREWALL/);
}
close IN;
close OUT;
sub router {
$read_v=0;
# Variablen lesen
foreach (@INF) {
$read_v=1 if ($_ =~ /^!!VARIABLEN/);
last if ($_ =~ /^!!CONFIG/);
next if ($_ =~ /^!/);
read_var($_) if ($read_v);
}
# Konfig lesen
$read_c=0;
foreach (@INF) {
chomp;
$read_c=1 if ($_ =~ /^!!CONFIG/);
if ($read_c) {
if($_ =~ /<.*>/) {
($vn)=$_=~/(<.*>)/;
$_ =~ s/$vn/$VARS{$vn}/;
next if ($VARS{$vn} eq "");
}
# und schreiben
printf OUT "$_\n";
}
}
}
sub switch {
}
sub firewall {
}
sub read_var {
$l=$_[0];
if ($l=~ /<.*>.*=.*/) {
($vn, $vv) = $l =~/(<.*>).*=[\s]*(.*)/;
$VARS{$vn}=$vv;
}
}

View File

@@ -0,0 +1,153 @@
Die Zeilen mit zwei Ausrufezeichen sind besondere Zeilen. Diese markieren neue Abschnitte in der Datei.
Diese Zeilen müssen am Anfang einer Zeile stehen und dürfen keine Leerzeichen beinhalten.
Darüberhinaus sind alle Zeichen groß zu schreiben.
Als erstes muss !!ROUTER kommen, diese Zeile markiert den eigentlichen Anfang. Es passiert nichts bis !!VARIABLEN erscheint.
Ab dort erfolgt die Definition der Variablen.
Ab !!CONFIG kommt die eigentliche Konfiguration. Alle im Abschnitt !!VARIABLEN definierten Werte werden im Abschnitt !!CONFIG eingesetzt.
Ansonsten sind Zeilen die mit einem ! beginnen Kommentare (Cisco Syntax).
!!ROUTER
!!VARIABLEN
<HOSTNAME> = R6
<TFTP_HOST_STRING> = tftp://172.23.210.222/x-confg
<INT_NAME> = f0/0
!<INT_IP_MASK> = 192.1.1.2 255.255.255.0
<INT_IP_MASK> = DHCP
<DEF_GW> =
<SNMP_READ> = con
<SNMP_WRITE> = 5NMP-Wr1t3-(0mm
<SYSLOG_FACILITY> = local1
<SYSLOG_SRC_INT> =
<SYSLOG_SEVERITY> = errors
<SYSLOG_SRV> = 10.101.0.11
<LOG_SEVERITY> = informational
<SOMMERZEITVONBIS> = Mar 31 2013 2:00 Oct 27 2013 2:00
<NTP_SRV1> = 90.200.31.21
<NTP_SRV2> = 90.200.31.23
! PTB NTP Server
! ntp server 192.53.103.103
! ntp server 192.53.103.108
! ntp server 192.53.103.104
<DOMAIN> = corp.conet.local
<ADM_PW> = LicherExport
! Netze/IPs zur Administration, AdminText, AdminNetz
<AT1> = extern 1
<AN1> = 195.20.133.6
<AT2> = extern 2
<AN2> = 212.202.166.58
<AT3> = Eschborner Ldstr 1
<AN3> = 192.168.88.0 0.0.0.255
<AT4> = Eschborner Ldstr 2
<AN4> = 172.23.210.0 0.0.0.255
<AT5> = Interxion
<AN5> = 88.205.102.128 0.0.0.127
<ATI> = Initial Netz
<ANI> = 192.1.1.0 0.0.0.255
!!CONFIG
boot network <TFTP_HOST_STRING>
hostname <HOSTNAME>
int <INT_NAME>
ip address <INT_IP_MASK>
no shut
ip route 0.0.0.0 0.0.0.0 <DEF_GW>
! snmp
snmp-server community <SNMP_READ> RO ACL_telnet_ssh_snmp
snmp-server community <SNMP_WRITE> RW ACL_telnet_ssh_snmp
! syslog
logging facility <SYSLOG_FACILITY>
logging source-interface <SYSLOG_SRC_INT>
logging <SYSLOG_SRV>
logging trap <SYSLOG_SEVERITY>
! lokales log
logging buffered 4096 <LOG_SEVERITY>
logging history <LOG_SEVERITY>
logging console <LOG_SEVERITY>
logging monitor <LOG_SEVERITY>
! ntp
clock timezone MEZ 1
clock summer-time MESZ date <SOMMERZEITVONBIS>
ntp server <NTP_SRV1> prefer
ntp server <NTP_SRV2>
! ssh
ip domain name <DOMAIN>
!crypto key generate rsa
!1024
!ip ssh ver 2
username admin priv 15 pass <ADM_PW>
! login
ip access-list standard ACL_telnet_ssh_snmp
remark <AT1>
permit <AN1>
remark <AT2>
permit <AN2>
remark <AT3>
permit <AN3>
remark <AT4>
permit <AN4>
remark <AT5>
permit <AN5>
remark <ATI>
permit <ANI>
line vty 0 4
session-timeout 60
access-class ACL_telnet_ssh_snmp in
exec-timeout 60 0
login local
transport input all
line con 0
login local
line aux 0
login local
! services
service tcp-keepalives-in
service timestamps debug datetime localtime show-timezone
service timestamps log datetime localtime show-timezone
service password-encryption
service linenumber
! domain-lookup
no ip domain-lookup
! http
no ip http server
end

View File

@@ -0,0 +1 @@
no username test password test

View File

@@ -0,0 +1,89 @@
!!CONFIG
boot network tftp://172.23.210.222/x-confg
hostname R6
int f0/0
ip address DHCP
no shut
! snmp
snmp-server community bross RO ACL_telnet_ssh_snmp
snmp-server community 5NMP-Wr1t3-(0mm RW ACL_telnet_ssh_snmp
! syslog
logging facility local1
logging 10.101.2.113
logging trap errors
! lokales log
logging buffered 4096 informational
logging history informational
logging console informational
logging monitor informational
! ntp
clock timezone MEZ 1
clock summer-time MESZ date Mar 31 2013 2:00 Oct 27 2013 2:00
ntp server 90.200.31.21 prefer
ntp server 90.200.31.23
! ssh
ip domain name corp.conet.local
!crypto key generate rsa
!1024
!ip ssh ver 2
username admin priv 15 pass LicherExport
! login
ip access-list standard ACL_telnet_ssh_snmp
remark extern 1
permit 195.20.133.6
remark extern 2
permit 212.202.166.58
remark Eschborner Ldstr 1
permit 192.168.88.0 0.0.0.255
remark Eschborner Ldstr 2
permit 172.23.210.0 0.0.0.255
remark Interxion
permit 88.205.102.128 0.0.0.127
remark Initial Netz
permit 192.1.1.0 0.0.0.255
line vty 0 4
session-timeout 60
access-class ACL_telnet_ssh_snmp in
exec-timeout 60 0
login local
transport input all
line con 0
login local
line aux 0
login local
! services
service tcp-keepalives-in
service timestamps debug datetime localtime show-timezone
service timestamps log datetime localtime show-timezone
service password-encryption
service linenumber
! domain-lookup
no ip domain-lookup
! http
no ip http server
end

View File

@@ -0,0 +1,2 @@
do reload in 1
end

View File

@@ -0,0 +1,138 @@
!
version 12.4
service tcp-keepalives-in
service timestamps debug datetime localtime show-timezone
service timestamps log datetime localtime show-timezone
service password-encryption
service linenumber
!
hostname R6
!
boot-start-marker
boot network tftp://172.23.210.222/x-confg
boot-end-marker
!
logging buffered 4096 informational
logging console informational
logging monitor informational
!
no aaa new-model
!
resource policy
!
clock timezone MEZ 1
clock summer-time MESZ date Mar 31 2013 2:00 Oct 27 2013 2:00
ip cef
!
!
!
!
no ip domain lookup
ip domain name corp.conet.local
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
username admin privilege 15 password 7 00281A050C5E19231731435C1D
!
!
!
!
!
!
!
interface FastEthernet0/0
ip address dhcp
duplex auto
speed auto
!
interface FastEthernet0/1
no ip address
shutdown
duplex auto
speed auto
!
interface FastEthernet1/0
no ip address
shutdown
duplex auto
speed auto
!
interface FastEthernet1/1
no ip address
shutdown
duplex auto
speed auto
!
no ip http server
no ip http secure-server
!
!
!
ip access-list standard ACL_telnet_ssh_snmp
remark extern 1
permit 195.20.133.6
remark extern 2
permit 212.202.166.58
remark Eschborner Ldstr 1
permit 192.168.88.0 0.0.0.255
remark Eschborner Ldstr 2
permit 172.23.210.0 0.0.0.255
remark Interxion
permit 88.205.102.128 0.0.0.127
remark Initial Netz
permit 192.1.1.0 0.0.0.255
!
logging history informational
logging alarm informational
logging trap errors
logging facility local1
logging 10.101.2.113
snmp-server community bross RO ACL_telnet_ssh_snmp
snmp-server community 5NMP-Wr1t3-(0mm RW ACL_telnet_ssh_snmp
!
!
!
!
!
!
control-plane
!
!
!
!
!
!
gatekeeper
shutdown
!
!
line con 0
login local
stopbits 1
line aux 0
login local
stopbits 1
line vty 0 4
session-timeout 60
access-class ACL_telnet_ssh_snmp in
exec-timeout 60 0
login local
transport input all
!
ntp server 90.200.31.23
ntp server 90.200.31.21 prefer
!
end