This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
mikrotik [2018/08/17 00:51] ww [facebook] |
mikrotik [2022/03/16 09:52] (current) ww |
||
|---|---|---|---|
| Line 29: | Line 29: | ||
| Zdroj: [[https:// | Zdroj: [[https:// | ||
| + | |||
| + | ---- | ||
| ===== LTE ===== | ===== LTE ===== | ||
| Line 83: | Line 85: | ||
| /ip route add gateway=ether2-wan2 routing-mark=routing_mark_guests </ | /ip route add gateway=ether2-wan2 routing-mark=routing_mark_guests </ | ||
| - 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 stub ===== | ||
| /ipv6 firewall filter | /ipv6 firewall filter | ||
| - | add action=accept comment=" | + | add chain=forward connection-state=established |
| - | add action=accept comment=" | + | add chain=forward connection-state=related |
| - | add action=accept comment=" | + | add chain=forward |
| - | add action=drop comment=" | + | add chain=forward in-interface-list=WAN action=drop |
| - | add action=accept comment=" | + | add chain=input |
| - | add action=accept comment=" | + | add chain=input |
| - | add action=accept comment=" | + | add chain=input |
| - | add action=accept comment=" | + | add chain=input |
| - | add action=drop comment=" | + | add chain=input |
| + | |||
| + | ---- | ||
| + | |||
| + | ===== L2TP + IPsec ===== | ||
| + | |||
| + | * [[https:// | ||
| + | |||
| + | 1) Povolit IPsec na firewallu | ||
| + | < | ||
| + | /ip firewall filter | ||
| + | add chain=input | ||
| + | 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 | ||
| + | | ||
| + | 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 | ||
| + | * 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 | ||
| + | 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="" | ||
| + | </ | ||