Community discussions

MikroTik App
 
hhoebel
just joined
Topic Author
Posts: 2
Joined: Sat Feb 04, 2023 7:28 pm

NAT betwen VLANs

Sat Feb 04, 2023 7:43 pm

Hi,
i've setup a local network with several VLANs which use NAT to the WAN-port.
I'm owning a Network-Printer, which is actually in my VLAN 1 with an IP 192.168.0.0/24
My business PC is connected to a VLAN with ID 30 and IP 192.168.178.0.0/24
Now i want to access the network-printer with IP 192.168.0.23 from the VLAN 30 from the business PC.
Problem: i can not simply change the used IPs as the business PC is connected via VPN to the company using 192.168.0.0 as well (due to this the network-printer is not available as soon as the VPN is started). But: 192.168.178.0/24 is NOT routed over VPN. VPN is managed by the company and i can't change the used address-ranges.
Similar with the already used 192.168.0.0/24 at home in VLAN1.
My idea was to use a reserved address in 192.168.178.0/24 (e.g. 192.168.178.254) and NAT it to 192.168.0.23 (network printer).
I've tried first for getting the webpage of the printer:
add action=src-nat chain=srcnat dst-address=192.168.178.254 protocol=tcp src-address=192.168.178.0/24 src-port=80 to-addresses=192.168.0.23 to-ports=80

Any ideas for a working NAT-rule? This one doesn't work :-(
Best regards
Heiko
 
hhoebel
just joined
Topic Author
Posts: 2
Joined: Sat Feb 04, 2023 7:28 pm

Re: NAT betwen VLANs

Sun Feb 05, 2023 4:43 pm

I've found a solution:

add action=netmap chain=srcnat comment="NAT Epson-Printer to VLAN 30" dst-address=192.168.0.23 out-interface=vlan1 to-addresses=192.168.179.1
add action=netmap chain=dstnat dst-address=192.168.179.1 in-interface=vlan30 src-address=192.168.178.0/24 to-addresses=192.168.0.23

192.168.0.23 is the IP of the network printer, 192.168.179.1 is a free address in the address space used for the vlan30 (192.168.178.0/23).

Who is online

Users browsing this forum: ameliask, miks and 67 guests