3 wan connection + lan

Hi, I have 3 wan connections. I want to implement per-connection-classifier.

WAN2 is also LAN(big lan network with internet). What needs to be done to force local IP adress list to WAN2 GW 10.168.32.254

my adress list
10.168.31.1
10.168.31.2
10.168.31.3

Thanks in advance

my config
/ip address
add address=192.168.70.1/24 network=192.168.70.0 interface=LANbridge
add address=192.168.8.115/24 network=192.168.8.0 interface=WAN1-ether1
add address=10.168.32.132/24 network=10.168.32.0 interface=WAN2-ether2
add address=192.168.88.249/24 network=10.100.88.0 interface=WAN3-ether3


/ip firewall mangle
add chain=prerouting dst-address=192.168.8.115/24 action=accept in-interface=LANbridge
add chain=prerouting dst-address=10.168.32.132/24 action=accept in-interface=LANbridge
add chain=prerouting dst-address=192.168.88.249/24 action=accept in-interface=LANbridge

/ip firewall mangle
add chain=prerouting in-interface=WAN1-ether1 connection-mark=no-mark action=mark-connection new-connection-mark=ISP1_conn
add chain=prerouting in-interface=WAN2-ether2 connection-mark=no-mark action=mark-connection new-connection-mark=ISP2_conn
add chain=prerouting in-interface=WAN3-ether3 connection-mark=no-mark action=mark-connection new-connection-mark=ISP3_conn

/routing/table
add fib name=to_ISP1
add fib name=to_ISP2
add fib name=to_ISP3


/ip firewall mangle
add chain=prerouting in-interface=LANbridge connection-mark=no-mark dst-address-type=!local per-connection-classifier=both-addresses:3/0 action=mark-connection new-connection-mark=ISP1_conn
add chain=prerouting in-interface=LANbridge connection-mark=no-mark dst-address-type=!local per-connection-classifier=both-addresses:3/1 action=mark-connection new-connection-mark=ISP2_conn
add chain=prerouting in-interface=LANbridge connection-mark=no-mark dst-address-type=!local per-connection-classifier=both-addresses:3/2 action=mark-connection new-connection-mark=ISP3_conn

/ip firewall mangle

add chain=prerouting connection-mark=ISP1_conn in-interface=LANbridge action=mark-routing new-routing-mark=to_ISP1
add chain=prerouting connection-mark=ISP2_conn in-interface=LANbridge action=mark-routing new-routing-mark=to_ISP2
add chain=prerouting connection-mark=ISP3_conn in-interface=LANbridge action=mark-routing new-routing-mark=to_ISP3
add chain=output connection-mark=ISP1_conn action=mark-routing new-routing-mark=to_ISP1
add chain=output connection-mark=ISP2_conn action=mark-routing new-routing-mark=to_ISP2
add chain=output connection-mark=ISP3_conn action=mark-routing new-routing-mark=to_ISP3

/ip firewall nat
add chain=srcnat out-interface=WAN1-ether1 action=masquerade
add chain=srcnat out-interface=WAN2-ether2 action=masquerade
add chain=srcnat out-interface=WAN3-ether3 action=masquerade



/ip route
add gateway=192.168.8.1@main routing-table=to_ISP1 check-gateway=ping
add gateway=10.168.32.254main routing-table=to_ISP2 check-gateway=ping
add gateway=10.100.88.1main routing-table=to_ISP3 check-gateway=ping

All 3 wan connections are on Wan interface list.
How can i allow connection from lanbridge to wan2 interface local network on both ways?

If I understand you correctly and you want to make exception for some destinations, then add a rule like this:

/ip firewall mangle
add chain=prerouting in-interface=LANbridge connection-mark=no-mark dst-address-type=!local dst-address-list=<address list with your destinations> action=mark-connection new-connection-mark=ISP2_conn

and put it before those three with per-connection-classifier.

And communication between LANbridge and WAN2-ether2 is the matter of your firewall. What exactly needs to be done depends on what you have now.

I will wait till the thread is solved to ask my questions (hint, same as last thread).

thanks @sob i added rule. but without luck.
10.168.31.1 is local ip accessible with traceroute tool when interface is selected WAN2-ether2 traceroute
when interface is LANbridge it becomes inaccessible.

