Community discussions

 
tvagge
just joined
Topic Author
Posts: 20
Joined: Tue May 22, 2018 2:37 pm

RouterOS - Route traffic through specific gateway problem

Mon Jul 08, 2019 10:10 am

Hi guys,

I'm in front of this working configuration:
/ip address
add address=10.24.14.1/23 disabled=no interface=LAN network=10.24.14.0
add address=10.4.14.2/24 disabled=no interface=WAN1 network=10.4.14.0
add address=10.30.52.242/24 disabled=no interface=WAN2 network=10.30.52.0
add address=10.1.1.2/24 disabled=no interface=WAN2 network=10.1.1.0

/ip firewall filter
add action=accept chain=input disabled=no dst-address=10.30.52.242 dst-port=\
    8080 in-interface=WAN2 protocol=tcp
add action=accept chain=output disabled=no out-interface=WAN2 protocol=tcp \
    src-address=10.24.14.21 src-port=8080

/ip firewall mangle
add action=mark-connection chain=prerouting disabled=no in-interface=WAN1 \
    new-connection-mark=WAN1_connection passthrough=yes
add action=mark-connection chain=prerouting disabled=no in-interface=WAN2 \
    new-connection-mark=WAN2_connection passthrough=yes
add action=mark-routing chain=prerouting connection-mark=WAN1_connection \
    disabled=no in-interface=LAN new-routing-mark=to_WAN1 passthrough=yes
add action=mark-routing chain=prerouting connection-mark=WAN2_connection \
    disabled=no in-interface=LAN new-routing-mark=to_WAN2 passthrough=yes
add action=mark-routing chain=output connection-mark=WAN2_connection \
    disabled=no new-routing-mark=to_WAN2 passthrough=yes

/ip firewall nat
add action=masquerade chain=srcnat disabled=no src-address=10.24.14.0/23
add action=masquerade chain=srcnat disabled=no out-interface=WAN2
add action=masquerade chain=srcnat disabled=no out-interface=WAN1
add action=dst-nat chain=dstnat disabled=no dst-address=10.30.52.242 \
    dst-port=8080 in-interface=WAN1 protocol=tcp to-addresses=10.24.14.21 \
    to-ports=8080
add action=dst-nat chain=dstnat disabled=no dst-address=10.30.52.242 \
    dst-port=8080 in-interface=WAN2 protocol=tcp to-addresses=10.24.14.21 \
    to-ports=8080

/ip route
add disabled=no distance=2 dst-address=0.0.0.0/0 gateway=10.30.52.1 \
    routing-mark=to_WAN2 scope=30 target-scope=10
add disabled=no distance=1 dst-address=0.0.0.0/0 gateway=10.4.14.1 scope=30 \
    target-scope=10
add disabled=no distance=1 dst-address=10.2.60.59/32 gateway=10.1.1.138 \
    scope=30 target-scope=10
add comment=ROUTE1 disabled=no distance=1 dst-address=10.50.14.0/24 gateway=\
    10.30.52.1 scope=30 target-scope=10
add comment=ROUTE2 disabled=no distance=1 dst-address=10.50.14.80/32 \
    gateway=10.30.52.1 scope=30 target-scope=10
add comment=ROUTE3 disabled=no distance=1 dst-address=10.50.147.11/32 \
    gateway=10.30.52.1 scope=30 target-scope=10
add comment=ROUTE4 disabled=no distance=1 dst-address=10.50.147.16/32 \
    gateway=10.30.52.1 scope=30 target-scope=10
add comment=ROUTE5 disabled=no distance=1 dst-address=10.19.25.0/24 \
    gateway=10.30.52.1 scope=30 target-scope=10
add comment=ROUTE6 disabled=no distance=1 dst-address=84.225.251.238/32 \
    gateway=10.30.52.1 scope=30 target-scope=10
When I try to add this in ip/route:
add disabled=no distance=1 dst-address=10.2.60.59/32 gateway=10.1.1.138 scope=30 target-scope=10
the packets never reach the selected gateway (10.1.1.138). All the other routes are working fine. I cant really see what seems to be the problem. Can anyone help please?

*** Note ***
10.30.52.242/24 Network -> Gateway: 10.30.52.1
10.1.1.2/24 Network -> Gateway: 10.1.1.138
 
User avatar
CZFan
Forum Guru
Forum Guru
Posts: 1398
Joined: Sun Oct 09, 2016 8:25 pm
Location: South Africa, Randburg
Contact:

Re: RouterOS - Route traffic through specific gateway problem

Tue Jul 09, 2019 1:17 am

try adding Routing-Mark=to_Wan2 to the route you are trying to add
MTCNA, MTCTCE, MTCRE & MTCINE
 
tvagge
just joined
Topic Author
Posts: 20
Joined: Tue May 22, 2018 2:37 pm

Re: RouterOS - Route traffic through specific gateway problem

Tue Jul 09, 2019 8:30 am

try adding Routing-Mark=to_Wan2 to the route you are trying to add
Hi,

Done that, still not working... When I use tracert to 10.2.60.59 with routing-mark=to_Wan2, it routes through 10.4.14.1 gateway...
 
tvagge
just joined
Topic Author
Posts: 20
Joined: Tue May 22, 2018 2:37 pm

Re: RouterOS - Route traffic through specific gateway problem

Wed Jul 10, 2019 4:34 pm

Hi again,

I still cant figure out what seems to be the problem, can anyone help me?
 
tvagge
just joined
Topic Author
Posts: 20
Joined: Tue May 22, 2018 2:37 pm

Re: RouterOS - Route traffic through specific gateway problem

Fri Jul 19, 2019 1:30 pm

Back again, still problem exists, anyone can help me on that please?
 
User avatar
CZFan
Forum Guru
Forum Guru
Posts: 1398
Joined: Sun Oct 09, 2016 8:25 pm
Location: South Africa, Randburg
Contact:

Re: RouterOS - Route traffic through specific gateway problem

Sun Jul 21, 2019 12:34 am

Start by getting routing only working first, I.e disable mangle and route marking rules.
Once routing is still not working, then troubleshoot from there, if working, then add mangle rules and see where it breaks
MTCNA, MTCTCE, MTCRE & MTCINE
 
tvagge
just joined
Topic Author
Posts: 20
Joined: Tue May 22, 2018 2:37 pm

Re: RouterOS - Route traffic through specific gateway problem

Mon Oct 21, 2019 10:26 am

Hi guys,

I'm coming back on this, has anyone any solution to this problem? I didnt manage to solve it. Please note that the router serves a 1000 clients network, it's on production, so I have a very little room space for radical changes on the existing configuration

Who is online

Users browsing this forum: No registered users and 21 guests