Community discussions

MikroTik App
 
Rockyboa
Member Candidate
Member Candidate
Topic Author
Posts: 108
Joined: Tue Jul 14, 2009 10:52 pm

Prefered source

Tue Mar 26, 2013 10:56 pm

I have two public IP on my WAN interface. I'm trying to build two tunnels to this interface originating from the same remote router. I think I have good chances to make this work but there is a little captcha I need to solve.

on the main office WAN interface when I disable one of the IP thus changing the prefered source one of the tunnel is connected. Once we disable the working interface and reactivating the other IP (chaninging agin the prefered source) it is the other tunnel that connects.

With both tunnel activated, they are battling one against the other. So I'm pretty sure the only thing I need to solve is make sure that all traffic with a destination ip 1.1.1.1 is returning with the prefered source 1.1.1.1 and all the traffic with a destination 2.2.2.2 is going back with 2.2.2.2.

I wrote those two mangle and routing rule but it doesnt work as expected.
/ip firewall mangle
add action=mark-routing chain=prerouting dst-address=x.x.x.125 in-interface=\
    WAN new-routing-mark=to_125
add action=mark-routing chain=prerouting dst-address=x.x.x.126 in-interface=\
    WAN new-routing-mark=to_126

/ip route
add distance=1 dst-address=x.x.x.120/29 gateway=x.x.x.121 pref-src=\
    x.x.x.125 routing-mark=to_125
add distance=1 dst-address=x.x.x.120/29 gateway=x.x.x.121 pref-src=\
    x.x.x.126 routing-mark=to_126
add distance=1 gateway=x.x.x.x

 
User avatar
omega-00
Forum Guru
Forum Guru
Posts: 1167
Joined: Sat Jun 06, 2009 4:54 am
Location: Australia
Contact:

Re: Prefered source

Wed Mar 27, 2013 6:24 pm

Perhaps something like this is what you're looking for? (forces traffic coming in on a WAN interface to pass out the same)

ros code

/ip route
add check-gateway=arp comment="Default Route - Distance 1" disabled=no distance=1 dst-address=0.0.0.0/0 gateway=wan1
add check-gateway=arp comment="Default Route - Distance 2" disabled=no distance=2 dst-address=0.0.0.0/0 gateway=wan2
add check-gateway=arp comment="Static Route - WAN1" disabled=no distance=1 dst-address=0.0.0.0/0 gateway=wan1 routing-mark=static-wan1
add check-gateway=arp comment="Static Route - WAN2" disabled=no distance=2 dst-address=0.0.0.0/0 gateway=wan2 routing-mark=static-wan2
 
/ip firewall mangle
add action=mark-connection chain=input comment="Mark new inbound connection wan1" connection-state=new disabled=no in-interface=wan1 new-connection-mark=wan1 passthrough=yes
add action=mark-connection chain=input comment="Mark new inbound connection wan2" connection-state=new disabled=no in-interface=wan2 new-connection-mark=wan2 passthrough=yes
add action=mark-routing chain=output comment="Mark new inbound route wan1" connection-mark=wan1 disabled=no new-routing-mark=static-wan1 passthrough=no
add action=mark-routing chain=output comment="Mark new inbound route wan2" connection-mark=wan2 disabled=no new-routing-mark=static-wan2 passthrough=no
 
Rockyboa
Member Candidate
Member Candidate
Topic Author
Posts: 108
Joined: Tue Jul 14, 2009 10:52 pm

Re: Prefered source

Thu Mar 28, 2013 3:40 am

Thank you omega for helping out.

I might not be clear but I'm located on the main office router with a single WAN but with two public IP assigned to it. I'm not tying to mangle on two interfaces but trying to build a rule that will make sure that my traffic coming in my router (and ending there since those are L2TP tunnels) goes out on the same interface but with the same public IP it had has the destination address and not the automatically defined prefered source of this wan interface.

Martin
 
User avatar
OwenITGuy
just joined
Posts: 23
Joined: Wed May 09, 2012 6:04 am
Location: Iowa, USA & Bunia, DRCongo
Contact:

Re: Prefered source

Thu Jul 11, 2013 12:34 pm

Rockyboa, did you ever get an solution for this? I'm trying to do something similar (one interface, two IP addresses), and can't seem to get it to work correctly.

Who is online

Users browsing this forum: wishnu and 28 guests