Пример. Разрешен доступ к определённым хостам в Интернет MikroTik-Simple

Ключ
Эта строка удалена.
Это слово было удалено. Это слово было добавлено.
Эта строка добавлена.

Изменения (5)

просмотр истории страницы
/ip firewall filter add chain=crb_forward comment=trust_custom_accept_dst dst-address-list=crb_trust_custom_list src-address-list=crb_custom_auth_list action=accept
/ip firewall filter add chain=crb_forward comment=trust_custom_accept_src src-address-list=crb_trust_custom_list dst-address-list=crb_custom_auth_list action=accept
/ip firewall filter add chain=crb_forward comment=trust_custom_drop_dst dst-address-list=!crb_trust_custom_list src-address-list=crb_custom_auth_list action=drop
/ip firewall filter add chain=crb_forward comment=trust_custom_drop_src src-address-list=!crb_trust_custom_list dst-address-list=crb_custom_auth_list action=drop
{code}

/ip firewall filter move numbers=[find comment=trust_custom_accept_src] destination=[[find comment=drop_no_auth] -1 ]
/ip firewall filter move numbers=[find comment=trust_custom_accept_dst] destination=[[find comment=drop_no_auth] -2 ]
/ip firewall filter move numbers=[find comment=trust_custom_drop_dst] destination=[[find comment=drop_no_auth] -3 ]
/ip firewall filter move numbers=[find comment=trust_custom_drop_src] destination=[[find comment=drop_no_auth] -4 ]
{code}

h6. 3. Модифицируем скрипт событий:

Для заполнения адрес листа *crb_custom_auth_list* ip адресами абонентов нужно модифицировать скрипт [session|Пользовательская custom схема]. Переопределим две функции *user_add* и *user_del* Так же обратите внимание, что в примере используется переменная *tarif_id* равная *1136*. Это значит, что адреса в список *crb_custom_auth_list* будут добавляться только, для абоенентов с id тарифа *1136*.

{code}

user_add(){
if [ "$auth_type" == "1" ] && ! [ "$tarif_id" == "1136" ]; then
while send_mikrotik_cmd -s "$nas_ip" "$telnet_login" "$telnet_password" /ip firewall address-list remove numbers=${ip}_crb_auth; do :; done
send_mikrotik_cmd "$nas_ip" "${telnet_login}" "${telnet_password}" /ip firewall address-list add list=crb_auth_list address=$ip comment=${ip}_crb_auth
fi
if [ "$auth_type" == "1" ] && [ "$tarif_id" == "1136" ]; then
while send_mikrotik_cmd -s "$nas_ip" "$telnet_login" "$telnet_password" /ip firewall address-list remove numbers=${ip}_crb_custom_auth; do :; done
send_mikrotik_cmd "$nas_ip" "${telnet_login}" "${telnet_password}" /ip firewall address-list add list=crb_custom_auth_list address=$ip comment=${ip}_crb_custom_auth