I need that if someone makes a request through port 31445, the traffic leaves through WAN1, but if the request is made through port 32445, the traffic leaves through WAN2.
That is but one snippet of the requirements. YOu need to be clear with all other traffic before any configuring.
How many subnets do you have, which wan should they use??
Do you have an users cominig in externally?
How do you propose to use your two WANS ?? ( share, primary/failover etc…)
You need a plan and requirements clearly spelled out before even considering starting a configuration.
Logical. Right now the system is in production and working, but I want to add the following possibility. I will explain in more detail.
The Mikrotik router to use is CCR2116
You have contacted two ISPs.
ISP1 - Ip fija 98.X.X.X
ISP2 - DHCP y VLAN20 215.X.X.X
On the Lan side a subnet 192.168.10.0/24
I have a server with the IP 192.168.10.10 and it is an IPTV server.
In the NAT of the mikrotik I have the following ports open
ISP1 - 98.X.X.X → Puerto 45100 - 192.168.10.10
ISP2 - 215.X.X.X → Puerto 46100 - 192.168.10.10
What we need is that if from the outside we make a request for a channel, the traffic of that channel leaves through the same ISP through which it entered, for example
(1) First it would appear that ISP1 gives you a static public IP?
It would appear that ISP2 gives you a dhcp dynamic public IP that changes from time to time?
The format for static IPs and sourcenat is add chain=srcnat action=src-nat in-interface=ether1 to-address=98.X.X.X
add chain=srcnat action=src-nat in-interface=vlan20 to-address=215.X.X.X { assuming its a static WANIP }
default dynamic WANIP (if both were dynamic) add chain=srcnat action=masquerade out-interface=ether1
add chain=srcnat action=masquerade out-interface=vlan20
(2) To ensure traffic coming on WAN1 goes out WAN1 etc, we need mangling. /ip nat mangling
add chain=prerouting action=mark-connection connection-mark=no-mark
in-interface=ether1 new-connection-mark=incomingW1 passthrough=yes
add chain=prerouting action=mark-connection connection-mark=no-mark
in-interface=vlan20 new-connection-mark=incomingW2 passthrough=yes
add chain=output action=mark-routing connection-mark=incomingW1
new-routing-mark=useWAN1 passthrough=no
add chain=output action=mark-routing connection-mark=incomingW2
new-routing-mark=useWAN2 passthrough=no
Need to create two tables.. /routing table
add fib name=useWAN1
add fib name=useWAN2
Besides two standard routes to wan1 and wan2 need two additional routes /ip route
add dst-address=0.0.0.0/0 gateway=WAN1-gateway-IP routing-table=useWAN1
add dst-address=0.0.0.0/0 gateway=WAN2-gateway-IP routing-table=useWAN2
And modify fastrack rule in forward chain to: add action=fasttrack-connection chain=forward comment=“defconf: fasttrack”
connection-state=established,related hw-offload=yes connection-mark=no-mark