Community discussions

MikroTik App
 
Guscht
Member Candidate
Member Candidate
Topic Author
Posts: 236
Joined: Thu Jul 01, 2010 5:32 pm

Custom Chains - Forward or Input?

Wed May 31, 2023 12:42 pm

Hi,

as the title says, are custom chains considered as forward or input chains?
Or how is it determined?

Thanks
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11967
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Custom Chains - Forward or Input?

Wed May 31, 2023 12:57 pm

Think of them as a template,
they're unused until you send something into them from a parent chain
(also output and the other main chains, not only input or forward, and also from another subchain, etc.).

At the end of the custom chain packets return to the chain they originally came from, where they left off,
unless you place a return somewhere in the parent chain that indicate where you want the packet to be returned.
If you want return the packet not on previous subchain, but on one of the main chain, you can redirect on another chain directly.
 
pe1chl
Forum Guru
Forum Guru
Posts: 10183
Joined: Mon Jun 08, 2015 12:09 pm

Re: Custom Chains - Forward or Input?

Wed May 31, 2023 1:47 pm

Think of them as a template,
they're unused until you send something into them from a parent chain
They are not a template. You can view them as a subroutine. It can be called from other chains (like input and forward) using action "jump" (which should have been named "call").
So you can e.g. make a rule in the input chain that checks the input interface, and when it is the internet interface it jumps to a chain like input-internet.
Then in the rules in input-internet you can do all kinds of filtering but you do not need to add the input interface to every check, and also the rules are not called at all unless they are the target of that jump, so you save processing when compared to having all rules in a single chain.

Who is online

Users browsing this forum: No registered users and 60 guests