[Mikrotik] Inbound interface based routing

Butch Evans butche at butchevans.com
Thu Jan 21 19:46:34 CST 2010

On Thu, 2010-01-21 at 17:22 -0500, Josh Luthman wrote: 
> Not sure what you want but I think you want policy routing.

You are correct!

> > I am sure this question has been asked before but I can't seem to find it.
> >
> > I am looking to setup a spare interface on a routerboard as a sort of
> > "back door." I'd like to be able to access the unit through that
> > particular interface/ip and have all replies return via a route
> > through that same interface. At the same time I want to make sure that
> > any traffic not coming in to that interface is routed via the default
> > route. (Via a different interface) I can't just setup a static route
> > as I may access it via several sources.
> >
> > I think all I need to do is to mark all connections coming into that
> > interface and setup an outgoing route based on that mark but I can't
> > seem to figure out how to do that.

The logic would be like this:

* Add a route with routing mark "connection1"
* Add a route with routing mark "connection2"
* Create route rules that say "routing-mark connection1, lookup table   
  connection1" (same for connection2)
* In mangle, create a rule in prerouting that does mark-connection, 
  in-interface connection1, new connection mark conn1
* next rule, in-interface=!connection1, connection-mark conn1, action 
  mark-routing routing mark connection1 

repeat the last 2 steps for connection 2.

* Butch Evans                   * Professional Network Consultation*
* http://www.butchevans.com/    * Network Engineering              *
* http://store.wispgear.net/    * Wired or Wireless Networks       *
* http://blog.butchevans.com/   * ImageStream, Mikrotik and MORE!  *

More information about the Mikrotik mailing list