Answer the question
In order to leave comments, you need to log in
How to set up Masquerading in Mikrotik?
Good afternoon. Such a question - there are 5 who look at the world and 50 clients. It was planned so that 5 addresses would be evenly distributed among clients. The original attempt was to do something like this:
ip address add address=192.168.8.2 interface=ether1
ip address add address=192.168.8.3 interface=ether1
ip address add address=192.168.8.4 interface=ether1
ip address add address=192.168.8.5 interface=ether1
ip firewall nat add action=masquerade src-address=172.19.123.0/24 out-interface=eth1 chain=srcnat
Answer the question
In order to leave comments, you need to log in
It is necessary to use not a masquerade, but the snat rule.
The task can be divided into three stages .
Stage 1, divide into five groups established connections according to the criterion source address (You have only four external addresses, so the example will be for four, also the network 172.19.123.0/24 is not can be private, but the owner is the master and in the example left as indicated by you)
Stage 2 Mark the connection from each group with the appropriate label
Stage 3 pass the group traffic through the corresponding source nat rules according to the assigned label
/ip firewall mangle
add action=mark-connection chain=prerouting new-connection-mark=1st_conn \
per-connection-classifier=src-address:4/0 src-address=172.19.123.0/24
add action=mark-connection chain=prerouting new-connection-mark=2st_conn \
per-connection-classifier=src-address:4/1 src-address=172.19.123.0/24
add action=mark-connection chain=prerouting new- connection-mark=3st_conn \
per-connection-classifier=src-address:4/2 src-address=172.19.123.0/24
add action=mark-connection chain=prerouting new-connection-mark=4st_conn \
per-connection-classifier =src-address:4/3 src-address=172.19.123.0/24
/ip firewall nat
add action=src-nat chain=srcnat connection-mark=1st_conn out-interface=ether1 \
to-addresses=192.168.8.2
add action =src-nat chain=srcnat connection-mark=2st_conn out-interface=ether1 \
to-addresses=192.168.8.3
add action=src-nat chain=srcnat connection-mark=3st_conn out-interface=ether1 \
to-addresses=192.168.8.4
add action=src-nat chain=srcnat connection-mark=5st_conn out-interface=ether1 \
to-addresses =192.168.8.5
there must be no other masquerade rules higher than these
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question