Mikrotik - Firewall - Podstawowe reguły Kategoria: MikroTik | Tagi: firewall, mikrotik | Autor: Bartłomiej Gałęzia

1. Najpierw trzeba ustawić maskaradę na interfejsie WAN (jeśli adres IP WAN jest zmienny) lub srcnat (jeśli adres IP WAN jest stały).

IP > Firewall > [zakładka] NAT > [+]
[zakładka] General
Chain: srcnat
Out Interface: ether1-WAN
[zakładka] Action
Action: masquerade
OK

lub

IP > Firewall > [zakładka] NAT > [+]
[zakładka] General
Chain: srcnat
Out Interface: ether1-WAN
[zakładka] Action
Action: src-nat
To Addresses: 10.20.30.1
OK

2. Teraz wpuszczamy wszystkie połączenia nawiązane (Established, Related).

IP > Firewall > [zakładka] Filter Rules > [+]
[zakładka] General
Chain: forward
Connection State: established,related
[zakładka] Action
Action: accept
OK

3. Wpuszczamy połączenia do serwera DHCP

IP > Firewall > [zakładka] Filter Rules > [+]
[zakładka] General
Chain: input
Protocol: 17 (udp)
Dst: Port: 67,68
In Interface: bridge_lan
[zakładka] Action
Action: accept
OK

4. Wpuszczamy wszystko w naszej podsieci

IP > Firewall > [zakładka] Filter Rules > [+]
[zakładka] General
Chain: forward
Src. Address: 10.50.0.0/16
In Interface: bridge_lan
Out Interface: bridge_lan [zakładka] Action Action: accept OK

5. Blokujemy torrenty na portach 6881-6999

IP > Firewall > [zakładka] Filter Rules > [+]
[zakładka] General
Chain: forward
Protocol: 17 (udp)
Dst. Port: 6881-6999 In Interface: bridge_lan
Out Interface: bridge_lan [zakładka] Action Action: drop OK

6. Blokujemy ruch z podsieci .100 (opcjonalnie)

IP > Firewall > [zakładka] Filter Rules > [+]
[zakładka] General
Chain: forward
Src. Address: 10.50.100.0/24
In Interface: bridge_lan
Out Interface: bridge_lan [zakładka] Action Action: drop OK

7. Dopuszczamy sieci VPN

IP > Firewall > [zakładka] Address Lists > [+]
Name: vpn-nets
Address: 10.10.0.0./16
[OK]
IP > Firewall > [zakładka] Address Lists > [+]
Name: vpn-nets
Address: 10.30.0.0./16
[OK]
IP > Firewall > [zakładka] Filter Rules > [+]
[zakładka] General
Chain: forward
In Interface: bridge_lan
Out Interface: bridge_lan

[zakładka] Advanced
Src. Address List: vpn-nets

[zakładka] Action
Action: accept

[OK]

8. Blokujemy wszystko pozostałe

IP > Firewall > [zakładka] Filter Rules > [+]
[zakładka] General
Chain: forward
In Interface: bridge_lan
Out Interface: bridge_lan [zakładka] Action Action: drop OK

Wiersz poleceń

/ip firewall nat add action=src-nat chain=srcnat out-interface=ether1-WAN to-addresses=10.50.30.1
/ip firewall filter add action=accept chain=forward comment="Accept Established, Related" connection-state=established,related
/ip firewall filter add action=accept chain=input comment="Accept DHCP" dst-port=67,68 in-interface=bridge_lan protocol=udp
/ip firewall filter add action=drop chain=forward comment="Drop Torrent" dst-port=6881-6999 in-interface=bridge_lan out-interface=bridge_lan protocol=udp
/ip firewall filter add action=drop chain=forward comment="Drop forward from 10.50.100.0/24" in-interface=bridge_lan out-interface=bridge_lan src-address=10.50.100.0/24
/ip firewall filter add action=accept chain=forward comment="Accept from vpn-nets" in-interface=bridge_lan out-interface=bridge_lan src-address-list=vpn-nets
/ip firewall filter add action=accept chain=forward comment="Accept from 10.50.0.0/16" in-interface=bridge_lan out-interface=bridge_lan src-address=10.50.0.0/16
/ip firewall filter add action=drop chain=forward comment="Drop All" in-interface=bridge_lan out-interface=bridge_lan

Dodaj komentarz

Brak komentarzy, bądź pierwszy i dodaj swój komentarz