This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
mikrotik [2015/07/23 14:44] ww |
mikrotik [2022/03/16 09:52] (current) ww |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== MikroTik ====== | ====== MikroTik ====== | ||
| + | |||
| + | ===== Blokování stránek ===== | ||
| + | |||
| + | ==== facebook ==== | ||
| + | |||
| + | < | ||
| + | /ip firewall address-list add comment=" | ||
| + | /ip firewall address-list add comment=" | ||
| + | /ip firewall address-list add comment=" | ||
| + | /ip firewall address-list add comment=" | ||
| + | /ip firewall address-list add comment=" | ||
| + | /ip firewall address-list add comment=" | ||
| + | /ip firewall address-list add comment=" | ||
| + | /ip firewall address-list add comment=" | ||
| + | /ip firewall address-list add comment=" | ||
| + | /ip firewall address-list add comment=" | ||
| + | /ip firewall address-list add comment=" | ||
| + | /ip firewall address-list add comment=" | ||
| + | /ip firewall address-list add comment=" | ||
| + | /ip firewall address-list add comment=" | ||
| + | |||
| + | /ipv6 firewall address-list add comment=" | ||
| + | /ipv6 firewall address-list add comment=" | ||
| + | |||
| + | /ip | ||
| + | /ipv6 firewall filter add chain=forward src-address=LAN-Address dst-address-list=facebookv6 action=drop | ||
| + | </ | ||
| + | |||
| + | Zdroj: [[https:// | ||
| + | |||
| + | ---- | ||
| ===== LTE ===== | ===== LTE ===== | ||
| Line 55: | Line 86: | ||
| - Set up masquerade for the second wan interface (assuming that masquerade was set up only for the '' | - Set up masquerade for the second wan interface (assuming that masquerade was set up only for the '' | ||
| + | ---- | ||
| + | |||
| + | ===== IPv4 firewall stub ===== | ||
| + | /ip firewall filter | ||
| + | add chain=forward | ||
| + | add chain=forward | ||
| + | add chain=forward | ||
| + | add chain=forward | ||
| + | | ||
| + | | ||
| + | add chain=input | ||
| + | add chain=input | ||
| + | add chain=input | ||
| + | add chain=input | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== IPv6 firewall stub ===== | ||
| + | /ipv6 firewall filter | ||
| + | add chain=forward connection-state=established | ||
| + | add chain=forward connection-state=related | ||
| + | add chain=forward in-interface-list=WAN protocol=icmpv6 | ||
| + | add chain=forward in-interface-list=WAN | ||
| + | add chain=input | ||
| + | add chain=input | ||
| + | add chain=input | ||
| + | add chain=input | ||
| + | add chain=input | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== L2TP + IPsec ===== | ||
| + | |||
| + | * [[https:// | ||
| + | |||
| + | 1) Povolit IPsec na firewallu | ||
| + | < | ||
| + | /ip firewall filter | ||
| + | add chain=input protocol=udp in-interface=ether1 dst-port=500, | ||
| + | add chain=input protocol=ipsec-esp in-interface=ether1 action=accept | ||
| + | add chain=input protocol=ipsec-ah | ||
| + | </ | ||
| + | |||
| + | 2) Vytvořit IP Pool - ze stejného rozsahu jako LAN (tj. třeba zkrátit ten stávající). | ||
| + | |||
| + | 3) Vytvořit PPP profil | ||
| + | < | ||
| + | add name=my-l2tp-profile local-address=192.168.88.254 remote-address=vpnpool dns-server=192.168.88.1 change-tcp-mss=yes interface-list=LAN</ | ||
| + | '' | ||
| + | '' | ||
| + | '' | ||
| + | '' | ||
| + | |||
| + | 4) Zapnout L2TP server | ||
| + | < | ||
| + | set enabled=yes default-profile=my-l2tp-profile use-ipsec=yes ipsec-secret=spolecneheslo | ||
| + | '' | ||
| + | |||
| + | 5) Vytvořit profil pro uživatele (" | ||
| + | < | ||
| + | '' | ||
| + | '' | ||
| + | '' | ||
| + | |||
| + | 6) Zapnout arp-proxy na bridge (aby router odpovídal klientům na ARP dotazy i skrze tunel) | ||
| + | < | ||
| + | |||
| + | ==== Router za 1:1 NAT ==== | ||
| + | |||
| + | '' | ||
| + | '' | ||
| + | |||
| + | 1) Přidat dummy interface s dummy MAC adresou (aby router věděl o své veřejce) \\ | ||
| + | 2) Nastavit prerouting tak, aby příchozí pakety vůči routeru vypadaly, že přišly na veřejnou adresu. | ||
| + | |||
| + | /interface bridge | ||
| + | add admin-mac=02: | ||
| + | /ip address | ||
| + | add address=L.L.L.L/ | ||
| + | add address=X.X.X.X/ | ||
| + | /ip firewall nat | ||
| + | add action=dst-nat chain=dstnat dst-address=L.L.L.L dst-port=500, | ||
| + | addresses=X.X.X.X | ||
| + | add action=dst-nat chain=dstnat dst-address=L.L.L.L protocol=ipsec-esp to-addresses=X.X.X.X | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Failover (2 WAN) ===== | ||
| + | |||
| + | Výchozí setup: | ||
| + | < | ||
| + | /ip route | ||
| + | add gateway=10.0.1.1 distance=1 check-gateway=ping | ||
| + | add gateway=10.0.2.1 distance=2 | ||
| + | </ | ||
| + | |||
| + | Rekurzivní failover: | ||
| + | < | ||
| + | /ip route | ||
| + | add dst-address=8.8.8.8/ | ||
| + | add gateway=8.8.8.8 | ||
| + | add gateway=10.0.2.1 distance=2 | ||
| + | </ | ||
| + | |||
| + | Vysvětlení: | ||
| + | * U výchozího setupu je problém, že MikroTik zjišťuje dostupnost Internetu jen pomocí pingu brány (tj. první hop). Pokud upadne Internet někde dále za prvním hopem, MikroTik toto nepozná a bránu (a tudíž routu) neshodí. | ||
| + | * U rekurzivního přístupu se pro účely přístupu na Internet vybere spolehlivá a dostupná IP adresa v Internetu (tj. jako příklad Google DNS). Jako výchozí routa se pak použije právě tato IP, tj. dokud je Google DNS dostupné přes první rozhraní, směruje se Internet přes něj. Jakmile Google DNS přes GW1 dostupné není (linka spadla), routa se automaticky shodí a použije se GW2. | ||
| + | * Nevýhoda: Google DNS NEbude dostupné přes GW2. | ||
| + | * [[https:// | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Ban list ===== | ||
| + | < | ||
| + | / ip firewall filter | ||
| + | add chain=input in-interface=ether1-wan protocol=tcp dst-port=22 \ | ||
| + | connection-state=new connection-limit=5/ | ||
| + | action=add-src-to-address-list address-list=ssh_logins \ | ||
| + | address-list-timeout=12h comment="" | ||
| + | add chain=input protocol=tcp dst-port=22 src-address-list=!ssh_logins \ | ||
| + | action=accept comment="" | ||
| + | </ | ||