Setup guide

2. Create the default route in each of the tables:
[admin@Wandy] ip policy-routing> table from_net1 add gateway=10.0.0.1
[admin@Wandy] ip policy-routing> table from_net2 add gateway=10.0.0.2
[admin@Wandy] ip policy-routing> table rest add gateway=10.0.0.254
[admin@Wandy] ip policy-routing> table from_net1 print
Flags: X - disabled, I - invalid, D - dynamic, R - rejected
# TYPE DST-ADDRESS G GATEWAY DISTANCE INTERFACE
0 static 0.0.0.0/0 u 10.0.0.1 1 Public
[admin@Wandy] ip policy-routing>
[admin@Wandy] ip policy-routing> table from_net2 print
Flags: X - disabled, I - invalid, D - dynamic, R - rejected
# TYPE DST-ADDRESS G GATEWAY DISTANCE INTERFACE
0 static 0.0.0.0/0 u 10.0.0.2 1 Public
[admin@Wandy] ip policy-routing>
[admin@Wandy] ip policy-routing> table rest print
Flags: X - disabled, I - invalid, D - dynamic, R - rejected
# TYPE DST-ADDRESS G GATEWAY DISTANCE INTERFACE
0 static 0.0.0.0/0 u 10.0.0.254 1 Public
[admin@Wandy] ip policy-routing>
3. Create rules that will direct traffic from sources to given tables, and arrange them in the
desired order:
[admin@Wandy] ip policy-routing> rule
[admin@Wandy] ip policy-routing rule> print
Flags: X - disabled, I - invalid
# SRC-ADDRESS DST-ADDRESS INT... FLOW ACTION
0 0.0.0.0/0 0.0.0.0/0 all lookup
[admin@Wandy] ip policy-routing rule> add src-address=1.1.1.0/24 \
\... action=lookup table=from_net1
[admin@Wandy] ip policy-routing rule> add src-address=2.2.2.0/24 \
\... action=lookup table=from_net2
[admin@Wandy] ip policy-routing rule> add src-address=0.0.0.0/0 \
\... action=lookup table=rest
[admin@Wandy] ip policy-routing rule> print
Flags: X - disabled, I - invalid
# SRC-ADDRESS DST-ADDRESS INTERFACE FLOW ACTION
0 0.0.0.0/0 0.0.0.0/0 all lookup
1 1.1.1.0/24 0.0.0.0/0 all lookup
2 2.2.2.0/24 0.0.0.0/0 all lookup
3 0.0.0.0/0 0.0.0.0/0 all lookup
[admin@Wandy] ip policy-routing rule>
Here the rule #0 is needed to reach directly connected networks. Note that there (in table main)
is only directly connected routes! The rules #1 and #2 process local networks 1.1.1.0/24, which
is routed through the gateway 10.0.0.1, and 2.2.2.0/24, which is routed through the gateway
10.0.0.2. Rule #3 handles packets originated from other networks (0.0.0.0/0).
Connection Tracking and Service Ports
Document revision 1.0 (Fri Mar 05 08:34:03 GMT 2004)
This document applies to Wandy RouterOS V2.8