I have to WAN connection which one of them is ADSL with pppoe and valid ip-address connection and the other one is Wimax with invalid ip-address and manual configuration.
I want to make my local clients when trying to connect specific host and specific port the use wimax link and for the rest of internet traffic they going through adsl link.
for example when my clients trying to connect to X.X.X.X:35478 they going through wimax link and when they try to going anything other than X.X.X.X:35478 they going through adsl link.
obviously if they try to connect to X.X.X.X:80 or something other than 35478 they must going through adsl link.
Thank you for your reply…
I try what you said but it’s not working.
Since i want only x.x.x.x:35478 traffic goes through Wimax link after doing what you said i test it and found out web traffic is going through wimax link
I don’t know what exactly might be wrong, but the basic idea with routing mark is correct and should work. Check wiki for some examples, maybe you’ll spot what’s wrong.
Just one note about your NAT rules, “out-interface” does not mean action, i.e. “make the traffic go through that interface” but condition, i.e. “use the rule if the traffic goes out through that interface”.
Thank you…
Tried what you said step by step but it didn’t work.
The whole traffic to outside is drop. outside is not accessible even x.x.x.x:35478 is unreachable.
05:24:49 firewall,info postrouting: in:(none) out:wan1, proto TCP (SYN), 192.168.80.10:52192->10.55.1.1:23, len 52
05:24:49 firewall,info postrouting: in:(none) out:wan1, proto TCP (SYN), 192.168.80.10:52193->10.55.55.55:23, len 52
05:24:51 firewall,info postrouting: in:(none) out:wan2, proto TCP (SYN), 192.168.80.10:52194->10.55.55.55:5555, len 52
You can clearly see that packet to 10.55.55.55:5555 is exiting via wan2, while others go via wan1. The source address is still 192.168.80.10, because the logging rule is before the masquerade rule. But NAT works, it can be checked in Torch tool that the source of outgoing packets is 10.0.20.1 (for wan1) or 10.0.100.1 (for wan2).
Thanks for your help…
It’s not working… I really confused … i did exactly what you said with only changing details (like IP addresses and ports) to suite my network.
Since i want to dedicate a link to a specific host:port is it possible to do it with NAT ?
I mean writing two NAT rule one for HOST:TCP/PORT to go through WiMax Link and the one for other destinations to go through ADSL-PPPOE-Connection?
Where packets go is determined by routing table. NAT only changes addresses. You can influence routing by changing destination address in dstnat, but it won’t help you much in this case, because you don’t want to change destination address.
Maybe some other part of your config is ruining the effort? Some other firewall rules for example… Sharing complete relevant parts of your config might help. Those would be /ip address, /ip route and /ip firewall. Just don’t overdo address masking, it won’t help if everything becomes x.x.x.x. If you have public addresses and you’re concerned about your privacy, it’s enough to mask just one or two leading digits. For private ones (192.168.x.x, 10.x.x.x and 172.16-31.x.x) masking is completely unnecessary.