Hello,
I have my network architecture each device that has a local @IP connects to the internet with a public @IP ie
PC1: @local: 192.168.1.2 => 172.16.128.2
PC2: @local: 192.168.1.3 => 172.16.128.3
@ public: 172.16.128.0/24
@ local: 192.168.1.0/24
public gateway: 172.16.128.1
local gateway: 192.168.1.1
and that the ether1 interface 192.168.254 and the other ether2 interface takes 172.16.128.254
then in the configuration of my router I did the NAT static but the problem is that all the equipments take like @public 172.16.128.254 (ether2)
this is my config:
Then it could possibly break connectivity for 192.168.1.2 and 192.168.1.3, if there’s some problem with 172.16.128.2 and 172.16.128.3. But for all other sources, those two rules won’t touch their packets and only the masquerade rule will be used as before.
If all public addresses are in same /24, you also need to add the new ones to router, otherwise the ISP’s gateway can’t reach them. And then also change the masquerade rule to:
Thank you for your quick rep;
I deleted all the NAT rules and i repeated them by the order like you said but nothing to change (without connectivity)
the public@ is on /26 and the local@ is on /24
In that case, try a better description of public addresses.
You wrote that the main one is 172.16.128.254/24 (it’s not public, but it’s not the important part). But you also wrote that others are 172.16.128.2-3, which would put them in same /24 subnet. Now if you say that .254 is in /26, then .2-3 would be in different subnet and even .1 would not work as gateway, because that’s not in the same /26 either. And on second look, you have one gateway in description and another in config, which is in completely different subnet too. And both routes are strange.
You don’t need to share your real public addresses, write them as x.x.128.254/26, or use 172.16 prefix as you did, but keep the right part (numbers and mask) unchanged.
Also, are these three srcnat rules the only rules in srcnat chain, or are there also others?
Hello,
Yes propably I have not described well to you
1- it just exists that its 3 rules of NAT there is no other
2- Yes, you are right for public IP addresses because I was not clear to detail the information, so
Local network: 192.168.1.0/24
Public network: 172.16.128.0/26
Public Gateway: 172.16.128.1
ether1: 192.168.1.254
ether2: 172.16.128.62
this is my simulation
You have common condition (out-interface=ether2) in all rules, so the only difference is src-address=192.168.1.x. As long as the connection has source address 192.168.1.x, the matching rule will be used. And since action=src-nat ends the processing, source will be changed to 172.16.128.x. I don’t see how it could not work.
For a couple of seconds, set log=yes to all the rules in chain=srcnat using /ip firewall nat set [find chain=srcnat] log=yes. After that, stop logging them using /ip firewall nat set [find chain=srcnat] log=no. Then, print the logged src-nat events using /log print where topics~“firewall” and see what was actually happening there.