I have to ISP providers one LTE and one ADSL.
I have a 5 port RB, and a different subnets in each port.
ether1 and ether 2 are the gateways.
ether1 = XXX.XXX.XXX.XXX / XX public IP for incoming connections to my data server
ether2 = 192.168.20.254/24
ether3 = 192.168.160.1/24 (this for one rental offices in the building, they have surveillance cameras to acces from outside)
ether4 = 192.168.50.1/24 (this is the ethernet tha has the data servers, need to be accessed from the oustide)
ether5 = 192.168.170.1/24 (this is for home users, smartphones, tablets, pc’s, etc)
I want to manage all the traffic for the ether3 and ether5 need to go out to the internet trought the ether 2 port and LTE connection.
And I need to have the ether4 go to ether1 to the internet, and all the incoming connections from the internet trought the public IP, to ether4.
For now, all the traffic is trought the ether 1 as a primary gateway, incoming and outgoing connections. I tried different methods, but cannot manage to do this.
Also, all the local subnets, need to acces the data server in ether 4.
If someone could give me an idea on how to do this…
In the mangle table, make some rules that do connection marking based on the in-interface. Set passthrough=yes on these rules.
Afterwards, add some rules that do route-mark based on the connection marks that you want to have policy routes (routing other than the main table)
Then in the routing table, create routes with the route-mark on them. You’ll need to add your LANs to the policy routes as well so that lan<>lan connectivity works.
okay - it looks kind of jumbled up, so let’s tackle things piece by piece.
I recommended putting no routing mark on any packets except those you wish to force through the ADSL.
Let the standard routing table’s default gw be the LTE interface.
okay - the first thing you need to do in mangle is switch to using connection marks, then do routing marks based on the connection marks:
prerouting:
return
(make sure passthrough = yes for rules 1-3)
Now add rules to output chain of mangle table:
connection-mark=dsl action=mark-routing new-routing-mark=dsl
— ok so that means your LTE interface should be the standard routing table and the DSL should be its own routing table.
Now remove the LTE routing mark from any routes (and remove any duplicates this creates)
In the DSL routing table, add connected routes for 192.168.160/24 gateway=ether3 and 192.168.170.0/24 gateway=ether5
The dsl default GW you set should be fine. Also add xxx.xxx.xxx.xxx/xxx gateway=ether1 to the DSL routing table.
So the idea is: use connection marking to glue each connection to a particular routing table, based on the interface it starts on. Replies will automatically be properly routed as well - this last detail was the downfall of the rules you posted, at least I think that’s the case.
here are the rules I made it, I hope I wrote them well enough, but they does not work at all..... still no connection from the outside wile I need to have everything else trough LTE...
This rule should also have the condition connection-mark=no-mark
As you wrote the rule, it will overwrite the DSL connection mark with LTE, no matter whether the connection already has the DSL mark.
When you add the criteria connection-mark=no-mark, then it will only mark connections as LTE if they haven’t already been flagged as DSL.