I have to ISP WAN1 and WAN2. I have done load balancing and failover. WAN1 has public IP 41.100.45.23 .WAN2 has 197.45.87.45. So when I check my public IP on ‘whatsmyip.com’, one moment I get 41.100.45.23, the next moment I will get 197.45.87.45. What changes should I apply to always have public IP of WAN1 showing every time. also public IP of WAN1 showing when I do speedtest
I don’t understand why you open a new topics with the same name instead of using the existing one for the same actual topics, but the essence of load balancing is to choose a WAN for each session depending on the load balancing rules. So if you want all sessions to whatsmyip.com to always use the same WAN, you must override the load balancing rules for that destination:
/ip firewall address-list
add list=use-wan1 address=whatsmyip.com
/ip firewall mangle
...
add chain=forward action=mark-connection new-connection-mark=wan1 connection-mark=no-mark dst-address-list=use-wan1 passthrough=yes
...your load distribution rules here...
But if you actually want any remote server to see the requests from your network as coming from the public address associated to WAN1, you cannot use the load balancing (unless, as said, you could reach a special agreement with both ISPs involved). For a single address, reaching such agreement is close to impossible due to technical limitations (most networks do not accept dynamic routing of individual addresses).
I think you could use something like:
/ip firewall mangle
add action=mark-connection chain=prerouting new-connection-mark=via_1 per-connection-classifier=dst-address:2/0
add action=mark-connection chain=prerouting new-connection-mark=via_2 per-connection-classifier=dst-address:2/1
add action=mark-routing chain=prerouting connection-mark=via_1 new-routing-mark=route_via_1
add action=mark-routing chain=prerouting connection-mark=via_2 new-routing-mark=route_via_2
To ensure that all traffic to a given IP will always appear to come from the same public IP (use both-addresses rather than dst-address to allow different machines on the lan to hide behind different IPs, or src-address to ensure that a given machien always appears from teh same IP regardless of the destination)
so pwuk how does that method deal with two unequal throughputs for ISP1 and ISP2?
For example what if for every 3 connections to WAN1, the router should then make two connections to WAN2 (in the case that throughput of WAN is 1.5x greater).
What I see is more like 50 50 which is ONLY optimal for equal throughput from ISP1 and 2??
Clearly if the bulk of your traffic is from one IP to another IP you can’t balance it – at least not without an ISP providing something like LACP or ECMP (and even then I believe it’s good practice to send the same IP/port/src-dst down the same link to avoid reorders. I’ve not really used either protocol, and very rarely do multiple wans on the same router)
However on average you will get load balancing if every other connection goes down a different link.
You can spread the load via port numbers too, but that might confuse some websites to get upset that your source IP is constantly changing
You have to decide your priorities…
a. is it load balancing which is functionality that makes sense and has a purpose.
OR
b. a personal issue about which IP address is shown with MY IP changing because you wanted a. load balancing so the router is doing what your asked already.
and seemingly you want this to be showing only one IP, with no functional reason or purpose ???