Switch Benchmark Automated

Considering buying a new switch. Typically not all to big an issue. Check Datasheet and fine. For smaller use cases this is probably feasible but I experienced never the less reaching some limits. So what to do?

Right now I started to do a benchmark and wanted to test out in which configuration a network switch actually maxes out. Besides max- MAC entries, max routing entries or multicast groups particular the number of differen VLANs results in memory consumption, since each one needs dedicated buffering.

On top most VLANs need IP configurations set up and depending on your applications probably multiple of them. Unfortunately in my case exactly the later.

Now you may consider configuring max configurations some fun, but after several loops to find the setup maximum, this does not exactly look like productive work. To create multiple configurations which then might be copied and pasted to the according switches, I created the following perl script, utilizing the 10.0.0.0 address range to create the configuration.

#!/usr/bin/perl
use strict;
use warnings;

my ($VLANS, $IPS) = @ARGV;

my $IPSUB = $IPS / $VLANS;

print "configure terminal\n";
print "; VLANs $VLANS with IPs $IPSUB and $IPS total IPs\n";

my $i = 1;
my $maxvl = $VLANS++ +5;

print "max vlans $maxvl\n";

while ($i < $VLANS)  {
	$i++;
	print "VLAN $i\n";
	print "    name \"BENCHVLAN $i\"\n";
	print "    no ip address\n";
	my $j = 0;
	
	while ($j < $IPSUB) {
		$j++;
		print "    ip address 10.$i.$j.1/24\n";
	}
	print "exit\n";
	
}

Ruft man das Script mit seinen zwei Argumenten wie folgt auf perl cfggen.pl 6 18 > out.cfg ,erezeugt es eine Datei mit der Konfiguration von 6 VLANs und insgesamt 18 IP Adressen, welche auf die VLANs verteilt werden. Der Output sieht dann wie folgt aus:

configure terminal
; VLANs 6 with IPs 3 and 18 total IPs
max vlans 11
VLAN 2
    name "BENCHVLAN 2"
    no ip address
    ip address 10.2.1.1/24
    ip address 10.2.2.1/24
    ip address 10.2.3.1/24
exit
VLAN 3
    name "BENCHVLAN 3"
    no ip address
    ip address 10.3.1.1/24
    ip address 10.3.2.1/24
    ip address 10.3.3.1/24
exit
VLAN 4
    name "BENCHVLAN 4"
    no ip address
    ip address 10.4.1.1/24
    ip address 10.4.2.1/24
    ip address 10.4.3.1/24
exit
VLAN 5
    name "BENCHVLAN 5"
    no ip address
    ip address 10.5.1.1/24
    ip address 10.5.2.1/24
    ip address 10.5.3.1/24
exit
VLAN 6
    name "BENCHVLAN 6"
    no ip address
    ip address 10.6.1.1/24
    ip address 10.6.2.1/24
    ip address 10.6.3.1/24
exit
VLAN 7
    name "BENCHVLAN 7"
    no ip address
    ip address 10.7.1.1/24
    ip address 10.7.2.1/24
    ip address 10.7.3.1/24
exit

Dabei werden fortlaufende Netze der Art 10.VLAN.IPseg.0/24 erzeugt. So kann man sehr schnell alternative Konfigurationen mit tausenden IPs und hunderten VLANs erzeugen, die unklompiziert auf die zu testenden Switches übertragen werden. Wie diese sich dann benehmen kann man dann in Ruhe beobachten.

Bis 256/256 also 65.536 Adressen macht das auch einen gewissen Sinn (wobei der besseren Lesbarkeit ein bisschen Verschnitt in den Schleifen ist, man beachte die fehlende Null).

In diesem Sinne, viel Spaß und Kyp.F.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.