added in a separate .zip a "flat" .svg version.
hopefully the "normal" .svg will render correctly also on machines that do not have Verdana or Jetbrains (or both) installed.
EDIT: Attached a tentative version.
I tried to align boxes along a grid where rows are Mikrotik configuration sections and columns are Mikrotik configuration actions chains.
Needs to be reviewed accurately, as I may well have made some mistake, as i changed the layout or the original.
Numbering remains the same for the moment (it will be eventually removed unless deemed necessary for some reason) even if a few numbered boxes were removed (12,15,and 19).
This is sort of a new take on the usual diagram. I saw some others attempt similar things, but none were really usable - yours actually looks nice. Who knows, maybe it will catch on. Kudos.
The āreceived by local processā and āemitted by local processā things definitely shouldnāt be left out:
for encapsulations it is often true that the received and emitted packages bear a (mostly) 1:1 relationship and are āsome versionsā of each other, however they is not the same packet
in many cases for services a sort of 1:1 relationship exists between received and emitted packages, e.g. a DNS request answered, a ping responded to, however these are most definitely not the same packet somehow proceeding though the packet flow
in many cases the router just emits a packet: e.g. doing an IP address update for DDNS (in this case the instigating event is not even related to some other packet, but itās based on a timer, config change, etc.) or the router wants to make a DNS lookupā¦
This is just a nitpick, but the triangles to me suggest that thereās something happening there. Maybe itās just how I visually process thingsā¦
EDIT: I would consider retaining some version of numbering or lettering of the processing steps. I often find myself explaining the steps of the packet flow for a particular scenario in writing, and a clear reference would be very helpful in those cases.
I think I can re-add them (12 and 19) in an added column between āchain=inputā and āchain=forwardā keeping all the rest of the new layout unchanged.
The triangle Is the standard symbol in flowchart that means āmergeā, I could remove the filling if that helps in visualization.
Moved to Excel (which while being a little poorer on the graphic side is easier for managing this kind of stuff, inkscape - possibly my fault - had a couple issues with connectorsā arrows and grid snapping).
Attaching a .png, but this can later become the actual Excel spreadsheet or a pdf.
EDIT: file removed see below
I canāt comment on the flowchart you posted yet because it has the same problems with some diagrams on help.mikrotik.com, that the transparent background makes the image unreadable in dark mode. My phone web browser automatically converts web pages to dark mode (conserves battery with OLED screens) and black lines and texts on deep dark background are invisible.
IMHO it makes little sense to create an image with transparent background while the important details have fixed colors on that same transparent background. Maybe add at least some contrasting outlines or just make the background white/light colored.
This is not simply a problem specific to browsers with automatic dark mode. When, according to plans, this forum switches to Discourse in the near future, the forum software will offer the users the ability to select dark themes too and your flowchart as of now will become unreadable.
EDIT: And itās also unreadable on my Windows PC in the default Windows Photo Viewer.
I was not aware of #5 and #24 in RouterOS. Does #5 means that if a random device on the network (letās say on the LAN bridge) sends a packet to the router by faking src-address=192.168.88.1 (assuming thatās one of the routerās addresses) and dst-address=1.2.3.4, dst-port 53, protocol UDP, that packet lands in Mangle Prerouting and then in Filter Input, and then is received by the routerās DNS process, even with dst-address being 1.2.3.4?
Ah I see the #5 and #24 branching box are present on this https://stuffphilwrites.com/fw-ids-iptables-flowchart-v2024-05-22/. However, I think that applies only to locally (on the router) generated packets. That chart has the distinction between ālocalhost destā (as well als ālocalhost srcā) and āfor this hostā. I think āfor this hostā is what really matches your āIs dst address router ownā of #12 but is not for #24.
And it means āIs src addr ownāsā should not be equivalent to ālocalhost srcā. From the article, I think it means the packet was generated by the router and destined for the router. And not just any packet with one of the routerās addresses in the src-address field.
In the original article, this was mentioned in the changelog:
2018-09-01: Reflects that > localhost> -sourced/destined packets will not traverse the nat tableās PREROUTING/POSTROUTING chains, respectively. Thanks to commenter Binarus for the pointer.
I am only trying to make the IPTABLES flowchart lurker888 posted a link to at the same time more suited to Mikrotik while keeping it readable by IPTABLES experts AND make it understandable to the āmassesā AND attempt to organize it visually in such a way that WHERE the settings are is evident (something that is usually not immediate in most flowcharts I have seen).
Invariably you are pointed to one (or the other) and told āit is mostly like this BUT ā¦ā
My hope is that at the end we can have something that you can point people to and say āit is EXACTLY like thisā¦ā
The text of points currently numbered as follows is only an attempt, it can be changed current<- lurker888ās<-original:
5 Is src addr routerās own? ā src addr is routerās addr ā localhost source?
12 Is dst addr routerās own? ā dst addr is routerās addr ā for this host?
24 Is dst addr routerās own? ā dst addr is routerās addr ā localhost dest?
Phil Hagen
September 1, 2018 at 6:32 am
Aha ā I see what was meant before and I appreciate the input. Iāve updated this to reflect two differences when handling > localhost-to-localhost > packets. (Note that the nat/POSTROUTING chain is not used for packets destined to localhost either.)
But when you made the change as suggested by others to āmatch MikroTik termsā, the loopback meaning is lost. Because āIs src addr routerās own?ā only mention the source address of the packet and that can be faked by the sender at will.
For #24 is less critical, because the Yes branch of that box can only be taken by packets generated by the router (those that went through the output chain), and will satisfy the āloopbackā condition if the Yes branch, even with your wordings, is hit.
Thanks both of you for highlighting this! These cases are why these diagrams are really hard to make: either go into too much detail and lose your audience or be a bit vague or imprecise. I may have gone too far, and we should come up with clearer phrasing: none is clear to me immediately, but I hope we can come up with something.
Let me try to clarify whatās actually happening:
in decision 5, the check is actually: is the ingress interface the loopback
in decision 12, the check is: is the route chosen in 11 a ālocalā route (more about this later)
in decision 24, the same is true with regard to the last routing lookup performed (for any case where this condition is true, the last routing lookup was made in 21)
About ālocalā: the linux routing table may contain a flag ālocalā, as shown in this output produced on a vanilla Ubuntu:
$ ip route list table main
[...]
192.168.80.0/24 dev enp4s0 proto kernel scope link src 192.168.80.229 metric 100
[...]
$ ip route list rable local
[...]
local 172.18.0.1 dev br-6c15e4ab1bf0 proto kernel scope host src 172.18.0.1
[...]
The first ālocalā in the local table listing signifies the flag deciding this decision.
Maybe āpacket from router (itself)ā or āpacket to router (itself)ā would be correct?
EDIT: So to be clear, the case of 5 referd to the ingress interface, while the other two refer to a decision that is indeed made based on the dst addr. (mangling and routing rules may influence this)
I find this better too. And actually the outgoing line from the Yes branch of #24 doesnāt need to go down to #26 and can instead loop up to directly enter #2. This would make the āloopbackā explicit.
I think this latter can be solved, I could add a āloopbackā box (between 9 and 26) and from it feed it back to 2. That would be something that I would understand much more than either the current go to Outgoing Packet or ādirect re-feeding to #2ā.
What about the exact text for the decisions (remember that it must fit the diamond/rhombus shape, so not too verbose):
5) ā¦
12) ā¦
24) ā¦
Not saying this is the ultimate, but the decisions could be āfrom router itselfā and āto router itselfā
Maybe the loopback situation is best represented by a wavy rectangle (like incoming/outgoing packet") labelled āloopback (lo)ā in the center, with an incoming arrow from 24 and an outgoing one to 2? With the arrow leaving 24 to the left it would actually fit okā¦
I like the presentation here. While the full detail (other than WG) is in Packet Flow diagrams in docs ā those are not very understandable to get the āhigh levelā picture from a āconfiguration perspectiveā ā so showing the āchains vs /ip/firewall/XXXā is pretty cleaver way to do it. But going into too much detail, any diagram is just going to start looking like MikroTik existing one, so think youāve capture the right detail here.
Iāve never found MikroTik ālocal processā a good term, so the āIs src-address router own?ā (or similar wording, ā<from/to> router itselfā) seems more clear than ālocal processā. And that helps separate out the input/output vs forwarding difference better than mikrotik packet flowIMO.
My only grip be do not use same box for the labels ā square boxes are historically a āprocessā, so the āchain=inputā and ā/ip firewall rawā should use some other shape. Perhaps grid lines might help, dunno.