NAT a single IP using 2nd WAN Internet
To achieve this you need to create 2 firewall rules (mangle & nat) and add a static route.
First you create the mangle rule which will mark the packets of the specific IP you want to route through WAN2 with a new routing mark
. Replace 192.168.1.X with the IP you want to route via WAN2.
/ip firewall mangle add chain=prerouting src-address=192.168.1.X \
dst-address=!192.168.1.0/24 action=mark-routing new-routing-mark=wan2
If you need to route another IP too, you can either copy this rule and change the IP or you can create an Address-List (/ip firewall address-list
) and use that with a single rule.
Then you create the src-nat
rule so that packets leaving from WAN2 will have the appropriate source IP instead of 192.168.1.X (depending on your current configuration you may not need to do this)
/ip firewall nat add chain=srcnat routing-mark=wan2 action=src-nat \
to-addresses=2.2.2.20
And finally you create the static route that will be used to route the marked packets via WAN2.
/ip route add dst-address=0.0.0.0/0 gateway=2.2.2.2 routing-mark=wan2
You'll be able to do this with policy based routing, which can be done with the mangle table. Essentially it allows you to define a number of conditions and select a next hop based on them.
It's well covered here:
http://wiki.mikrotik.com/wiki/Policy_Base_Routing