firewall_nat.cfg

Skip to end of metadata
Go to start of metadata
/ip firewall nat remove [/ip firewall nat find chain=crb_dnat]
/ip firewall nat remove [/ip firewall nat find chain=crb_snat]

### сервисные сети не снатим не днатим
/ip firewall nat add chain=crb_dnat comment=return_service_net src-address-list=crb_service_net action=return
/ip firewall nat add chain=crb_dnat comment=return_service_net dst-address-list=crb_service_net action=return
/ip firewall nat add chain=crb_snat comment=return_service_net src-address-list=crb_service_net action=return
/ip firewall nat add chain=crb_snat comment=return_service_net dst-address-list=crb_service_net action=return

### опционально, неавторизованных можно не редректить на страницу noauth.php
@@@ if skip_noauth == '1'
/ip firewall nat add chain=crb_dnat src-address-list=!crb_auth_list dst-address-list=!crb_auth_list action=return
@@@ endif

### все что идет в/из кабинета не редиректим
/ip firewall nat add chain=crb_dnat comment=dnat_cabinet_accept_dst dst-address={{cabinet_ip}} action=accept
/ip firewall nat add chain=crb_dnat comment=dnat_cabinet_accept_src src-address={{cabinet_ip}} action=accept

### неавторизованных редиректим на ip_кабинет:noauth_redirect_port
/ip firewall nat add chain=crb_dnat comment="noauth_redirect" protocol=tcp src-address-list=!crb_auth_list dst-address-list=!crb_auth_list dst-port=80 to-addresses={{cabinet_ip}} to-ports={{noauth_redirect_port}} action=dst-nat

### не редиректим при доступе на разрешенные сайты при блокировке админом
/ip firewall nat add chain=crb_dnat comment="trust_bloked_return" protocol=tcp dst-address-list=crb_trust_blocked_list dst-port=80 action=return

### заблокированных редиректим на ip_кабинет:blocked_redirect_port
/ip firewall nat add chain=crb_dnat comment="blocked_redirect" protocol=tcp src-address-list=crb_blocked_list dst-port=80 to-addresses={{cabinet_ip}} to-ports={{blocked_redirect_port}} action=dst-nat

### отрицательный баланс редиректим на ip_кабинет:negbal_redirect_port, кроме списка разрешенных сайтов crb_trust_negbal_list
/ip firewall nat add chain=crb_dnat comment="negbal_redirect" protocol=tcp src-address-list=crb_negbal_list dst-address-list=!crb_trust_negbal_list dst-port=80 to-addresses={{cabinet_ip}} to-ports={{negbal_redirect_port}} action=dst-nat

### создаем первым правило jump из основного dstnat в crb_dnat
/ip firewall nat remove [/ip firewall nat find jump-target=crb_dnat]
/ip firewall nat add chain=dstnat action=jump jump-target=crb_dnat place-before=0

### опционально неавторизованных можно пропустить и не снатить
@@@ if skip_noauth == '1'
/ip firewall nat add chain=crb_snat src-address-list=!crb_auth_list dst-address-list=!crb_auth_list action=return
@@@ endif

### по дефалту маскарадим всех из crb_gray_net
/ip firewall nat add chain=crb_snat comment=snat_abonents_masquerade src-address-list=crb_gray_net dst-address-list=!crb_gray_net action=masquerade

### создаем первым правило jump из основного srcnat в crb_snat
/ip firewall nat remove [/ip firewall nat find jump-target=crb_snat]
# print надо для работы place-before=0
/ip firewall nat print without-paging
/ip firewall nat add chain=srcnat action=jump jump-target=crb_snat place-before=0
Введите метки, чтобы добавить к этой странице:
Please wait 
Ищите метку? просто начните печатать.