Community discussions

MikroTik App
 
perhydrol
just joined
Topic Author
Posts: 3
Joined: Mon Apr 29, 2024 8:56 am

Multiple gateways in RouterOS 7.6

Mon Apr 29, 2024 9:06 am

Please help, I don't know what I'm doing wrong.
I need to redirect traffic from one VLAN to another gateway. And everything else through the first gate.

I have two Internet providers:
- WAN1 - main provider for all (and same provider for incoming traffic: WWW, SSH, FTP )
- WAN2 - a dedicated provider for a group of people on a VLAN-20

I saw examples on the forum, but they are probably for OS 6.x, unfortunately I did not find any for OS 7.6
# RouterOS 7.6
# software id = CT6S-01WD
#
# model = RB3011UiAS
# serial number = ***
/ip firewall mangle
add action=mark-connection chain=prerouting comment="From VLAN20 to WAN2" connection-mark=no-mark \
	in-interface=VLAN-20 log-prefix="MARK CONNECTION" new-connection-mark=fromV20 passthrough=yes
add action=mark-routing chain=prerouting comment=viaWAN2 connection-mark=fromV20 \
	in-interface=VLAN-20 log-prefix="MARK ROUTING" new-routing-mark=tableWAN2 passthrough=yes

/ip firewall nat
add action=masquerade chain=srcnat out-interface=WAN-1-PPPoE
add action=masquerade chain=srcnat out-interface=WAN-2-ether5

/ip route
add distance=1 dst-address=0.0.0.0/0 gateway=192.168.10.1 pref-src="" routing-table=main scope=40 suppress-hw-offload=no target-scope=20 vrf-interface=WAN-2-ether5 check-gateway=arp comment="WAN2"
add distance=1 dst-address=0.0.0.0/0 gateway=172.16.20.1 pref-src="" routing-table=main scope=40 suppress-hw-offload=no target-scope=20 vrf-interface=WAN-1-PPPoE check-gateway=arp comment="WAN1"

/routing table
add fib name=tableWAN2

/routing rule
#add action=lookup-only-in-table routing-mark=main table=main disabled=yes
add action=lookup-only-in-table routing-mark=tableWAN2 table=tableWAN2
As a result, everything is redirected to the second gate, and nothing goes out through the first one.
Last edited by BartoszP on Mon Apr 29, 2024 11:47 am, edited 1 time in total.
Reason: removed serial no.
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 19685
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Multiple gateways in RouterOS 7.6

Mon Apr 29, 2024 2:09 pm

What happens if wan1 or wan2 is not available. Do you want for example for users on WAN2 to have access to WAN1?
What happens if wan1 is down?

What type of VPN do you have to remotely configure the router ( if the router has a publicly reachable IP, or the upstream router does and you can port forward from it, suggest you use wireguard).
 
perhydrol
just joined
Topic Author
Posts: 3
Joined: Mon Apr 29, 2024 8:56 am

Re: Multiple gateways in RouterOS 7.6

Mon Apr 29, 2024 4:17 pm

If any of the WAN1 or WAN2 links fails, there will be no Internet access (without any backup)

I use OpenVPN, with a defined access list from selected IPs.

WAN1 - has a public static IP address under which the website is shared, and only at this address WAN1 can be accessed, this is how DNS is configured
 
perhydrol
just joined
Topic Author
Posts: 3
Joined: Mon Apr 29, 2024 8:56 am

Re: Multiple gateways in RouterOS 7.6

Tue May 07, 2024 8:32 am

Is there anyone here who could help?
Where can I look for a mistake? Is there no chance for this solution to work properly on version 7.6?
 
LdB
Member Candidate
Member Candidate
Posts: 164
Joined: Thu May 20, 2021 4:23 pm

Re: Multiple gateways in RouterOS 7.6

Tue May 07, 2024 9:30 am

Try
/ip route
add distance=1 dst-address=0.0.0.0/0 gateway=192.168.10.1 pref-src="" routing-table=tableWAN2 scope=40 suppress-hw-offload=no target-scope=20 vrf-interface=WAN-2-ether5 check-gateway=arp comment="WAN2"

Who is online

Users browsing this forum: DanMos79, Semrush [Bot] and 39 guests