Страница 1 из 2

Запретить трафик на порту

Добавлено: 07 апр 2016, 11:09
avs
День добрый.
Помогите пожалуйста разобраться. Есть RB2011uas Порты eth1-eth5 в бридже. В eth5 подкл. устройство с адресом 192.168.10.82. необходимо заблокировать на интерфейсе eth5 любой трафик(кроме icmp на устройство 10.82) Адрес 192.168.10.82 может меняться. Вот скрин как я пробовал, настроить правила в ip\firewall:
Изображение
Правила 0 и 1 прекрасно работают, но как выше сказано адрес может меняться. Вопрос почему не отрабатывают правила 2 и 3 или чего-то не хватает?

Re: Запретить трафик на порту

Добавлено: 07 апр 2016, 11:11
vqd
2 и 3 в цепочку форвард и будет вам счастье

Re: Запретить трафик на порту

Добавлено: 07 апр 2016, 11:12
avs
Пробовал выбирать chain - forward в правите 2 и 3 - результат тот же трафик все-равно идет =(

Re: Запретить трафик на порту

Добавлено: 07 апр 2016, 11:25
vqd
Ну попробуем дальше погадать

/interface bridge settings set use-ip-firewall=yes

Re: Запретить трафик на порту

Добавлено: 07 апр 2016, 11:40
avs
Чтобы не гадать выкладываю export. Может я где-то накосячил.


 Конфиг

Код: Выделить всё

# apr/07/2016 05:38:24 by RouterOS 6.7
# software id = AM1C-RYNU
#
/interface bridge
add admin-mac=D4:CA:6D:A2:47:FA auto-mac=no l2mtu=1598 name=LanNAT \
    protocol-mode=rstp
add l2mtu=1598 name=bridgeITS
/interface ethernet
set [ find default-name=ether1 ] name=ether1-WAN
set [ find default-name=ether6 ] name=ether6-WAN
set [ find default-name=sfp1 ] name=sfp1-gateway
/ip neighbor discovery
set ether1-WAN discover=no
set sfp1-gateway discover=no
/ip hotspot user profile
set [ find default=yes ] idle-timeout=none keepalive-timeout=2m \
    mac-cookie-timeout=3d
/ip pool
add name=default-dhcp ranges=192.168.88.10-192.168.88.254
add name=dhcp_pool1 ranges=172.16.10.20-172.16.10.100
/ip dhcp-server
add address-pool=dhcp_pool1 disabled=no interface=LanNAT lease-time=1d name=\
    dhcp1
/port
set 0 name=serial0
/interface bridge port
add bridge=bridgeITS interface=ether2
add bridge=LanNAT interface=ether7
add bridge=LanNAT interface=ether8
add bridge=LanNAT interface=ether9
add bridge=LanNAT interface=ether10
add bridge=bridgeITS interface=ether3
add bridge=bridgeITS interface=ether4
add bridge=bridgeITS interface=ether5
/interface bridge settings
set use-ip-firewall=yes
/ip address
add address=172.16.10.1/24 interface=LanNAT network=172.16.10.0
/ip dhcp-client
add comment="default configuration" dhcp-options=hostname,clientid disabled=no \
    interface=sfp1-gateway
add comment="default configuration" dhcp-options=hostname,clientid disabled=no \
    interface=ether1-WAN
add default-route-distance=0 dhcp-options=hostname,clientid disabled=no \
    interface=ether6-WAN
/ip dhcp-server network
add address=172.16.10.0/24 gateway=172.16.10.1
add address=192.168.88.0/24 comment="default configuration" dns-server=\
    192.168.88.1 gateway=192.168.88.1
/ip dns
set allow-remote-requests=yes servers=192.168.10.1
/ip dns static
add address=192.168.88.1 name=router
/ip firewall filter
add action=drop chain=forward disabled=yes src-address=192.168.10.82
add action=drop chain=forward disabled=yes dst-address=192.168.10.82
add action=drop chain=forward in-interface=ether5
add action=drop chain=forward out-interface=ether5
add chain=input comment="default configuration" protocol=icmp
add chain=input comment="default configuration" connection-state=established
add chain=input comment="default configuration" connection-state=related
add action=drop chain=input comment="default configuration" in-interface=\
    sfp1-gateway
add chain=forward comment="default configuration" connection-state=established
add chain=forward comment="default configuration" connection-state=related
add action=drop chain=forward comment="default configuration" connection-state=\
    invalid
/ip firewall nat
add action=masquerade chain=srcnat comment="default configuration" \
    out-interface=sfp1-gateway
add action=masquerade chain=srcnat comment="default configuration" \
    out-interface=ether1-WAN
add action=masquerade chain=srcnat out-interface=ether6-WAN
/lcd interface
set sfp1-gateway interface=sfp1-gateway
set ether1-WAN interface=ether1-WAN
set ether2 interface=ether2
set ether3 interface=ether3
set ether4 interface=ether4
set ether5 interface=ether5
set ether6-WAN interface=ether6-WAN
set ether7 interface=ether7
set ether8 interface=ether8
set ether9 interface=ether9
set ether10 interface=ether10
/system clock
set time-zone-name=Etc/GMT+3
/system ntp client
set enabled=yes mode=unicast primary-ntp=178.124.164.107
/tool mac-server
set [ find default=yes ] disabled=yes
add interface=ether2
add interface=ether3
add interface=ether4
add interface=ether5
add interface=ether6-WAN
add interface=ether7
add interface=ether8
add interface=ether9
add interface=LanNAT
/tool mac-server mac-winbox
set [ find default=yes ] disabled=yes
add interface=ether2
add interface=ether3
add interface=ether4
add interface=ether5
add interface=ether6-WAN
add interface=ether7
add interface=ether8
add interface=ether9
add interface=LanNAT

Re: Запретить трафик на порту

Добавлено: 07 апр 2016, 11:46
vqd
хм, оказывается по интерфейсам так не работает.

Сделайте фильтр тут /interface bridge filter

Re: Запретить трафик на порту

Добавлено: 07 апр 2016, 12:02
avs
vqd писал(а):хм, оказывается по интерфейсам так не работает.

Сделайте фильтр тут /interface bridge filter

Спасибо, трафик блокируется.
/interface bridge filter
add action=drop chain=forward out-interface=ether5
add action=drop chain=forward in-interface=ether5

Остался мелкий вопрос как исключить из блокировки icmp? В разделе Bridge\Filters Во вкладке general-ip поля "src.port","dst.port" и "protocol" не активны.

Re: Запретить трафик на порту

Добавлено: 07 апр 2016, 12:11
vqd
/interface bridge filter
add chain=forward ip-protocol=icmp mac-protocol=ip

и перед дропами

Re: Запретить трафик на порту

Добавлено: 07 апр 2016, 13:16
avs
/interface bridge filter
add chain=forward ip-protocol=icmp mac-protocol=ip
add action=drop chain=forward out-interface=ether5
add action=drop chain=forward in-interface=ether5

Странно. Устройство с адресом 192.168.10.82 не пингуется, ответ:
HOST SIZE TTL TIME STATUS
192.168.10.82 timeout
192.168.10.68 84 64 215ms host unreachable
192.168.10.82 timeout
192.168.10.82 timeout

Кажется чего-то не хватает :-( .

Re: Запретить трафик на порту

Добавлено: 07 апр 2016, 13:18
vqd
а галочку то сняли ?
/interface bridge settings set use-ip-firewall=yes