K
K
Konstantin Dolinin2014-02-11 15:41:14
Mikrotik
Konstantin Dolinin, 2014-02-11 15:41:14

How to redirect from Mikrotik gateway to another Linux gateway on the same subnet?

I am a very, very newbie, but nevertheless, this task arose in front of me. It is necessary that computers with certain known MAC addresses access the Internet through the Linux gateway (192.168.1.2) when accessing the Mikrotik gateway (say, 192.168.1.1). How to implement this?

Answer the question

In order to leave comments, you need to log in

9 answer(s)
N
nimbo, 2014-03-19
@nimbo

take one day off and do everything right.
1) at least cost to raise dhcp - simplify your administration of new nodes and hosts;
2) understand the problem with the modem and mikrotik - tell in a new question what kind of tick and modem model and under what conditions the problem occurs, more specifics, it makes no sense to guess in the thick of it;
3) the more you get smart with the network, the more difficult it will be to maintain and administer. remove unnecessary gateways and other good from it. look towards performance and fault tolerance better. for example, place linux, you can put router os Mikrotik on the machine and make a failover gateway via VRRP - here you can read
I answer your question (if you are too lazy to change everything and generally don’t care about yourself and the client) - connect a linux machine to the Mikrotik interface, select it from the switch to another wan and let the VIPs through it.
learn to do it right right away without half-way solutions, without twists and other good things, because everything temporary remains forever and works badly, creating a bunch of headaches.

S
Sergey, 2014-02-11
@edinorog

Stupid question maybe? Nah separate gateway on Linux?

S
sonik_spb, 2014-02-11
@sonik_spb

It is possible to turn it by forces of DHCP. Configure so that all poppies are given a gateway 1.1, and the necessary 1.2 already.

T
throughtheether, 2014-02-11
@throughtheether

As I understand it, mikrotik and linux-machine are in the same l2-domain (i.e. included in the same switch, ports in the same vlan, interfaces 192.168.1.1 and 192.168.1.2 can ping each other)?
If so, then you can raise a dhcp server on a linux machine and give clients the router address (dhcp option 3) depending on the client's MAC address. I think dnsmasq can do that.

S
Sergey, 2014-02-11
@edinorog

With static suck chupachups =). And it's better to make it easier. 4G poke into Mikrotik. On Mirkotik we raise DHCP. We switch all the legs to the dynamics. We divide the traffic on the Mikrotik itself. And everything plows =)

A
Alexander Karabanov, 2014-02-11
@karabanov

Google on the topic "routing and two providers" (there are a number of articles on this topic on Habré, although there are mostly about GNU / Linux and the iproute2 package, but the general meaning is clear).
If it is possible to plug the modem directly into the Mikrotik, then the task is completely simplified, since you only need to configure one device.

K
kodi, 2014-02-12
@kodi

@kostett
4g and adsl on different subnets behind the router. and then resolve the routing on the main gateway.

T
throughtheether, 2014-02-14
@throughtheether

>Then I would be grateful for a manual on setting up static binding definitions
If you decide to try to set up specific arp entries, as I recommended, then you need to do the following:
1) ping 192.168.1.2 on one of the hosts (in order to update dynamic arp entries ).
2) look up the corresponding MAC address (in windows arp -a 192.168.1.2)
3) on each of the 'selected' hosts add a static arp entry (in windows arp -s 192.168.1.1 aa-bb-cc-dd-ee- ff, where aa-bb-cc-dd-ee-ff is the address from point 2)
4) you can delete the static entry arp -d 192.168.1.1
5) the static entry is lost upon reboot, you may need to write the command to autoload

N
ninja5plus, 2014-11-06
@ninja5plus

And if you try to mark connections by MAC addresses?
Something like this:

/ip firewall mangle add action=mark-connection chain=prerouting new-connection-mark=mac1_conn src-mac-address=00:01:29:60:36:E7
/ip firewall mangle add action=mark-routing chain=prerouting connection-mark=mac1_conn new-routing-mark=mac1_r

/ip route add distance=1 gateway=192.168.1.2 routing-mark=mac1_r
where
src-mac-address - source mac-address
mark-connection - marking all connections that match the rule;
mark-routing - the type of marking used for the routing policy;
gateway =192.168.1.2 - Linux gateway

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question