I want to create to subnets to one NAT gateway on a RB450G. I want to set subnet 172.26.10.0/24 on port ether2-local and on port ether3-local 10.0.0.1/24. On port ether1-gateway I have to set manual IP number 192.168.178.205 subnet 255.255.255.0 and gateway 192.168.178.1. DNS and DHCP is disabled on both subnets.
To create this I have done the following:
ip firewall mangle add chain=prerouting src-address=172.26.10.0/24 action=mark-routing new-routing-mark=gw1
ip firewall mangle add chain=prerouting src-address=10.0.0.0/24 action=mark-routing new-routing-mark= gw1
ip route add gateway=192.168.178.205 routing-mark=gw1.
But this doesn’t work. I can’t see/ping anything through the gateway. Has anyone any idea how I can do this?
I’m not sure I understand what you’re trying to do.
ether1 will be your WAN uplink, and ether2 and ether3 will be two LAN networks, but with different IP addressing?
If yes, you don’t need any mangle rules. Just set a default route out via 192.168.178.1, make sure the master-port on ether2 and ether3 is set to ‘none’, add IP addresses to ether2 and ether3, and make a NAT rule out ether1. That’s it.
[admin@MikroTik] > ip route print
Flags: X - disabled, A - active, D - dynamic,
C - connect, S - static, r - rip, b - bgp, o - ospf, m - mme,
B - blackhole, U - unreachable, P - prohibit
# DST-ADDRESS PREF-SRC GATEWAY DISTANCE
0 A S 0.0.0.0/0 192.168.178.1 1
1 ADC 10.0.0.0/24 10.0.0.0 ether3-local 0
2 ADC 172.26.10.0/24 172.26.10.0 ether2-local 0
3 ADC 192.168.178.0/24 192.168.178.205 ether1-gateway 0
[admin@MikroTik] >
It was actually the “/ip route” entries that gave it away. If you look carefully, you will notice the “PREF-SRC” entries for those networks are invalid. That is what made me look carefully at “/ip address”.