';
//Example picture
echo '';
echo 'IP Chart
';
// RFC1918
$seed = rand(1,3);
switch($seed) {
case 1: $base="10.".rand(0,255) ; break;
case 2: $base="172.".rand(16,31) ; break;
case 3: $base="192.168" ; break;
}
// Random Class C
$thirdoctet=rand(0,255);
// Find three nonidentical nets
$netid1=rand(0,7);
$netid2=$netid1;
while ($netid2==$netid1) {
$netid2=rand(0,7);
}
$netid3=$netid1;
while ($netid1==$netid3 OR $netid2==$netid3) {
$netid3=rand(0,7);
}
// Format display
$displaynet1 = $base.'.'.$thirdoctet.'.'.($netid1*32).'/'.rand(27,29);
$displaynet2 = $base.'.'.$thirdoctet.'.'.($netid2*32).'/'.rand(27,29);
$displaynet3 = $base.'.'.$thirdoctet.'.'.($netid3*32).'/30';
// Render
echo 'Device | Interface | NetID | IP Address |
';
echo '
Network 3 |
RTR1 | G0/1 | '.$displaynet3.' | |
RTR2 | G0/1 | '.$displaynet3.' | |
Network 1 |
RTR1 | G0/0 | '.$displaynet1.' | |
SW1 | VLAN 1 | '.$displaynet1.' | |
PC1 | NIC | '.$displaynet1.' | |
Network 2 |
RTR2 | G0/0 | '.$displaynet2.' | |
SW2 | VLAN 1 | '.$displaynet2.' | |
PC2 | NIC | '.$displaynet2.' | |
';
echo '
';
echo '