Manual:Packet Flow: Difference between revisions

From MikroTik Wiki
Jump to navigation Jump to search
Line 71: Line 71:




===Automated processes and desicions ===
===Automated processes and decisions ===


[[Image:In-interface-bridge.jpg|In-interface Bridge|100px]] - check if the ''actual input interface'' is a port for bridge OR  checks if ''input interface'' is bridge
[[Image:In-interface-bridge.jpg|In-interface Bridge|100px]] - check if the ''actual input interface'' is a port for bridge OR  checks if ''input interface'' is bridge
Line 77: Line 77:
[[Image:hotspot_in.jpg|Hotspot In|100px]] - allow to capture traffic witch otherwise would be discarded by connection tracking - this way our Hotspot feature are able to provide connectivity even if networks settings are in complete mess
[[Image:hotspot_in.jpg|Hotspot In|100px]] - allow to capture traffic witch otherwise would be discarded by connection tracking - this way our Hotspot feature are able to provide connectivity even if networks settings are in complete mess


[[Image:Bridge Desicion.jpg|Bridge Decision|100px]] - bridge goes thought the MAC address table in order to find a match to destination MAC address of packet. When match is found - packet will be send out via corresponding bridge port. In case of no match - multiple copies of packet will be created and packet will be sent out via all bridge ports


[[Image:bridge_decision.jpg|Bridge Decision|100px]] - this is a workaround, allows to use "out-bridge-port" before actual bridge decision.


[[Image:Bridge Desicion.jpg|Bridge Decision|100px]]
[[Image:Routing Decision.jpg|Routing Decision|100px]] - router goes thought the route n order to find a match to destination IP address of packet. When match is found - packet will be send out via corresponding port or to the router itself . In case of no match - packet will be discarded.


[[Image:routing_adjustment.jpg|Routing Adjustment|100px]] - this is a workaround that allows to set-up policy routing in mangle chain output


[[Image:routing_adjustment.jpg|Routing Adjustment|100px]]
[[Image:TTL=TTL-1.jpg|TTL Adjustment|100px]] - indicates exact place where Time To Live (TTL) of the packet is reduced by 1. If it become 0 packet will be discarded
 
[[Image:accounting.jpg|Accounting|100px]]
 
[[Image:TTL=TTL-1.jpg|TTL Adjustment|100px]]
 
[[Image:bridge_decision.jpg|Bridge Decision|100px]]
 
[[Image:IPSec_Decryption.jpg|IPSec_Decryption|100px]]
 
[[Image:IPSec_Encryption.jpg|IPSec_Encryption|100px]]
 


[[Image:IPSec_Decryption.jpg|IPSec_Decryption|100px]] [[Image:IPSec_Encryption.jpg|IPSec_Encryption|100px]] - self explanatory


[[Image:out_interface_bridge.jpg|Out-interface Bridge|100px]] - check if the ''actual output interface'' is a port for bridge OR  checks if ''output interface'' is bridge
[[Image:out_interface_bridge.jpg|Out-interface Bridge|100px]] - check if the ''actual output interface'' is a port for bridge OR  checks if ''output interface'' is bridge


[[Image:Hotspot_out.jpg|Hotspot Out|100px]] - undo all that was done by hotspot-in for the packets that is going back to client.
[[Image:Hotspot_out.jpg|Hotspot Out|100px]] - undo all that was done by hotspot-in for the packets that is going back to client.

Revision as of 07:31, 28 November 2008

MikroTik RouterOS is designed to be easy to operate in various aspects of network configuration. Therefore creating limitation for individual IP or natting internal clients to a public address or Hotspot configuration can be done without the knowledge about how the packets are processed in the router - you just go to corresponding menu and create necessary configuration.

However more complicated tasks, such as traffic prioritization, routing policies, where it is necessary to utilize more than one RouterOS facility, requires knowledge: How these facilities work together? What happens when and why?

To address these questions we created a packet flow diagram.

Diagram

As it was impossible to get everything in one diagram, Packet flow diagram for Mikrotik RouterOS v3.x was created in 2 parts:

  • Bridging or Layer-2 (MAC) where Routing part is simplified to one "Layer-3" box
  • Routing or Layer-3 (IP) where Bridging part is simplified to one "Bridging" box


Packet Flow in Layer-2



Packet Flow in Layer-3



Analysis

Basic Concepts

Input Interface - starting point in packets way thought the router facilities. It does not matter what interface (physical or virtual) packet is received it will start its way from here.

Output Interface - last point in packets way thought the router facilities. Just before the packet is actually sent out.

Filter Output - last point in packets way to router itself, after this packet is discarded

Filter Output - starting point for packets generated by router itself

Configurable Facilities

Each and every facilities in this section corresponds with one particular menu in RouterOS. Users are able to access those menu and configure these facilities directly


Connection Tracking - /ip firewall connection tracking

Filter Input Filter Forward Filter Output - /ip firewall filter

Source NAT Destination NAT - /ip firewall nat

Mangle Prerouting Mangle Input Mangle Forward Mangle Output Mangle Postrouting - /ip firewall mangle

Global-in HTB Global-Out HTB Interface HTB - /queue simple and /queue tree

IPSec_Policy - /ip ipsec policy

Use IP Firewall - /interface bridge settings

Bridge Forward Bridge Input Bridge Output - /interface bridge filter

Bridge Destination NAT Bridge Source NAT - /interface bridge nat


Automated processes and decisions

In-interface Bridge - check if the actual input interface is a port for bridge OR checks if input interface is bridge

Hotspot In - allow to capture traffic witch otherwise would be discarded by connection tracking - this way our Hotspot feature are able to provide connectivity even if networks settings are in complete mess

Bridge Decision - bridge goes thought the MAC address table in order to find a match to destination MAC address of packet. When match is found - packet will be send out via corresponding bridge port. In case of no match - multiple copies of packet will be created and packet will be sent out via all bridge ports

Bridge Decision - this is a workaround, allows to use "out-bridge-port" before actual bridge decision.

Routing Decision - router goes thought the route n order to find a match to destination IP address of packet. When match is found - packet will be send out via corresponding port or to the router itself . In case of no match - packet will be discarded.

Routing Adjustment - this is a workaround that allows to set-up policy routing in mangle chain output

TTL Adjustment - indicates exact place where Time To Live (TTL) of the packet is reduced by 1. If it become 0 packet will be discarded

IPSec_Decryption IPSec_Encryption - self explanatory

Out-interface Bridge - check if the actual output interface is a port for bridge OR checks if output interface is bridge

Hotspot Out - undo all that was done by hotspot-in for the packets that is going back to client.

Examples

Example1: Bridging with use-ip-firewall=yes

Example2: Routing - from Ethernet to Ethernet interface

Example3: Routing from one Bridge interface to another

Example4: IPsec encryption and sending to the peer

Example5: IPsec data receiving and decryption