Σε συνέχεια αυτού και αυτού των οδηγών παραθέτω τις ρυθμίσεις για IPv4 και IPv6 firewall.
IPv4 firewall:
Spoiler:/ip firewall filter
*** Allow only needed icmp codes in icmp chain:
*** Drop port scannersΚώδικας:add chain=icmp protocol=icmp icmp-options=0:0 action=accept \ comment="Echo reply" add chain=icmp protocol=icmp icmp-options=3:0 action=accept \ comment="Net unreachable" add chain=icmp protocol=icmp icmp-options=3:1 action=accept \ comment="Host unreachable" add chain=icmp protocol=icmp icmp-options=4:0 action=accept \ comment="Allow source quench" add chain=icmp protocol=icmp icmp-options=8:0 action=accept \ comment="Allow echo request" add chain=icmp protocol=icmp icmp-options=11:0 action=accept \ comment="Allow time exceed" add chain=icmp protocol=icmp icmp-options=12:0 action=accept \ comment="Allow parameter bad" add chain=icmp action=drop comment="Deny all other types" add action=drop chain=input comment="Disable ICMP ping" in-interface=pppoe-out1 disabled=no protocol=\ icmp
*** Various combinations of TCP flags can also indicate port scanner activity:Κώδικας:add chain=input protocol=tcp in-interface=pppoe-out1 psd=21,3s,3,1 action=add-src-to-address-list address-list="port scanners" address-list-timeout=2w comment="Port scanners to list " disabled=no
*** Drop those IPs in both Input & Forward chains:Κώδικας:add chain=input protocol=tcp tcp-flags=fin,!syn,!rst,!psh,!ack,!urg action=add-src-to-address-list address-list="port scanners" address-list-timeout=2w comment="NMAP FIN Stealth scan" add chain=input protocol=tcp tcp-flags=fin,syn action=add-src-to-address-list address-list="port scanners" address-list-timeout=2w comment="SYN/FIN scan" add chain=input protocol=tcp tcp-flags=syn,rst action=add-src-to-address-list address-list="port scanners" address-list-timeout=2w comment="SYN/RST scan" add chain=input protocol=tcp tcp-flags=fin,psh,urg,!syn,!rst,!ack action=add-src-to-address-list address-list="port scanners" address-list-timeout=2w comment="FIN/PSH/URG scan" add chain=input protocol=tcp tcp-flags=fin,syn,rst,psh,ack,urg action=add-src-to-address-list address-list="port scanners" address-list-timeout=2w comment="ALL/ALL scan" add chain=input protocol=tcp tcp-flags=!fin,!syn,!rst,!psh,!ack,!urg action=add-src-to-address-list address-list="port scanners" address-list-timeout=2w comment="NMAP NULL scan"
*** Router protection :Κώδικας:add chain=input src-address-list="port scanners" action=drop comment="Dropping port scanners" disabled=no
*** Customer protection (forward chain - traffic passing through the router):Κώδικας:add chain=input connection-state=invalid action=drop \ comment="Drop Invalid connections" add chain=input connection-state=established action=accept \ comment="Allow Established connections" add chain=input src-address=192.168.5.0/24 action=accept \ in-interface=pppoe-out1
*** Block Bogon IP addresses:Κώδικας:add chain=forward connection-state=invalid \ action=drop comment="Drop invalid connections" add chain=forward connection-state=established action=accept \ comment="Allow already established connections" add chain=forward connection-state=related action=accept \ comment="Allow related connections"
*** Make jumps to new chains:Κώδικας:add chain=forward src-address=127.0.0.0/8 action=drop add chain=forward dst-address=127.0.0.0/8 action=drop add chain=forward src-address=169.254.0.0/16 action=drop add chain=forward dst-address=169.254.0.0/16 action=drop add chain=forward src-address=172.16.0.0/12 action=drop add chain=forward dst-address=172.16.0.0/12 action=drop add chain=forward src-address=192.0.0.0/24 action=drop add chain=forward dst-address=192.0.0.0/24 action=drop add chain=forward src-address=192.0.2.0/24 action=drop add chain=forward dst-address=192.0.2.0/24 action=drop add chain=forward src-address=198.18.0.0/15 action=drop add chain=forward dst-address=198.18.0.0/15 action=drop add chain=forward src-address=198.51.100.0/24 action=drop add chain=forward dst-address=198.51.100.0/24 action=drop add chain=forward src-address=203.0.113.0/24 action=drop add chain=forward dst-address=203.0.113.0/24 action=drop add chain=forward src-address=224.0.0.0/3 action=drop add chain=forward dst-address=224.0.0.0/3 action=drop
*** Create TCP chain and deny some TCP ports in it (revise port numbers as needed):Κώδικας:add chain=forward protocol=tcp action=jump jump-target=tcp in-interface=pppoe-out1\ comment="Make jumps to new chains" add chain=forward protocol=udp action=jump jump-target=udp in-interface=pppoe-out1 add chain=forward protocol=icmp action=jump jump-target=icmp in-interface=pppoe-out1
*** Create UDP chain and deny some UDP ports in it (revise port numbers as needed):Κώδικας:add chain=tcp protocol=tcp dst-port=69 action=drop \ comment="Deny TFTP" add chain=tcp protocol=tcp dst-port=111 action=drop \ comment="Deny RPC portmapper" add chain=tcp protocol=tcp dst-port=135 action=drop \ comment="Deny RPC portmapper" add chain=tcp protocol=tcp dst-port=137-139 action=drop \ comment="Deny NBT" add chain=tcp protocol=tcp dst-port=445 action=drop \ comment="Deny cifs" add chain=tcp protocol=tcp dst-port=2049 action=drop comment="Deny NFS" add chain=tcp protocol=tcp dst-port=12345-12346 action=drop comment="Deny NetBus" add chain=tcp protocol=tcp dst-port=20034 action=drop comment="Deny NetBus" add chain=tcp protocol=tcp dst-port=3133 action=drop comment="Deny BackOriffice"
Κώδικας:add chain=udp protocol=udp dst-port=69 action=drop comment="Deny TFTP" add chain=udp protocol=udp dst-port=111 action=drop comment="Deny PRC portmapper" add chain=udp protocol=udp dst-port=135 action=drop comment="Deny PRC portmapper" add chain=udp protocol=udp dst-port=137-139 action=drop comment="Deny NBT" add chain=udp protocol=udp dst-port=2049 action=drop comment="Deny NFS" add chain=udp protocol=udp dst-port=3133 action=drop comment="Deny BackOriffice"
IPv6 firewall:
Spoiler:*** Create IPv6 firewall filters
Κώδικας:/ipv6 firewall filter add action=accept chain=input comment="Router - Allow IPv6 ICMP" disabled=no protocol=icmpv6 add action=accept chain=input comment="Router - Accept established connections" connection-state=established disabled=no add action=accept chain=input comment="Router - Accept related connections" connection-state=related disabled=no add action=drop chain=input comment="Router - Drop invalid connections" connection-state=invalid disabled=no add action=accept chain=input comment="Router- UDP" disabled=no protocol=udp add action=accept chain=input comment="Router - From our LAN" disabled=no in-interface=bridge1 add action=drop chain=input comment="Router - Drop other traffic" disabled=no add action=drop chain=forward comment="LAN - Drop invalid Connections" connection-state=invalid disabled=no add action=accept chain=forward comment="LAN - Accept UDP" disabled=no protocol=udp add action=accept chain=forward comment="LAN - Accept ICMPv6" disabled=no protocol=icmpv6 add action=accept chain=forward comment="LAN - Accept established Connections" connection-state=established disabled=no add action=accept chain=forward comment="LAN - Accept related connections" connection-state=related disabled=no add action=accept chain=forward comment="LAN - Internal traffic" disabled=no in-interface=bridge1 add action=reject chain=forward comment="LAN - Drop everything else" connection-state=new disabled=no in-interface=pppoe-out1 reject-with=icmp-no-route
Εμφάνιση 1-15 από 2119
-
20-01-15, 00:28 Mikrotik IPv4/IPv6 firewall #1
-
11-03-15, 22:01 Απάντηση: Mikrotik IPv4/IPv6 firewall #2
Καλησπέρα, συνεχιζω απο το θεμα αυτο http://www.adslgr.com/forum/threads/...erBoard/page76 εδω μιας και μιλαμε για firewall , τελικα με τους κανονες του airbus νομιζω κατι καναμε, σημερα εχει μετρησεις πολλες και στα logs βλεπω νεες ips port scanners! το router οσο ειμαι εδω δεν ειδα να κολλησει παντω ουτε στα στατιστικα δειχνει κατι τετοιο.
Επισης εβαλα και τους αλλους κανονες οπως στο tutorial για το firewall γιατι ειχα πολυ λιγους.
Τωρα διαμορφωθηκαν οπως παρακατω οσον αφορα το ipv4.
Σε αυτον τον κανονα στο τελος τι subnet πρεπει να δηλωσουμε? αυτο στο παραδειγμα τι ειναι?
Κώδικας:*** Router protection : Κώδικας: add chain=input connection-state=invalid action=drop \ comment="Drop Invalid connections" add chain=input connection-state=established action=accept \ comment="Allow Established connections" add chain=input src-address=192.168.5.0/24 action=accept \ in-interface=pppoe-out1
Κώδικας:/ip firewall filter add chain=input comment=OPENVPN dst-port=1722 protocol=tcp add action=passthrough chain=unused-hs-chain comment="place hotspot rules here" disabled=yes add action=add-src-to-address-list address-list="port scanners" address-list-timeout=2w chain=input comment="Port scanners to list " protocol=tcp psd=21,3s,3,1 add action=add-src-to-address-list address-list="port scanners" address-list-timeout=2w chain=input comment="NMAP FIN Stealth scan" protocol=tcp tcp-flags=\ fin,!syn,!rst,!psh,!ack,!urg add action=add-src-to-address-list address-list="port scanners" address-list-timeout=2w chain=input comment="SYN/RST scan" protocol=tcp tcp-flags=syn,rst add action=add-src-to-address-list address-list="port scanners" address-list-timeout=2w chain=input comment="SYN/FIN scan" protocol=tcp tcp-flags=fin,syn add action=add-src-to-address-list address-list="port scanners" address-list-timeout=2w chain=input comment="FIN/PSH/URG scan" protocol=tcp tcp-flags=\ fin,psh,urg,!syn,!rst,!ack add action=add-src-to-address-list address-list="port scanners" address-list-timeout=2w chain=input comment="ALL/ALL scan" protocol=tcp tcp-flags=fin,syn,rst,psh,ack,urg add action=add-src-to-address-list address-list="port scanners" address-list-timeout=2w chain=input comment="NMAP NULL scan" protocol=tcp tcp-flags=\ !fin,!syn,!rst,!psh,!ack,!urg add action=drop chain=input comment="dropping port scanners" src-address-list="port scanners" add action=drop chain=input dst-port=53 in-interface=all-ppp protocol=udp add action=drop chain=input dst-port=53 in-interface=all-ppp protocol=tcp add chain=icmp comment="Echo reply" icmp-options=0:0 protocol=icmp add chain=icmp comment="Net unreachable" icmp-options=3:0 protocol=icmp add chain=icmp comment="Host unreachable" icmp-options=3:1 protocol=icmp add chain=icmp comment="Allow source quench" icmp-options=4:0 protocol=icmp add chain=icmp comment="Allow echo request" icmp-options=8:0 protocol=icmp add chain=icmp comment="Allow time exceed" icmp-options=11:0 protocol=icmp add chain=icmp comment="Allow parameter bad" icmp-options=12:0 protocol=icmp add action=drop chain=icmp comment="Deny all other types" add action=drop chain=input comment="Disable ICMP ping" in-interface=pppoe-out1 protocol=icmp add action=add-src-to-address-list address-list="port scanners" address-list-timeout=2w chain=input comment="Port scanners to list " in-interface=pppoe-out1 protocol=tcp \ psd=21,3s,3,1 add action=add-src-to-address-list address-list="port scanners" address-list-timeout=2w chain=input comment="NMAP FIN Stealth scan" protocol=tcp tcp-flags=\ fin,!syn,!rst,!psh,!ack,!urg add action=add-src-to-address-list address-list="port scanners" address-list-timeout=2w chain=input comment="SYN/FIN scan" protocol=tcp tcp-flags=fin,syn add action=add-src-to-address-list address-list="port scanners" address-list-timeout=2w chain=input comment="SYN/RST scan" protocol=tcp tcp-flags=syn,rst add action=add-src-to-address-list address-list="port scanners" address-list-timeout=2w chain=input comment="FIN/PSH/URG scan" protocol=tcp tcp-flags=\ fin,psh,urg,!syn,!rst,!ack add action=add-src-to-address-list address-list="port scanners" address-list-timeout=2w chain=input comment="ALL/ALL scan" protocol=tcp tcp-flags=fin,syn,rst,psh,ack,urg add action=add-src-to-address-list address-list="port scanners" address-list-timeout=2w chain=input comment="NMAP NULL scan" protocol=tcp tcp-flags=\ !fin,!syn,!rst,!psh,!ack,!urg add action=drop chain=input comment="Dropping port scanners" src-address-list="port scanners" add action=drop chain=input comment="Drop Invalid connections" connection-state=invalid add chain=input comment="Allow Established connections" connection-state=established add chain=input in-interface=pppoe-out1 src-address=192.168.5.0/24 add action=drop chain=forward comment="Drop invalid connections" connection-state=invalid add chain=forward comment="Allow already established connections" connection-state=established add chain=forward comment="Allow related connections" connection-state=related add action=drop chain=forward src-address=127.0.0.0/8 add action=drop chain=forward dst-address=127.0.0.0/8 add action=drop chain=forward src-address=169.254.0.0/16 add action=drop chain=forward dst-address=169.254.0.0/16 add action=drop chain=forward src-address=172.16.0.0/12 add action=drop chain=forward dst-address=172.16.0.0/12 add action=drop chain=forward src-address=192.0.0.0/24 add action=drop chain=forward dst-address=192.0.0.0/24 add action=drop chain=forward src-address=192.0.2.0/24 add action=drop chain=forward dst-address=192.0.2.0/24 add action=drop chain=forward src-address=198.18.0.0/15 add action=drop chain=forward dst-address=198.18.0.0/15 add action=drop chain=forward src-address=198.51.100.0/24 add action=drop chain=forward dst-address=198.51.100.0/24 add action=drop chain=forward src-address=203.0.113.0/24 add action=drop chain=forward dst-address=203.0.113.0/24 add action=drop chain=forward src-address=224.0.0.0/3 add action=drop chain=forward dst-address=224.0.0.0/3 add action=jump chain=forward comment="Make jumps to new chains" in-interface=pppoe-out1 jump-target=tcp protocol=tcp add action=jump chain=forward in-interface=pppoe-out1 jump-target=udp protocol=udp add action=jump chain=forward in-interface=pppoe-out1 jump-target=icmp protocol=icmp add action=drop chain=tcp comment="Deny TFTP" dst-port=69 protocol=tcp add action=drop chain=tcp comment="Deny RPC portmapper" dst-port=111 protocol=tcp add action=drop chain=tcp comment="Deny RPC portmapper" dst-port=135 protocol=tcp add action=drop chain=tcp comment="Deny NBT" dst-port=137-139 protocol=tcp add action=drop chain=tcp comment="Deny cifs" dst-port=445 protocol=tcp add action=drop chain=tcp comment="Deny NFS" dst-port=2049 protocol=tcp add action=drop chain=tcp comment="Deny NetBus" dst-port=12345-12346 protocol=tcp add action=drop chain=tcp comment="Deny NetBus" dst-port=20034 protocol=tcp add action=drop chain=tcp comment="Deny BackOriffice" dst-port=3133 protocol=tcp add action=drop chain=udp comment="Deny TFTP" dst-port=69 protocol=udp add action=drop chain=udp comment="Deny PRC portmapper" dst-port=111 protocol=udp add action=drop chain=udp comment="Deny PRC portmapper" dst-port=135 protocol=udp add action=drop chain=udp comment="Deny NBT" dst-port=137-139 protocol=udp add action=drop chain=udp comment="Deny NFS" dst-port=2049 protocol=udp add action=drop chain=udp comment="Deny BackOriffice" dst-port=3133 protocol=udp
-
12-03-15, 00:45 Απάντηση: Mikrotik IPv4/IPv6 firewall #3
Οι δηλώσεις αυτές για το dns δεν βλέπω να εξυπηρετούν σε κάτι.
Κώδικας:add action=drop chain=input dst-port=53 in-interface=all-ppp protocol=udp add action=drop chain=input dst-port=53 in-interface=all-ppp protocol=tcp
Το έχω δοκιμάσει με κενό το in-interface και δεν μαζεύει τίποτε από έξω.
Δοκίμασα και με client από έξω με dns την public ip και δεν δούλευε τίποτε στον client.
Στο MT δεν φαινόταν να φτάνει κανένα πακέτο.
Δοκίμασα και με telnet στην 53 από έξω και πάλι δεν μάζευε τίποτε το ΜΤ.
Μόνο από μέσα (εσωτερικό δίκτυο) κάνει drop.
Οπότε δεν βλέπω τον λόγο ύπαρξης.| "Anyone can build a fast CPU.
| The trick is to build a fast system."
|____________Seymour Cray...
-
12-03-15, 07:42 Απάντηση: Mikrotik IPv4/IPv6 firewall #4
ΚΑλημερα! οκ πες αυτες τις βγαζω, το αλλο που ρωτησα το subnet που αναφερεται εκει τι ειναι? εγω βαζω εκει του εσωτερικου μου δικτυου δλδ? ετσι δεν ειναι?
Κώδικας:add chain=input src-address=192.168.5.0/24 action=accept \ in-interface=pppoe-out1
-
12-03-15, 10:47 Απάντηση: Mikrotik IPv4/IPv6 firewall #5
Έτσι όπως είναι γραμμένο σημαίνει ότι θα μπορεί να δέχεται από το pppoe διευθύνσεις του δικτύου 192.168.5.0.
Φυσικά και είναι άχρηστο πλην των περιπτώσεων που έχεις ένα τέτοιο δίκτυο ελεγχόμενο από άκρο σε άκρο.
Γι αυτό και δεν μαζεύει τίποτε.
Διορθώνοντας τους παρακάτω κώδικες θα έγραφα:
*** Router protection:
Κώδικας:add chain=input connection-state=established action=accept \ comment="Allow established connections" add chain=input connection-state=related action=accept \ comment="Allow related connections" add chain=input connection-state=invalid action=drop \ comment="Drop invalid connections"
Κώδικας:add chain=forward connection-state=established action=accept \ comment="Allow established connections" add chain=forward connection-state=related action=accept \ comment="Allow related connections" add chain=forward connection-state=invalid \ action=drop comment="Drop invalid connections"
Παρ όλα αυτά εξακολουθεί να μου κάνει εντύπωση γιατί δεν δέχεται remote requests στο DNS από public ip αφού το δηλώνω κανονικά στο DNS.
Ακόμα και με κλειστό όλο το fw δεν βλέπω καν να φτάνουν τα πακέτα στο ρούτερ.
Εννοείται ότι είναι σωστά δηλωμένη η ΙΡ.| "Anyone can build a fast CPU.
| The trick is to build a fast system."
|____________Seymour Cray...
-
12-03-15, 10:47 Απάντηση: Mikrotik IPv4/IPv6 firewall #6
ok thanks! τα διόρθωσα, καλά που τα ξέρεις όλα αυτά ρε συ? γιατί εγώ δεν καταλαβαίνω σχεδόν τίποτα?
-
12-03-15, 12:22 Απάντηση: Mikrotik IPv4/IPv6 firewall #7
-
12-03-15, 13:29 Απάντηση: Mikrotik IPv4/IPv6 firewall #8
Και εμένα έδειχνε καταχωρήσεις σε αυτα και στα logs ειχα παλι port scanners...
Τελευταία επεξεργασία από το μέλος Nikiforos : 12-03-15 στις 22:11.
-
12-03-15, 16:12 Απάντηση: Mikrotik IPv4/IPv6 firewall #9
Ο κανόνας όπως είναι γραμμένος:
Κώδικας:add action=drop chain=input dst-port=53 in-interface=all-ppp protocol=udp add action=drop chain=input dst-port=53 in-interface=all-ppp protocol=tcp
Είτε βάλεις έναν client να κάνει αιτήσεις με nslookup είτε με telnet στην 23 θα έπρεπε να μαζεύει πακέτα.
Με λίγα λόγια... δεν παίζει ρόλο αν σου κάνει κάποιος ένα αίτημα ή μια επίθεση στην 53.
Επίσης... θα έπρεπε οι συγκεκριμένες συνδέσεις να καταγράφονται στα connections.
Σε εμένα τέτοιο πράγμα δεν γίνεται.
Δεν ξέρω από που κόβονται αλλά δεν φτάνουν ποτέ στο ρούτερ για να τα δω.
Αντίθετα αν δηλώσω για input interface το bridge μαζεύει κανονικά.
Προφανώς από κάπου κόβονται πριν καν φτάσουν στο ρούτερ.
Έκανα δοκιμές και με κλειστό το fw αλλά πάλι τίποτε.
Ίσως είναι κάποιο bug του ΜΤ ή κάποιας ρύθμισης που έκανα και μου διαφεύγει αυτή την στιγμή.
Δηλαδή αυτή την στιγμή και να θέλω να δώσω dns έξω από το δίκτυό μου, δεν μπορώ.| "Anyone can build a fast CPU.
| The trick is to build a fast system."
|____________Seymour Cray...
-
12-03-15, 17:46 Απάντηση: Mikrotik IPv4/IPv6 firewall #10
εχεις pppoe με bridge το router του παροχου?
-
12-03-15, 19:08 Απάντηση: Mikrotik IPv4/IPv6 firewall #11
-
13-03-15, 23:36 Απάντηση: Mikrotik IPv4/IPv6 firewall #12
Για το κλασσικό NAT port forward πχ.
WAN 40080 σε LAN 192.168.1.200:80
για να δώ μία IP Camera απο έξω
η εντολή είναι
/ip firewall nat add chain=dstnat protocol=tcp dst-port=40080 \
action=dst-nat to-addresses=192.168.1.200 to-ports=80
σωστά?
προσπαθώ να δώ πόσο δύσκολο είναι το σετάρισμα σε σύγκριση με ένα απλό modem/router
το διάβασα απο εδώ
http://wiki.mikrotik.com/wiki/Forwar...an_internal_IP
-
14-03-15, 08:34 Απάντηση: Mikrotik IPv4/IPv6 firewall #13
Καλημέρα! εδώ το δείχνει πολύ εύκολα και κατανοητό μέσω γραφικού και winbox :
http://www.icafemenu.com/how-to-port...tik-router.htm και http://wiki.mikrotik.com/wiki/NAT_Tutorial
έχω ανοίξει έτσι πόρτες και για ip camera και για cctv dvr και φυσικά VPN και τα σχετικά.
για όσους προτιμάνε κονσόλα : http://wiki.mikrotik.com/wiki/Manual:IP/Firewall/NAT
και σε βιντεακι :
-
14-03-15, 10:23 Απάντηση: Mikrotik IPv4/IPv6 firewall #14
-
14-03-15, 13:05 Απάντηση: Mikrotik IPv4/IPv6 firewall #15
γιατί όμως και στο wiki δεν αναφέρει θύρες? http://wiki.mikrotik.com/wiki/Manual:IP/Firewall/NAT
πχ εκεί που λέει basic examples.
Παρόμοια Θέματα
-
Mikrotik IPv6 σε PPPoE client με modem σε bridge mode
Από deniSun στο φόρουμ MikroTik ADSL modems, routers & routerBOARDsΜηνύματα: 136Τελευταίο Μήνυμα: 24-05-23, 22:17 -
Έναρξη πιλοτικής λειτουργίας IPv4/IPv6 dual stack από τον ΟΤΕ
Από SfH στο φόρουμ ΕιδήσειςΜηνύματα: 493Τελευταίο Μήνυμα: 18-05-19, 17:35 -
Mikrotik 2011 DHCP lease failed without success Point to Multipoint
Από jvam στο φόρουμ NetworkingΜηνύματα: 2Τελευταίο Μήνυμα: 18-10-14, 21:56 -
IPV6 + IPV4 SPEED TEST
Από babis3g στο φόρουμ ADSLΜηνύματα: 7Τελευταίο Μήνυμα: 05-09-14, 18:00
Bookmarks