In fact I didn't know if this is a beginner or general question...
I'm a newbe to Mikrotik but with some experiece with other routers.
I read lots of documentation and have a problem with NAT and mangle in more complex environment.
There is no comprehensive examples that would cover few problems in one script – like full failover scenario.
I did not also find in the network any description how to make internal servers’ load balancing/failover to single or multiple wans (eg. with a mangle command) – what probably is possible using Mikrotik, but nobody has described this up to now…
Even Mikrotik did not publish such example, that – for sure – would be very appreciated by lots of people.
Can anybody (more advanced in Mikrotik routing) sketch the NAT (src and dstn) and mangle configuration for described example?
I would appreciate any help.
Situation:
WAN1 bridge – IPs: 100.0.0.2/29, 100.0.0.3/29 (SMTP), 100.0.0.4 /29 (WWW, DNS), gatewayWAN1 100.0.0.1/29
WAN2 bridge – IPs: 200.0.0.2/29, 200.0.0.3/29 (SMTP), 200.0.0.4/29 (WWW, DNS), gatewayWAN2 200.0.0.1/29
LAN1 bridge – Ips: 192.168.0.1/24
LAN2 bridge – Ips: 10.0.0.1/24
Please correct me if I'm wrong - in my opinion using bridges for all interfaces gives the possibility to easy add proper interfaces, switches or VLANs to them, so it can allow for fast migration between routers having different number of ports without the pain in changing all firewall rules etc.
On LAN1 we have:
ServerSMTP port TCP 25 – IP: 192.168.0.10
On LAN2 we have:
ServerDNS1 IP: 10.0.0.30 – server DNS - port UDP 53, TCP 53
ServerDNS2 IP: 10.0.0.130 – server DNS - port UDP 53, TCP 53
ServerWWW1 IP: 10.0.0.10 – server WWW - port TCP 80,443 (www.AAA.com)
ServerWWW2 IP: 10.0.0.11 – server WWW - port TCP 80,443 (www.AAA.com)
ServerWWW3 IP: 10.0.0.12 – server WWW - port TCP 80,443 (www.AAA.com)
+ Few computers that are put on the TrafficWAN1 address List
We would like to:
#1
Route all traffic from LAN1 through WAN1 (100.0.0.2) except from traffic from SMTP server, that shall be routed through IP: 100.0.0.3
In case WAN1 is not functioning all traffic from LAN1 shall be routed through WAN2 IP 200.0.0.2/29, SMTP server through 200.0.0.3.
#2
SMTP server shall serve and respond on SMTP communication on both interfaces (100.0.0.3 and 200.0.0.3).
#3
Traffic from LAN2 shall be routed through WAN2, except from computers that are on TrafficWAN1 address list. By default all traffic from LAN2 shall use 200.0.0.2 addresses except from published servers WAN2 traffic, that shall go out through 200.0.0.4 address.
In case WAN2 is not working traffic from LAN2 shall be switched to WAN1.
And now most important issue, like internal servers failover and load balancing:
#4
There are 2 DNS servers.
ServerDNS1 serves all incoming DNS questions on interface WAN1 (IP: 100.0.0.4)
ServerDNS2 serves all incoming DNS questions on interface WAN2 (IP: 200.0.0.4).
In case ServerDNS1 is down all incoming DNS requests in 100.0.0.4 should be handled by ServerDNS2.
In case ServerDNS2 is down all incoming DNS requests in 200.0.0.4 should be handled by ServerDNS1.
#5
There are 3 (or more) WWW servers (ServerWWW1, ServerWWW2, ServerWWW3).
They are configure to serve that same web site/web content. Kind of farm of web servers.
All of them are handling www requests on both interfaces (WAN1 100.0.0.4 and WAN2 200.0.0.4).
Incoming traffic shall be distributed among internal servers (eg. semi-equally).
In case any of servers is down (failure, maintenance etc.) – incoming traffic is distributed only between working servers.
And for the end:
#6
If it is possible - any of published services (WWW, DNS, SMTP) shall be visible and accessible for internal users through public IP reference (kind of hairpin NAT?)