Community discussions

MikroTik App
 
dvalilis
just joined
Topic Author
Posts: 8
Joined: Mon May 01, 2023 11:16 am

forwarding of all subnet traffic to secondary gateway

Thu May 23, 2024 6:58 pm

Hello.
I have the following setup on a mikrotik:
ETH1 is my Primary internet gateway, connected to a chateu providing 5g internet. CHATEAU is running a DHCP server at 192.168.118.0/24 and my mikrotik gets an address with its DHCP CLient. It provides internet to both the following Bridges.
ETH3-6 are within a BRIDGE with DHCP Server on 192.168.88.0/24
ETH7-10 are within a BRIDGE2 with DHCP server on 192.168.99.0/24

I want to connect a secondary ISP on ETH2, and forward all the traffic of BRIDGE2 there. trying to find the simplest solution there is to that.
What i tried is this:
Open a DHCP Client on ETH2 with "add default route" set to "NO"
create a ip>route to fowrard all the traffic of the bridge directly to that gateway with
/ip route add disabled=no dst-address=192.168.99.0/24 gateway=192.168.1.1

This doesn't work. Mangle is the only way to go?
 
pe1chl
Forum Guru
Forum Guru
Posts: 10529
Joined: Mon Jun 08, 2015 12:09 pm

Re: forwarding of all subnet traffic to secondary gateway

Thu May 23, 2024 7:30 pm

You can use either:
- mangle with route mark
- route rules depending on source address
- VRF

What is "simple" depends on your insight in the matter, and what you can use depends on some other factors.
E.g. VRF is really easy to setup (add a VRF and put ether2 and bridge2 into it, and just set the default route from DHCP), however it is limited because all services provided by the router itself (like admin, NTP etc) can only be provided in one VRF. So your second subnet is "on its own", but maybe that aligns well with what you want (e.g. a guest network).
 
jaclaz
Forum Guru
Forum Guru
Posts: 2066
Joined: Tue Oct 03, 2023 4:21 pm

Re: forwarding of all subnet traffic to secondary gateway

Thu May 23, 2024 7:34 pm

Wouldn't a routing rule do?
https://help.mikrotik.com/docs/display/ ... cy+Routing

See this example:
viewtopic.php?t=192365

I think you can use "interface" (which is the in-interface) set to bridge2 instead of source IP's.

create table.
/routing table
add fib name=useWAN2

add route
/ip route
add dst address=0.0.0.0/0 gwy=ISP2 gateway routing-table=useWAN2

add routing rule
/routing rule
add action=lookup-only-in-table table=useWAN2 interface=bridge2
 
pe1chl
Forum Guru
Forum Guru
Posts: 10529
Joined: Mon Jun 08, 2015 12:09 pm

Re: forwarding of all subnet traffic to secondary gateway

Thu May 23, 2024 10:17 pm

Yes, that is another way to do it.
Maybe in this case you also want a firewall rule that prevents traffic between the bridges (when that is wanted).
With a VRF that would not be required.
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 22089
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: forwarding of all subnet traffic to secondary gateway

Fri May 24, 2024 3:05 pm

Since the second device is acting as a router getting a private LANIP from the chateau.
What I would do is only use one bridge and two vlans, easy peasy, and firewall rules easily applied.

The question needing answering is what happens when WAN2 is not available do you want the users dedicated to that WAN, to be able to access internet off of WAN1.
Next question the reverse, the other users are using WAN1, do you want them to be able to use WAN2 if WAN1 is not available.

Now I am assuming those not being directed to WAN2 should be using WAN1, but it is possible you want those users not dedicated to WAN2,
to load balance between WAN1 and WAN2, ( aka access both at the same time). This is probably a stretch but as stated your requirements are not completely described.
Would want to have that before proposing any config designs.

Further to that,]
Do you do any port forwarding from external users to any of your LANs.......?
Do you do any VPN services that connect to the router like wireguard.

A config should be built with the context of the whole in mind.
My esteemed colleagues are eager to make conclusions and jump to solutions without such knowledge.
I am not as skilled or perceptive and am much slower. :-)

Who is online

Users browsing this forum: No registered users and 7 guests