2 0.0.0.0/0 gateways

Dear Members,

How do i force Miktrotik to forward any traffic if the source IP = a /24 subnet to another gateway which is connected?

my address list “subnet1” 10.10.10.0/24

my mangle rules

chain=prerouting action=mark-connection new-connection-mark=subnet1 passthrough=yes dst-address-list=subnet1

chain=prerouting action=mark-routing new-routing-mark=subnet1 passthrough=yes connection-mark=subnet1

my ip route (i disabled it at the moment because it does not work)

1 X S dst-address=0.0.0.0/0 gateway=100.100.100.1 gateway-status=103.246.0.61 inactive distance=1 scope=30 target-scope=10 routing-mark=subnet1

I’m not following. Can you try to better explain what you are trying to do?

I would add like to add another default gateway for destination = 0.0.0.0/0 if the source IP equal 10.10.10.0/24

Try something like this.


/ip firewall mangle
add action=mark-routing chain=prerouting new-routing-mark=to_default_gw2 \
    src-address=10.10.10.0/24
/ip route
add distance=1 gateway=100.100.100.1 routing-mark=to_default_gw2

I have tried this before but the route is being ignore and traffic is still being forwarded on the original 0.0.0.0/0 route.

we are running BGP two 2 peers (X and Y)

I am trying to make sure traffic comes in X … goes out via X as well and not Y.

Right now traffic comes in via X and goes out via Y

Even though we have specifically advertise that /24 prefix to X (incoming is working) … outgoing is via Y

Hi Cbrown,

That works :slight_smile:

Thank you.

Now i just need to figure out how to populate Router1 BGP route to Router2 so that when It is being forced to use Router2 as default gateway, it still can get Router 1 BGP route for local internet exchange traffic.

I have tried to setup ibgp but that hang both mikrotik routers.

Maybe try OSPF instead.

http://wiki.mikrotik.com/wiki/Manual:Routing/OSPF