Share 1 Gateway for 2 subnet

Hello to all,

I just started to use the products and Mikrotik would like to have some help on the following configuration.
I have a Gateway 192.168.1.1 (A) for internet and type 2 networks 172.16.1.0/16 (B) and 192.168.2.0/24 (C).
I want to share the internet access(A) to networks B and C, using a RB433.
This is my configuration:
/ip address
add address = 192.168.1.254/24 interface = Ether1
add address = 192.168.2.1/24 interface = ether2
add address = 172.16.0.0/16 interface = Ether3
/ip route
add dst-address = 0.0.0.0 / 0 gateway = 192.168.1.1
/ip firewall nat
add chain = srcnat out-interface = Ether1-gateway action = masquerade

Do you think this configuration is correct?

Thank you all for your attention.

Fabrix

Yes it will work.. You need DHCP setup as well as a decision as to whether you want routing between your local subnets but yes it should work.

brother your setting concept is correct but if you are using terminal then verify your gateway interface name because in ip address interface name is ether1 but in nat rule at out-interface name is Ether1-gateway maybe you mentioned “-gateway” for explanation.



/ip firewall nat
add chain = srcnat out-interface = Ether1-gateway action = masquerade

Do you think this configuration is correct?

Thank you all for your attention.

Fabrix

I am grateful for having responded.
Yes, it works.
I would like to create routes to allow operation between subnets (A) and (B).
Can someone help me?
Thanks to everyone

For kashifmac2005
Yes,is a typing error.

Thank you

By default Mikrotik allows communication between subnets. This is on Layer 3.

Layer 2 will not work between the subnets. (Anything that requires a broadcast)

You can restrict Layer 3 as well by adding a firewall filter rule Chain Forward Action Drop and specify source and destination addresses.

you have a typo, it should be 172.16.0.1/16

Yes