Mikrotik - Adds a second WAN IP address and specific route traffic

After 20 pages of SO results on Mikrotik and some other Google results, I came here kneeling to request some enlightenment.

I have a network with a static IP and some public IP (mask 248).

So far, I have configured the network to use one of these public IP addresses and used it for two subnets (192.168.85.X and 192.168.5.X) that are isolated from each other, and both can access the Internet.

What I'm trying to achieve is add a second WAN router to the router and route traffic to a specific server to use this IP address.

What I mean:

  • Any PC with 192.168.85.X must use WAN IP1 and use the Internet with it.
  • Any PC with 192.168.85.X trying to access www.facebook.com must use WAN IP2 to view and navigate this website (while all other traffic goes through WAN IP1).

The device that gives me the WAN link has only one "out" port, so there is no way to place 2 cables from the "modem" to Mikrotik, right now there is one cable going from the modem to the Mikrotik device. I saw a forum post where the first part can be solved by simply connecting two cables and then assigning different IP addresses for each interface.

As you can see, I'm really happy with the network and routing, so any GUI / Winbox command is appreciated, but the CLI commands will be fine.

+5
source share
1 answer

This information is intended for those who may want to do this in the future:

1.- If you evaluate the WAN IP interface using the same XXXX / 29 notation, the router will know that you want to use the entire IP address, but set the default route to use this IP as preferred. This can be found in IP> Routes.

2.- If you want to use different IP addresses for other traffic, you need to: a) Mark this traffic and b) force the traffic to go to a specific IP address. You do this in IP> Firewall> Mangle to mark traffic and IP> Routes to add a new route for this traffic. There is conflicting information about whether or not you need to add NAT rules (IP> Firewall> NAT) for traffic, and I really lost it (it does not work with or without, but sometimes it works).

That's all I can add to this, I will continue to search and respond to serverfault, as @SergGr suggested.

+1
source

Source: https://habr.com/ru/post/1265405/


All Articles