I don’t see anything clearly wrong. Does the new rule work, i.e. does it mark anything (you can enable logging for it)?

Another problem can be routing, is there srcnat, or do you keep original address when connecting to 10.168.31.1? If it’s the latter, does 10.168.31.1 have route back to whatever the source address is?

is there posibility to stay with 10.168.32.0 network on lan side , without NAT ?

Maybe. You wrote that “WAN2 is also LAN”, so if it means that you don’t really need own subnet for LAN, and you could have everything in 10.168.32.0/24, then you could bridge LAN and WAN2 together. But I don’t know enough about your environment, how exactly it all works. For example, if there’s already DHCP server for clients in 10.168.32.0/24, because you’d need it to give out your router as gateway, otherwise you’d have no load balancing, if clients would use different gateway. In short, there’s not enough info.

Thanks for your support but i cannot figure out.

All computers have local adreses from 10.168.31.3 to 10.168.32.254. MT router needs to get internet from 10.168.32.254 and give to local computers. I attached schematic

LAN with internet access needs to be on Lan bridge? if i want to stay with 10.168.31.3 to 10.168.32.254 for computers ? or it needs to be like interface ?

for now i achieved that works only one internet connection with connection marker to 10.168.32.254 gw, but feels unstable
network.png

yes i try to achieve that Mt router will be dhcp for network and default gateway. If i bridge LAN and WAN2 together, whats is best way to do ? add wan2 interface to lanBridge ?


add chain=srcnat out-interface=WAN2-ether2 action=masquerade is needed ?

WTF are you doing??
My favourite expression today, dont take it personal.

Firstly WTF do you mean, that you have two subnets?? 10.168.31.0/24 AND 10.168.32.0/24 ?? Like a normal sane person would do? or some ugly twisted setup that only people with training can understand :wink:
All computers have local addresses from 10.168.31.3 to 10.168.32.254

Point two
WTF is this. If you are going to so blatantly mix up WAN and LAN then more detail is required…
MT router needs to get internet from 10.168.32.254

(all computers have local address but my router gets internet from the same local address ??? WTF??? )

According to the first post the LAN is add address=192.168.70.1/24 network=192.168.70.0 interface=LANbridge
Nothing seems to fit …

SO in conclusion,
post your WTF config because nothing makes sense until it is seen

/export hide-sensitive file=WTF

Well, subnets larger than /24 are not as scary as some may think, but what you describe seems as a big mess so far. For start, how did it happen that you have 10.168.32.0/24 on WAN (are you sure about the mask?) and same subnet (possibly part of larger one) in LAN?

This is corporate network(campus network topology) every subnet has its own gw. For network 10.168.31.0 10.168.31.254 and for network 10.168.32.0 gw 10.168.32.254. One house wants to implement internet load balancer. Problem that lan has internet Access with no vlans. I wannted to add router with 10.168.32.253 adress and assing to clients on lan side with same ip network. How can be done? Whats is Best way ?

One would think someone in charge of CAMPUS IT, would know what they are doing, scary world out there…
@s0b not scary more like intimidating.

Yes, this network is big wtf to me. Tomorow i Will post config. But i think its wrong. With 2 internets and 1 normal lan over masqurade it works. But when i add wtf network nothing works.

There nobody in Charge. Ok there is IT boss, but he is more like artist :smiley:

It depends. Easy way is to have original campus network as one WAN, another connection as second WAN, yet another as third WAN, and put all devices in completely different LAN behind your router, so they won’t be direct part of campus network anymore. Then you’d have regular multi-WAN setup.

But if devices need to stay as part of original campus network, it’s problematic. You’d need your router as semi-transparent bridge and intercept connections to internet, in order to load balance them, which is probably possible, but it won’t be anything very pretty.

First solution works, already tryed. But it dosent fit.

network devices need to stay with original campus network.
Is there some manual with dirty solution? Or its to dirty? :slight_smile:

In manual it would be probably listed in “things you shouldn’t do” section. :slight_smile: I’ll try to think about something. How is it with configuration of devices? Do they get addresses from dhcp? Which would be on regular gateway (10.168.32.254) I assume?