Create a gateway corresponding to each WAN

Hello. I am a public internet service provider using CCR2116. I have 3 network lines from 3 different providers. According to PPPoE-Client connection method.
I want to build a system like the following.

  • Gateway 192.168.1.1: Is the gateway that combines the bandwidth of the above 3 transmission lines.
  • Gateway 192.168.1.2: If guests use this gateway, they will only use the WAN1 connection
  • Gateway 192.168.1.3: If guests use this gateway, they will only use the WAN2 connection
  • Gateway 192.168.1.4: If guests use this gateway, they will only use the WAN3 connection.
    Equivalent to this solution for other VLANs.
    I have learned and understood how to aggregate bandwidth, but I have not been able to find any documents on how to create gateways linking to fixed WANs. Please help me. I respectfully thank you.

Have a look at /interface/macvlan. By attaching three of them to the same underlying interface and attaching one of the gateway IP addresses to the underlying interface itself and each of the remaining three to another one of the macvlan interfaces, you’ll get the behavior you need:

  • when the connected device sends an ARP request asking to translate an IP address attached to a macvlan interface, Mikrotik responds with the MAC address of that macvlan interface
  • when a frame carrying an IP packet arrives to a MAC address of a macvlan interface, Mikrotik sets the in-interface metafield of that packet to the name of the macvlan interface
  • using mangle rules matching on in-interface, you can define the individual routing strategies as needed.

I use winbox and I can’t find these settings. I am using the latest Mikrotik OS v7

If possible, can you provide the command for me? I’m really not too familiar with configuring mikrotik in CLI

In Winbox, press the [Interfaces] button to open the Interface List window. In that window, choose the MACVLAN tab. Using the [+] button, open a form for adding the interface. If you do not enter a MAC address manually, it will be generated randomly.

Quote: “… By attaching three of them to the same underlying interface”

According to the OP, he states, 3 different providers and 3 network lines. In other words it is NOT 3 different IPs from the same provider on a single line ??
Does that matter??

The OP specifies 4 routing policies in total: 3×"use only this WAN" and 1×"distribute the traffic evenly among all WANs", and wants to allow the “LAN” side devices to choose one of these policies by means of using one of 4 available IP addresses as the gateway.

Using MACVLAN can help in the process of creating multiple gateways. However, the most important part is routing. How to route IPs from MACVLAN to certain WAN links. I’m still unclear about this issue. Looking forward to further guidance.

Macvlans not my area of knowledge but for basic routing.
a. group A go to WAN2
b. group B go to WAN3
c. group C go to WAN4
D. Everyone else goes to WAN1 so that they can use all three above equitably.

Means you have to identify the groups A,B,C
are they single users, groups of users, subnets of users???
do they exist on one port, several ports, across vlans etc. ???

Mostly likely you will have to mangle traffic so that
1 group A goes to WAN2
2 group B goes to WAN3
3 group C goes to WAN4
THEN use LOAD BALANCING to send remaining users to WAN2,3,4

Need more detail really to provide further assistance.
For example you have not noted any port forwarding/servers or vlans involved in the connections.

Interesting. In the OP (Original Post), you wrote:

From that, I’ve understood that your only remaining issue is how to choose the appropriate routing based on the gateway address used by the client.

Look for “policy routing” topics on the forum. There must be tens, if not hundreds, of topics that deal with this, except that the criteria to choose one or another policy are typically physical in-interfaces, source addresses, protocols and ports.

If you need a step by step assistance, start from posting the export of your current configuration: open the [Terminal] window in Winbox, and type /export hide-sensitive file=some-nice-name, and when the command finishes, download the file some-nice-name.rsc to your PC. Then open it in a text editor, remove the serial number, usernames for external services etc., and if it bothers you, also obfuscate public addresses in a way that does not break their relationships - ideally, replace the first two or three bytes of each public IP addresses using the Find&Replace function of your text editor, so that each actual prefix gets replaced by the same string in all addresses with that prefix. I.e. if your own WAN address is 12.13.14.25/24 and the corresponding gateway is 12.13.14.254, replace 12.13.14 by wan.1.prefix in the whole document.

Sorry for my unprofessional explanation. I can describe it with a simple example as follows.

I have a customer with their internal IP 192.168.1.50 with gateway 192.168.1.1

They are connecting to a switch. and the switch connects to the router via an ether port and to a bridge named “LocalBridge”

I want the Mikrotik Router to provide additional gateways 192.168.1.2, 192.168.1.3, 192.168.1.4. If the customer sets up static IP with these gateways, the internet traffic will only go in and out on the corresponding lines according to the following list:

  • Gateway 192.168.1.2: If guests use this gateway, they will only use the WAN1 connection
  • Gateway 192.168.1.3: If guests use this gateway, they will only use the WAN2 connection
  • Gateway 192.168.1.4: If guests use this gateway, they will only use the WAN3 connection.
    ==============
    I know that the forum has many posts with instructions on routing. However, most of them are instructions on bundling bandwidth using PCC or specifying which internal IP range will go through which WAN (eg 192.168.10.0/24 will go through WAN4). However, there has never been any instructions related to the Mikrotik Router providing multiple gateways to certain WAN lines.

For Draytek this is very easy. They have a feature called “Alias ​​Gateway” that allows you to create multiple gateways on the same network and link them to specific WANs with just a few clicks.

I think I made a mistake buying devices from Mikrotik. They are too difficult to configure. For the same price, the Draytek 3912s is a much better choice.

It depends. When you want flexibility and can endure the learning curve, Mikrotik is your best choice. When you want simplicity and don’t mind that you only get a limited number of pre-defined settings, go for something else. You cannot have wide configuration possibilities and simplicity at the same time.

So gentle, I prefer, spoon feeding stops at age2.
Effort is respected and rewarded.