Community discussions

MikroTik App
 
SapieH
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 50
Joined: Wed May 13, 2009 9:44 pm

how to route packets out of network

Tue Jul 24, 2012 10:53 pm

I need to route packets out the same wan as the one they enterd on Any ideas??
 
Ivoshiee
Member
Member
Posts: 483
Joined: Sat May 06, 2006 4:11 pm

Re: how to route packets out of network

Wed Jul 25, 2012 1:41 am

I have multiple WANs and regadless of the actually active WAN I redirect my backup WAN sessions with something like that:
/ip firewall mangle
add action=mark-connection chain=input comment="Attach a marker wan1 to every session initiated from the WAN1 side (bridge1)." disabled=no \
    in-interface=bridge1 new-connection-mark=wan1 passthrough=no
add action=mark-routing chain=output comment="All sessions originating WAN1 will get answers back through the same interface." connection-mark=wan1 disabled=no new-routing-mark=\
    back passthrough=no
add action=mark-connection chain=prerouting comment="Attach marker wan1 to every session originating WAN1, but what are redirected through the router to some internal host." disabled=no \
    in-interface=bridge1 new-connection-mark=wan1 passthrough=no
add action=mark-routing chain=prerouting comment="All sessions originating WAN1 will get answers back through the same interface." \
    connection-mark=wan1 disabled=no new-routing-mark=back \
    passthrough=no

/ip firewall nat
add action=src-nat chain=srcnat disabled=no routing-mark=back src-address=\
    192.168.0.0/16 to-addresses=WAN1_IP_ADDRESS

/ip route
add comment="WAN1 connection using hosts use that default route." disabled=no distance=1 \
    dst-address=0.0.0.0/0 gateway=WAN1_ISP_GW routing-mark=back scope=255 \
    target-scope=10
Note: I hope I didn't left anything important out of it.
Last edited by Ivoshiee on Fri Aug 03, 2012 3:44 am, edited 1 time in total.
 
User avatar
cbrown
Trainer
Trainer
Posts: 1839
Joined: Thu Oct 14, 2010 8:57 pm
Contact:

how to route packets out of network

Wed Jul 25, 2012 3:37 am

 
SapieH
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 50
Joined: Wed May 13, 2009 9:44 pm

Re: how to route packets out of network

Wed Jul 25, 2012 7:46 am

Guys, Thanks for the info. Much apreciated :D

Who is online

Users browsing this forum: ilyav3 and 109 guests