Здравствуйте!
Подскажите,пожалуйста,как можно объединить несколько команд,отправляемых коммутатору по snmp ,в одну строку?У меня вот такой набор правил,сделанных по примеру How-to для DES-3200 series
Код:
create access_profile packet_content_mask offset1 l3 12 0xFFFF offset2 l3 14 0xFFFF profile_id 14
config access_profile profile_id 14 add access_id auto_assign packet_content offset1 0xc0a8 offset2 0x00a9 port x deny
Это правило блокирует IP адрес 192.168.0.169 на порту коммутатора.Через SNMP это выглядит так:
Код:
snmpset -v2c -c private 192.168.x.x .1.3.6.1.4.1.171.12.9.2.10.2.1.3.14.1 i 2 1.3.6.1.4.1.171.12.9.2.10.2.1.4.14.1 i 12 1.3.6.1.4.1.171.12.9.2.10.2.1.5.14.1 x FFFF 1.3.6.1.4.1.171.12.9.2.10.2.1.6.14.1 i 4 - создание ACL 14 offset 1
#create access_profile packet_content_mask offset2 l3 14 0xFFFF profile_id 14
snmpset -v2c -c private 192.168.x.x .1.3.6.1.4.1.171.12.9.2.10.2.1.3.14.2 i 2 1.3.6.1.4.1.171.12.9.2.10.2.1.4.14.2 i 14 1.3.6.1.4.1.171.12.9.2.10.2.1.5.14.2 x FFFF 1.3.6.1.4.1.171.12.9.2.10.2.1.6.14.2 i 4 - создание ACL 14 offset 2
Создание правила для профиля ACl 14
Add an Access Rule. (It's equal to the command of "config access_profile profile_id 14 add access_id 1 packet_content offset1 0xc0a8)
snmpset -v2c -c private 192.168.x.x 1.3.6.1.4.1.171.12.9.3.10.2.1.4.14.1.1 x c0a8 1.3.6.1.4.1.171.12.9.3.10.2.1.5.14.1.1 i 4 1.3.6.1.4.1.171.12.9.3.10.2.1.6.14.1.1 x 0000
Add an Access Rule. (It's equal to the command of "config access_profile profile_id 14 add access_id 1 packet_content offset1 0x00a9)
snmpset -v2c -c private 192.168.x.x 1.3.6.1.4.1.171.12.9.3.10.2.1.4.14.1.2 x 00a9 1.3.6.1.4.1.171.12.9.3.10.2.1.5.14.1.2 i 4 1.3.6.1.4.1.171.12.9.3.10.2.1.6.14.1.2 x 0000
Применение правила для определенного порта
Assign the Access Rule we created in STEP2 to port 10. . (It's equal to the command of "config access_profile profile_id 1 add access_id 1 packet_content offset1 0x800 port 10 deny")
snmpset -v2c -c private 192.168.x.x 1.3.6.1.4.1.171.12.9.3.10.1.1.12.14.1 i 1 1.3.6.1.4.1.171.12.9.3.10.1.1.13.14.1 x 0040000000000000 1.3.6.1.4.1.171.12.9.3.10.1.1.21.14.1 i 4
Можно ли все это уместить в одной команде ?