В месте где я сейчас работаю конфигурированием занимаются несколько человек.
При этом установку на сеть контролируют не всегда те же люди что и конфигурируют.
Поэтому чтобы все были в курсе о новых настроенных коммутаторах был сделан небольшой автоконфигуратор. Ну на самом деле просто генератор конфигурации.
Возможности скрипта :
В целом получилась такая конструкция из нескольких файлов :
Для простоты показываю как сделать для 2х моделей коммутаторов: Dlink DES 3200 и SNR 2965.
Внимание в конфигурации используются вымышленные пароли и IP адреса
В папку складываем файлы :
index.php
snr2965.php
logo.png
des3200c1.php
dcn3900.php
<HTML>
<HEAD>
<TITLE>Конфигурация коммутаторов</TITLE>
<meta charset="utf-8">
</HEAD>
<BODY>
Работает только конфигурация коммутаторов DES3200 , SNR и DCN<br>
<?php
$date1 = date('dmY-His');
echo $date1;
?>
<center><img src="logo.png" alt="example.com"> </center>
<H3> <center><font color="#1E90FF">Генератор конфигурации для коммутаторов</font></H3>
<center>
<table width="1" border="0">
<form enctype="multipart/form-data" method="post">
<tr><td width="50%"><i>Выбери модель:</i></td><td align="right"><select name="MODEL">
<option><i>Выбери</i></option>
<option>Dlink DES-1228-28 ME A1</option>
<option>Dlink DES-1228-28 ME A2</option>
<option>Dlink DES-1228-28 ME B1</option>
<option>Dlink DES-3200-28 C1</option>
<option>Dlink DGS-1100-06 ME</option>
<option>SNR 2965</option>
<option>DCN 3900</option>
<option>DCN 3950</option>
</select><br></td></tr>
<tr><td width="50%"><i>Планируемый адрес установки:</i></td><td align="right"><input type="text" name="install_address" maxlength="40" value="<?php if (isset($_POST['install_address'])) echo $_POST['install_address']; else echo "";?>"></td></tr>
<tr><td width="50%"><i>Укажи серийный номер:</i></td><td align="right"><input type="text" name="serial_number" maxlength="32" value="<?php if (isset($_POST['serial_number'])) echo $_POST['serial_number']; else echo "";?>"></td></tr>
<tr><td width="50%"><i>IP адрес:</i></td><td align="right"><input name="ip" pattern="\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}" value="<?php if (isset($_POST['ip'])) echo $_POST['ip']; else echo "10.16.0.0";?>"></td></tr>
<tr><td width="50%"><i>Маска:</i></td><td align="right"><input name="mask" pattern="\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}" value="<?php if (isset($_POST['mask'])) echo $_POST['mask']; else echo "255.255.255.0";?>"></td></tr>
<tr><td width="50%"><i>Шлюз:</i></td><td align="right"><input name="gw" pattern="\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}" value="<?php if (isset($_POST['gw'])) echo $_POST['gw']; else echo "10.16.0.0";?>"></td></tr>
<tr><td width="50%"><i>Vlan ID:</i></td><td align="right"><input name="vlanid" pattern="\d{1,4}" value="<?php if (isset($_POST['vlanid'])) echo $_POST['vlanid']; else echo "";?>"></td></tr>
<tr><td width="50%"><i>Multicast Vlan Name:</i></td><td align="right"><input name="mvlanname" value="<?php if (isset($_POST['mvlanname'])) echo $_POST['mvlanname']; else echo "iptv";?>"></td></tr>
<tr><td width="50%"><i>Multicast Vlan ID:</i></td><td align="right"><input name="mvlanid" pattern="\d{1,4}" value="<?php if (isset($_POST['mvlanid'])) echo $_POST['mvlanid']; else echo "888";?>"></td></tr>
<tr><td width="50%"><i>Кто конфигурировал:</i></td><td align="right"><input type="text" name="emplname" maxlength="32" value="<?php if (isset($_POST['emplname'])) echo $_POST['emplname']; else echo "";?>"></td></tr>
<tr><td colspan="2"><i>Примечание:</i><br><textarea cols="50" rows="3" name="free_descr" value="<?php if (isset($_POST['free_descr'])) echo $_POST['free_descr']; else echo "";?>"></textarea></td>
</tr><tr><td colspan="2"><center><input type="submit" value="Генерировать"></center></td></tr>
<a href="configured/">Сконфигурированные</a><br>
</form>
</table>
</center>
<?php
function mask2cidr($mask){
$long = ip2long($mask);
$base = ip2long('255.255.255.255');
return 32-log(($long ^ $base)+1,2);
/* xor-ing will give you the inverse mask,
log base 2 of that +1 will return the number
of bits that are off in the mask and subtracting
from 32 gets you the cidr notation */
}
function translit($str){
$alphavit = array(
/*--*/
"а"=>"a","б"=>"b","в"=>"v","г"=>"g","д"=>"d","е"=>"e",
"ё"=>"yo","ж"=>"j","з"=>"z","и"=>"i","й"=>"i","к"=>"k","л"=>"l", "м"=>"m",
"н"=>"n","о"=>"o","п"=>"p","р"=>"r","с"=>"s","т"=>"t",
"у"=>"y","ф"=>"f","х"=>"h","ц"=>"c","ч"=>"ch", "ш"=>"sh","щ"=>"sh",
"ы"=>"i","э"=>"e","ю"=>"u","я"=>"ya",
/*--*/
"А"=>"A","Б"=>"B","В"=>"V","Г"=>"G","Д"=>"D","Е"=>"E", "Ё"=>"Yo",
"Ж"=>"J","З"=>"Z","И"=>"I","Й"=>"I","К"=>"K", "Л"=>"L","М"=>"M",
"Н"=>"N","О"=>"O","П"=>"P", "Р"=>"R","С"=>"S","Т"=>"T","У"=>"Y",
"Ф"=>"F", "Х"=>"H","Ц"=>"C","Ч"=>"Ch","Ш"=>"Sh","Щ"=>"Sh",
"Ы"=>"I","Э"=>"E","Ю"=>"U","Я"=>"Ya",
"ь"=>"","Ь"=>"","ъ"=>"","Ъ"=>""
);
return strtr($str, $alphavit);
}
if ($_POST['MODEL']=='Dlink DES-3200-28 C1')
{
$install_address = $_POST['install_address'];
$model = $_POST['MODEL'];
$serial_number = $_POST['serial_number'];
$ip = $_POST['ip'] ;
$mask = mask2cidr($_POST['mask']);
$gw = $_POST['gw'];
$vlanid = $_POST['vlanid'];
$mvlanname= $_POST['mvlanname'];
$mvlanid = $_POST['mvlanid'];
$freedescr = $_POST['free_descr'];
$translitaddress = translit($install_address);
$emplname= $_POST['emplname'];
echo <<<EOT
Полученные параметры:<br>
<b>Планируемый адрес установки:</b> $install_address (snmp location $translitaddress )<br>
<b>Модель:</b> $model <br>
<b>Серийный номер:</b> $serial_number<br>
<b>IP адрес:</b> $ip<br>
<b>Маска:</b> $mask<br>
<b>Шлюз:</b> $gw <br>
<b>Vlan ID:</b> $vlanid<br>
<b>Multicast Vlan ID:</b> $mvlanid</br>
<b>Multicast Vlan Name:</b> $mvlanname</br>
<b>Кто конфигурировал:</b> $emplname</br>
<b>Примечание:</b> $freedescr<br>
EOT;
ob_start();
include 'des3200c1.php';
$saveString = strip_tags(ob_get_flush());
#echo $saveString;
file_put_contents("configured/$date1-$ip-$model.cfg", $saveString);
mail("noc@example.com", "New Switch Configured $date1 by $emplname", "$saveString");
echo $date1;
}
if ($_POST['MODEL']=='SNR 2965')
{
$install_address = $_POST['install_address'];
$model = $_POST['MODEL'];
$serial_number = $_POST['serial_number'];
$ip = $_POST['ip'] ;
$mask = $_POST['mask'];
$gw = $_POST['gw'];
$vlanid = $_POST['vlanid'];
$mvlanid = $_POST['mvlanid'];
$mvlanname= $_POST['mvlanname'];
$freedescr = $_POST['free_descr'];
$translitaddress = translit($install_address);
$emplname= $_POST['emplname'];
echo <<<EOT
Полученные параметры:<br>
<b>Планируемый адрес установки:</b> $install_address (snmp location $translitaddress )<br>
<b>Модель:</b> $model <br>
<b>Серийный номер:</b> $serial_number<br>
<b>IP адрес:</b> $ip<br>
<b>Маска:</b> $mask<br>
<b>Шлюз:</b> $gw <br>
<b>Vlan ID:</b> $vlanid<br>
<b>Multicast Vlan ID:</b> $mvlanid</br>
<b>Multicast Vlan Name:</b> $mvlanname</br>
<b>Кто конфигурировал:</b> $emplname</br>
<b>Примечание:</b> $freedescr<br>
EOT;
ob_start();
include 'snr2965.php';
$saveString = strip_tags(ob_get_flush());
#echo $saveString;
file_put_contents("configured/$date1-$ip-$model.cfg", $saveString);
mail("noc@example.com", "New Switch Configured $date1 by $emplname", "$saveString");
echo $date1;
}
?>
<br><br><br><center>Вопросы <a href="mailto:example@example.com"> example@example.com </a> </center>
</BODY>
</HTML>
В комментариях готов ответить на вопросы.
При этом установку на сеть контролируют не всегда те же люди что и конфигурируют.
Поэтому чтобы все были в курсе о новых настроенных коммутаторах был сделан небольшой автоконфигуратор. Ну на самом деле просто генератор конфигурации.
Возможности скрипта :
- Автоматическая подстановка необходимых значений
- Складирование готовых конфигураций
- Отправка письма с вложенной конфигурацией
В целом получилась такая конструкция из нескольких файлов :
Для простоты показываю как сделать для 2х моделей коммутаторов: Dlink DES 3200 и SNR 2965.
Внимание в конфигурации используются вымышленные пароли и IP адреса
В папку складываем файлы :
index.php
snr2965.php
logo.png
des3200c1.php
dcn3900.php
Содержимое файла index.php:
<HTML>
<HEAD>
<TITLE>Конфигурация коммутаторов</TITLE>
<meta charset="utf-8">
</HEAD>
<BODY>
Работает только конфигурация коммутаторов DES3200 , SNR и DCN<br>
<?php
$date1 = date('dmY-His');
echo $date1;
?>
<center><img src="logo.png" alt="example.com"> </center>
<H3> <center><font color="#1E90FF">Генератор конфигурации для коммутаторов</font></H3>
<center>
<table width="1" border="0">
<form enctype="multipart/form-data" method="post">
<tr><td width="50%"><i>Выбери модель:</i></td><td align="right"><select name="MODEL">
<option><i>Выбери</i></option>
<option>Dlink DES-1228-28 ME A1</option>
<option>Dlink DES-1228-28 ME A2</option>
<option>Dlink DES-1228-28 ME B1</option>
<option>Dlink DES-3200-28 C1</option>
<option>Dlink DGS-1100-06 ME</option>
<option>SNR 2965</option>
<option>DCN 3900</option>
<option>DCN 3950</option>
</select><br></td></tr>
<tr><td width="50%"><i>Планируемый адрес установки:</i></td><td align="right"><input type="text" name="install_address" maxlength="40" value="<?php if (isset($_POST['install_address'])) echo $_POST['install_address']; else echo "";?>"></td></tr>
<tr><td width="50%"><i>Укажи серийный номер:</i></td><td align="right"><input type="text" name="serial_number" maxlength="32" value="<?php if (isset($_POST['serial_number'])) echo $_POST['serial_number']; else echo "";?>"></td></tr>
<tr><td width="50%"><i>IP адрес:</i></td><td align="right"><input name="ip" pattern="\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}" value="<?php if (isset($_POST['ip'])) echo $_POST['ip']; else echo "10.16.0.0";?>"></td></tr>
<tr><td width="50%"><i>Маска:</i></td><td align="right"><input name="mask" pattern="\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}" value="<?php if (isset($_POST['mask'])) echo $_POST['mask']; else echo "255.255.255.0";?>"></td></tr>
<tr><td width="50%"><i>Шлюз:</i></td><td align="right"><input name="gw" pattern="\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}" value="<?php if (isset($_POST['gw'])) echo $_POST['gw']; else echo "10.16.0.0";?>"></td></tr>
<tr><td width="50%"><i>Vlan ID:</i></td><td align="right"><input name="vlanid" pattern="\d{1,4}" value="<?php if (isset($_POST['vlanid'])) echo $_POST['vlanid']; else echo "";?>"></td></tr>
<tr><td width="50%"><i>Multicast Vlan Name:</i></td><td align="right"><input name="mvlanname" value="<?php if (isset($_POST['mvlanname'])) echo $_POST['mvlanname']; else echo "iptv";?>"></td></tr>
<tr><td width="50%"><i>Multicast Vlan ID:</i></td><td align="right"><input name="mvlanid" pattern="\d{1,4}" value="<?php if (isset($_POST['mvlanid'])) echo $_POST['mvlanid']; else echo "888";?>"></td></tr>
<tr><td width="50%"><i>Кто конфигурировал:</i></td><td align="right"><input type="text" name="emplname" maxlength="32" value="<?php if (isset($_POST['emplname'])) echo $_POST['emplname']; else echo "";?>"></td></tr>
<tr><td colspan="2"><i>Примечание:</i><br><textarea cols="50" rows="3" name="free_descr" value="<?php if (isset($_POST['free_descr'])) echo $_POST['free_descr']; else echo "";?>"></textarea></td>
</tr><tr><td colspan="2"><center><input type="submit" value="Генерировать"></center></td></tr>
<a href="configured/">Сконфигурированные</a><br>
</form>
</table>
</center>
<?php
function mask2cidr($mask){
$long = ip2long($mask);
$base = ip2long('255.255.255.255');
return 32-log(($long ^ $base)+1,2);
/* xor-ing will give you the inverse mask,
log base 2 of that +1 will return the number
of bits that are off in the mask and subtracting
from 32 gets you the cidr notation */
}
function translit($str){
$alphavit = array(
/*--*/
"а"=>"a","б"=>"b","в"=>"v","г"=>"g","д"=>"d","е"=>"e",
"ё"=>"yo","ж"=>"j","з"=>"z","и"=>"i","й"=>"i","к"=>"k","л"=>"l", "м"=>"m",
"н"=>"n","о"=>"o","п"=>"p","р"=>"r","с"=>"s","т"=>"t",
"у"=>"y","ф"=>"f","х"=>"h","ц"=>"c","ч"=>"ch", "ш"=>"sh","щ"=>"sh",
"ы"=>"i","э"=>"e","ю"=>"u","я"=>"ya",
/*--*/
"А"=>"A","Б"=>"B","В"=>"V","Г"=>"G","Д"=>"D","Е"=>"E", "Ё"=>"Yo",
"Ж"=>"J","З"=>"Z","И"=>"I","Й"=>"I","К"=>"K", "Л"=>"L","М"=>"M",
"Н"=>"N","О"=>"O","П"=>"P", "Р"=>"R","С"=>"S","Т"=>"T","У"=>"Y",
"Ф"=>"F", "Х"=>"H","Ц"=>"C","Ч"=>"Ch","Ш"=>"Sh","Щ"=>"Sh",
"Ы"=>"I","Э"=>"E","Ю"=>"U","Я"=>"Ya",
"ь"=>"","Ь"=>"","ъ"=>"","Ъ"=>""
);
return strtr($str, $alphavit);
}
if ($_POST['MODEL']=='Dlink DES-3200-28 C1')
{
$install_address = $_POST['install_address'];
$model = $_POST['MODEL'];
$serial_number = $_POST['serial_number'];
$ip = $_POST['ip'] ;
$mask = mask2cidr($_POST['mask']);
$gw = $_POST['gw'];
$vlanid = $_POST['vlanid'];
$mvlanname= $_POST['mvlanname'];
$mvlanid = $_POST['mvlanid'];
$freedescr = $_POST['free_descr'];
$translitaddress = translit($install_address);
$emplname= $_POST['emplname'];
echo <<<EOT
Полученные параметры:<br>
<b>Планируемый адрес установки:</b> $install_address (snmp location $translitaddress )<br>
<b>Модель:</b> $model <br>
<b>Серийный номер:</b> $serial_number<br>
<b>IP адрес:</b> $ip<br>
<b>Маска:</b> $mask<br>
<b>Шлюз:</b> $gw <br>
<b>Vlan ID:</b> $vlanid<br>
<b>Multicast Vlan ID:</b> $mvlanid</br>
<b>Multicast Vlan Name:</b> $mvlanname</br>
<b>Кто конфигурировал:</b> $emplname</br>
<b>Примечание:</b> $freedescr<br>
EOT;
ob_start();
include 'des3200c1.php';
$saveString = strip_tags(ob_get_flush());
#echo $saveString;
file_put_contents("configured/$date1-$ip-$model.cfg", $saveString);
mail("noc@example.com", "New Switch Configured $date1 by $emplname", "$saveString");
echo $date1;
}
if ($_POST['MODEL']=='SNR 2965')
{
$install_address = $_POST['install_address'];
$model = $_POST['MODEL'];
$serial_number = $_POST['serial_number'];
$ip = $_POST['ip'] ;
$mask = $_POST['mask'];
$gw = $_POST['gw'];
$vlanid = $_POST['vlanid'];
$mvlanid = $_POST['mvlanid'];
$mvlanname= $_POST['mvlanname'];
$freedescr = $_POST['free_descr'];
$translitaddress = translit($install_address);
$emplname= $_POST['emplname'];
echo <<<EOT
Полученные параметры:<br>
<b>Планируемый адрес установки:</b> $install_address (snmp location $translitaddress )<br>
<b>Модель:</b> $model <br>
<b>Серийный номер:</b> $serial_number<br>
<b>IP адрес:</b> $ip<br>
<b>Маска:</b> $mask<br>
<b>Шлюз:</b> $gw <br>
<b>Vlan ID:</b> $vlanid<br>
<b>Multicast Vlan ID:</b> $mvlanid</br>
<b>Multicast Vlan Name:</b> $mvlanname</br>
<b>Кто конфигурировал:</b> $emplname</br>
<b>Примечание:</b> $freedescr<br>
EOT;
ob_start();
include 'snr2965.php';
$saveString = strip_tags(ob_get_flush());
#echo $saveString;
file_put_contents("configured/$date1-$ip-$model.cfg", $saveString);
mail("noc@example.com", "New Switch Configured $date1 by $emplname", "$saveString");
echo $date1;
}
?>
<br><br><br><center>Вопросы <a href="mailto:example@example.com"> example@example.com </a> </center>
</BODY>
</HTML>
Содержимое файла snr2965.php:
<meta charset="utf-8">
<br><br><center>
### ### ### ### ### ### ### ### ### <br>
### Software Upgrade Procedure ### <br>
### ### ### ### ### ### ### ### ### <br>
<table border="1">
<tr>
<td>
enable<br>
config <br>
##Здесь мы обновляем софт перед конфигурированием
##Обычно начальное конфигурирование производится через консоль
in vlan 1<br>
ip address 172.16.0.2 255.255.255.0<br>
end<br>
<br>
<br>
copy tftp://172.16.0.1/fw/SNR/2965/SNR-S2965(S2985G)-48T(24T_8T)_7.0.3.5(R0241.0114)_nos.img 7.0.3.5_R0241.0114.img<br>
<br>
<i>Wait for download complete....<br><br></i>
boot img 7.0.3.5_R0241.0114.img primary<br>
<br><br>
<i>Reboot<br><br></i>
reload<br>
<br><br>
<i>Remove old firmware<br></i>
delete nos.img<br><br><br>
</td>
</tr>
</table>
</center>
<br>
<center>
### ### ### ### ### ### ### ### <br>
### Configuration Procedure ### <br>
### ### ### ### ### ### ### ### <br>
<table border="1">
<tr>
<td>
enable<br>
config <br>
<br>
!<br>
service password-encryption<br>
!<br>
sysLocation <?php echo $translitaddress ?><br>
sysContact noc@example.com <br>
!<br>
username admin privilege 15 password 7 encryptpasswordhere<br>
!<br>
authentication line console login local <br>
authentication line vty login radius local <br>
!<br>
!<br>
clock timezone YEKT add 5 0<br>
!<br>
!<br>
logging 172.16.0.3 facility local7 level debugging<br>
logging loghost sequence-number<br>
logging executed-commands enable<br>
logging flash level debugging<br>
!<br>
snmp-server enable<br>
snmp-server securityip disable<br>
snmp-server enable traps<br>
snmp-server community rw 7 encryptpasswordhere<br>
snmp-server community ro 7 encryptpasswordhere<br>
snmp-server host 172.16.0.4 v2c public<br>
snmp-server host 172.16.0.5 v2c public<br>
!<br>
lldp enable<br>
!<br>
service dhcp<br>
!<br>
ip dhcp snooping enable<br>
ip dhcp snooping vlan 1<br>
ip dhcp snooping binding enable<br>
!<br>
ip dhcp snooping information enable<br>
ip dhcp snooping information option subscriber-id format hex<br>
ip dhcp snooping information option remote-id vs-cisco<br>
!<br>
vlan <?php echo $vlanid ?><br>
!<br>
vlan <?php echo $mvlanid ?><br>
name <?php echo $mvlanname?><br>
multicast-vlan<br>
multicast-vlan mode dynamic<br>
exit<br>
vlan 4090<br>
exit<br>
!<br>
ipv6 access-list extended IPv6SolicitBlock<br>
deny any-source any-destination<br>
exit<br>
!<br>
access-list 6000 permit ip any-source 239.0.0.0 0.0.255.255<br>
access-list 6001 permit ip any-source 239.1.0.0 0.0.255.255<br>
!<br>
multicast destination-control<br>
!<br>
radius-server timeout 5<br>
radius-server retransmit 2<br>
radius-server authentication host 172.16.0.6 key 7 passwordhere<br>
radius-server authentication host 172.16.0.7 key 7 passwordhere<br>
aaa enable<br>
!<br>
!<br>
Interface Ethernet1/0/1<br>
storm-control broadcast 1000<br>
storm-control multicast 1000<br>
ip multicast destination-control access-group 6000<br>
lldp disable<br>
switchport association multicast-vlan <?php echo $mvlanid ?> <br>
loopback-detection specified-vlan 1 <br>
loopback-detection control shutdown <br>
! <br>
Interface Ethernet1/0/2 <br>
storm-control broadcast 1000<br>
storm-control multicast 1000<br>
ip multicast destination-control access-group 6000 <br>
lldp disable <br>
switchport association multicast-vlan <?php echo $mvlanid ?> <br>
loopback-detection specified-vlan 1 <br>
loopback-detection control shutdown <br>
! <br>
Interface Ethernet1/0/3 <br>
storm-control broadcast 1000<br>
storm-control multicast 1000<br>
ip multicast destination-control access-group 6000 <br>
lldp disable <br>
switchport association multicast-vlan <?php echo $mvlanid ?> <br>
loopback-detection specified-vlan 1 <br>
loopback-detection control shutdown <br>
! <br>
Interface Ethernet1/0/4 <br>
storm-control broadcast 1000<br>
storm-control multicast 1000<br>
ip multicast destination-control access-group 6000 <br>
lldp disable <br>
switchport association multicast-vlan <?php echo $mvlanid ?> <br>
loopback-detection specified-vlan 1 <br>
loopback-detection control shutdown <br>
! <br>
Interface Ethernet1/0/5 <br>
storm-control broadcast 1000<br>
storm-control multicast 1000<br>
ip multicast destination-control access-group 6000 <br>
lldp disable <br>
switchport association multicast-vlan <?php echo $mvlanid ?> <br>
loopback-detection specified-vlan 1 <br>
loopback-detection control shutdown <br>
! <br>
Interface Ethernet1/0/6 <br>
storm-control broadcast 1000<br>
storm-control multicast 1000<br>
ip multicast destination-control access-group 6000 <br>
lldp disable <br>
switchport association multicast-vlan <?php echo $mvlanid ?> <br>
loopback-detection specified-vlan 1 <br>
loopback-detection control shutdown <br>
! <br>
Interface Ethernet1/0/7 <br>
storm-control broadcast 1000<br>
storm-control multicast 1000<br>
ip multicast destination-control access-group 6000 <br>
lldp disable <br>
switchport association multicast-vlan <?php echo $mvlanid ?> <br>
loopback-detection specified-vlan 1 <br>
loopback-detection control shutdown <br>
! <br>
Interface Ethernet1/0/8 <br>
storm-control broadcast 1000<br>
storm-control multicast 1000<br>
ip multicast destination-control access-group 6000 <br>
lldp disable <br>
switchport association multicast-vlan <?php echo $mvlanid ?> <br>
loopback-detection specified-vlan 1 <br>
loopback-detection control shutdown <br>
! <br>
Interface Ethernet1/0/9 <br>
storm-control broadcast 1000<br>
storm-control multicast 1000<br>
ip multicast destination-control access-group 6000 <br>
lldp disable <br>
switchport association multicast-vlan <?php echo $mvlanid ?> <br>
loopback-detection specified-vlan 1 <br>
loopback-detection control shutdown <br>
! <br>
Interface Ethernet1/0/10 <br>
storm-control broadcast 1000<br>
storm-control multicast 1000<br>
ip multicast destination-control access-group 6000 <br>
lldp disable <br>
switchport association multicast-vlan <?php echo $mvlanid ?> <br>
loopback-detection specified-vlan 1 <br>
loopback-detection control shutdown <br>
! <br>
Interface Ethernet1/0/11 <br>
storm-control broadcast 1000<br>
storm-control multicast 1000<br>
ip multicast destination-control access-group 6000 <br>
lldp disable <br>
switchport association multicast-vlan <?php echo $mvlanid ?> <br>
loopback-detection specified-vlan 1 <br>
loopback-detection control shutdown <br>
! <br>
Interface Ethernet1/0/12 <br>
storm-control broadcast 1000<br>
storm-control multicast 1000<br>
ip multicast destination-control access-group 6000 <br>
lldp disable <br>
switchport association multicast-vlan <?php echo $mvlanid ?> <br>
loopback-detection specified-vlan 1 <br>
loopback-detection control shutdown <br>
! <br>
Interface Ethernet1/0/13 <br>
storm-control broadcast 1000<br>
storm-control multicast 1000<br>
ip multicast destination-control access-group 6000 <br>
lldp disable <br>
switchport association multicast-vlan <?php echo $mvlanid ?> <br>
loopback-detection specified-vlan 1 <br>
loopback-detection control shutdown <br>
! <br>
Interface Ethernet1/0/14 <br>
storm-control broadcast 1000<br>
storm-control multicast 1000<br>
ip multicast destination-control access-group 6000 <br>
lldp disable <br>
switchport association multicast-vlan <?php echo $mvlanid ?> <br>
loopback-detection specified-vlan 1 <br>
loopback-detection control shutdown <br>
! <br>
Interface Ethernet1/0/15 <br>
storm-control broadcast 1000<br>
storm-control multicast 1000<br>
ip multicast destination-control access-group 6000 <br>
lldp disable <br>
switchport association multicast-vlan <?php echo $mvlanid ?> <br>
loopback-detection specified-vlan 1 <br>
loopback-detection control shutdown <br>
! <br>
Interface Ethernet1/0/16 <br>
storm-control broadcast 1000<br>
storm-control multicast 1000<br>
ip multicast destination-control access-group 6000 <br>
lldp disable <br>
switchport association multicast-vlan <?php echo $mvlanid ?> <br>
loopback-detection specified-vlan 1 <br>
loopback-detection control shutdown <br>
! <br>
Interface Ethernet1/0/17 <br>
storm-control broadcast 1000<br>
storm-control multicast 1000<br>
ip multicast destination-control access-group 6000 <br>
lldp disable <br>
switchport association multicast-vlan <?php echo $mvlanid ?> <br>
loopback-detection specified-vlan 1 <br>
loopback-detection control shutdown <br>
! <br>
Interface Ethernet1/0/18 <br>
storm-control broadcast 1000<br>
storm-control multicast 1000<br>
ip multicast destination-control access-group 6000 <br>
lldp disable <br>
switchport association multicast-vlan <?php echo $mvlanid ?> <br>
loopback-detection specified-vlan 1 <br>
loopback-detection control shutdown <br>
! <br>
Interface Ethernet1/0/19 <br>
storm-control broadcast 1000<br>
storm-control multicast 1000<br>
ip multicast destination-control access-group 6000 <br>
lldp disable <br>
switchport association multicast-vlan <?php echo $mvlanid ?> <br>
loopback-detection specified-vlan 1 <br>
loopback-detection control shutdown <br>
! <br>
Interface Ethernet1/0/20 <br>
storm-control broadcast 1000<br>
storm-control multicast 1000<br>
ip multicast destination-control access-group 6000 <br>
lldp disable <br>
switchport association multicast-vlan <?php echo $mvlanid ?> <br>
loopback-detection specified-vlan 1 <br>
loopback-detection control shutdown <br>
! <br>
Interface Ethernet1/0/21 <br>
storm-control broadcast 1000<br>
storm-control multicast 1000<br>
ip multicast destination-control access-group 6000 <br>
lldp disable <br>
switchport association multicast-vlan <?php echo $mvlanid ?> <br>
loopback-detection specified-vlan 1 <br>
loopback-detection control shutdown <br>
! <br>
Interface Ethernet1/0/22 <br>
storm-control broadcast 1000<br>
storm-control multicast 1000<br>
ip multicast destination-control access-group 6000 <br>
lldp disable <br>
switchport association multicast-vlan <?php echo $mvlanid ?> <br>
loopback-detection specified-vlan 1 <br>
loopback-detection control shutdown <br>
! <br>
Interface Ethernet1/0/23 <br>
storm-control broadcast 1000<br>
storm-control multicast 1000<br>
ip multicast destination-control access-group 6000 <br>
lldp disable <br>
switchport association multicast-vlan <?php echo $mvlanid ?> <br>
loopback-detection specified-vlan 1 <br>
loopback-detection control shutdown <br>
! <br>
Interface Ethernet1/0/24<br>
switchport mode trunk<br>
switchport trunk allowed vlan <?php echo $vlanid ?>;<?php echo $mvlanid ?><br>
!<br>
Interface Ethernet1/0/25<br>
switchport mode trunk<br>
switchport trunk allowed vlan <?php echo $vlanid ?>;<?php echo $mvlanid ?><br>
!<br>
Interface Ethernet1/0/26<br>
switchport mode trunk<br>
switchport trunk allowed vlan <?php echo $vlanid ?>;<?php echo $mvlanid ?><br>
!<br>
Interface Ethernet1/0/27<br>
switchport mode trunk<br>
switchport trunk allowed vlan <?php echo $vlanid ?>;<?php echo $mvlanid ?><br>
!<br>
Interface Ethernet1/0/28<br>
switchport mode trunk<br>
switchport trunk allowed vlan <?php echo $vlanid ?>;<?php echo $mvlanid ?><br>
!<br>
no int vlan1<br>
!<br>
interface vlan <?php echo $vlanid ?><br>
ip address <?php echo $ip ?> <?php echo $mask ?><br>
!<br>
ip igmp snooping<br>
no ip igmp snooping proxy<br>
ip igmp snooping vlan <?php echo $mvlanid ?><br>
ip igmp snooping vlan <?php echo $mvlanid ?> limit group 150<br>
!<br>
ip default-gateway <?php echo $gw ?><br>
!<br>
sntp server 172.16.0.100<br>
!<br>
logging 172.16.0.101 facility local7 level debugging<br>
logging 172.16.0.102 facility local7 level debugging<br>
logging loghost sequence-number<br>
logging executed-commands enable<br>
logging flash level debugging<br>
!<br>
!<br>
end<br>
<br>
write<br>
</td>
</tr>
</table>
</center>
Содержимое файла des3200c1.php:
<center>
<br><br>
### ### ### ### ### ### ### ### ### <br>
### Software Upgrade Procedure ### <br>
### ### ### ### ### ### ### ### ### <br>
<table border="1">
<tr>
<td>
<i> Для DES3200-28C1 процедура обновления заключается в обновлении ПО сначала до версии DES3200R_4.38.B000.had , затем на актуальную. First you must upgrade firmware to DES3200R_4.38.B000.had , then to actual firmware</i>
<br>
<br>
config ipif System ipaddress 172.16.0.2/24 <br>
delete iproute default <br>
create iproute default 172.16.0.1 <br>
download firmware_fromTFTP 172.16.0.1 src_file DES3200R_4.38.B000.had <br>
<br>
reboot <br>
<br>
<br>
config ipif System ipaddress 172.16.0.2/24 <br>
delete iproute default <br>
create iproute default 172.16.0.1 <br>
download firmware_fromTFTP 172.16.0.1 src_file fw/DES-3200-28-C1/DES3200R_4.42.B004.had <br>
<br>
reboot <br>
</td>
</tr>
</table>
<br>
### ### ### ### ### ### ### ### <br>
### Configuration Procedure ### <br>
### ### ### ### ### ### ### ### <br>
<br>
<table border="1">
<tr>
<td>
<br>
enable password encryption <br>
<br>
create account admin admin encrypt sha_1 *encryptpasswordhere<br>
<br>
create account user sup encrypt sha_1 *encryptpasswordhere<br>
<br>
create authen server_host 172.16.0.6 protocol radius port 1812 key "ThisIsnotREALPASSWD" timeout 5 retransmit 2 <br>
create authen server_host 172.16.0.7 protocol radius port 1812 key "ThisIsnotREALPASSWD" timeout 5 retransmit 2 <br>
config authen_login default method local <br>
create authen_login method_list_name rad_ext <br>
config authen_login method_list_name rad_ext method radius local <br>
config authen_enable default method local_enable <br>
create authen_enable method_list_name rad_ext_ena <br>
config authen_enable method_list_name rad_ext_ena method radius <br>
config authen application console login default <br>
config authen application console enable default <br>
config authen application telnet login method_list_name rad_ext <br>
config authen application telnet enable method_list_name rad_ext_ena <br>
config authen application ssh login default <br>
config authen application ssh enable default <br>
config authen application http login default <br>
config authen application http enable default <br>
config authen parameter response_timeout 0 <br>
config authen parameter attempt 3 <br>
enable authen_policy <br>
<br>
create snmp community private view CommunityView read_write <br>
create snmp community public view CommunityView read_only <br>
config snmp system_location <b><?php echo $translitaddress ?></b> <br>
enable snmp <br>
enable community_encryption <br>
<br>
config ipif System ipaddress <b><?php echo $ip ?>/<?php echo $mask ?></b><br>
delete iproute default <br>
create iproute default <b><?php echo $gw ?></b> <br>
<br>
disable web <br>
<br>
enable lldp <br>
config lldp ports 25-28 admin_status enable <br>
config lldp ports 25-28 basic_tlvs all enable <br>
config lldp ports 25-28 notification enable <br>
config lldp ports 1-24 admin_status disable <br>
<br>
config sntp primary 172.16.0.100 poll-interval 3600 <br>
config time_zone operator + hour 5 min 0 <br>
enable sntp <br>
<br>
config traffic control 1-24 broadcast enable threshold 64 multicast enable <br>
config traffic control 25-28 broadcast enable threshold 1024 <br>
<br>
config loopdetect ports 1-24 state enable <br>
config stp ports 1-28 state disable fbpdu disable <br>
config loopdetect recover_timer 0 <br>
enable loopdetect <br>
<br>
config log_save_timing time_interval 30 <br>
<br>
enable command logging <br>
<br>
config ports 26 medium_type fiber state disable <br>
config ports 26-28 state disable <br>
<br>
create vlan manager_<b><?php echo $vlanid ?></b> tag <b><?php echo $vlanid ?></b> <br>
config vlan manager_<b><?php echo $vlanid ?></b> add tagged 25-28 <br>
config ipif System vlan manager_<b><?php echo $vlanid ?></b> <br>
<br>
create igmp_snooping multicast_vlan <b><?php echo $mvlanname?></b> <b><?php echo $mvlanid ?></b> <br>
config igmp_snooping multicast_vlan <b><?php echo $mvlanname?></b> add member_port 1-23 state enable <br>
config igmp_snooping multicast_vlan <b><?php echo $mvlanname ?></b> remap_priority 6 replace_priority <br>
config multicast port_filtering_mode all filter_unregistered_groups <br>
enable igmp_snooping multicast_vlan <br>
enable igmp_snooping <br>
<br>
create mcast_filter_profile profile_id 1 profile_name CLEAN <br>
config mcast_filter_profile profile_id 1 add 239.0.0.0-239.1.255.255 <br>
config limited_multicast_addr ports 1-28 add profile_id 1 <br>
config igmp_snooping multicast_vlan_group <b><?php echo $mvlanname ?></b> add 239.0.0.0-239.1.255.255 <br>
config igmp_snooping data_driven_learning all aged_out disable <br>
config igmp_snooping data_driven_learning vlan_name <b><?php echo $mvlanname ?></b> aged_out enable <br>
config igmp_snooping data_driven_learning max_learned_entry 64 <br>
config igmp_snooping data_driven_learning all state disable <br>
config igmp_snooping data_driven_learning vlan_name <b><?php echo $mvlanname ?></b> state enable <br>
config igmp_snooping vlan_name<b> <?php echo $mvlanname ?></b> fast_leave disable <br>
<br>
#SYSLOG <br>
enable syslog <br>
create syslog host 1 ipaddress 172.16.0.101 severity 7 facility local7 udp_port 514 state enable <br>
create syslog host 3 ipaddress 172.16.0.102 severity debug facility local7 udp_port 514 state enable <br>
<br>
config dhcp_local_relay vlan vlanid 1 state enable <br>
enable dhcp_local_relay<br>
config dhcp_local_relay option_82 ports 1-24 policy replace <br>
<br>
enable snmp traps <br>
enable snmp linkchange_traps <br>
config snmp linkchange_traps ports 24 enable<br>
config snmp coldstart_traps enable<br>
config snmp warmstart_traps enable<br>
create snmp host 172.16.0.4 v2c public<br>
create snmp host 172.16.0.5 v2c public<br>
<br>
<br>
disable password_recovery<br><br>
save <br>
</td>
</tr>
</table>
</center>
Комментариев нет:
Отправить комментарий