Hello all, I am a small ISP that is doing NAT to my customers due to limited number of IPv4 that I have. I’ve been using the standard default masquerade rule up to now, but I want to use port-address mapping so that if I have customers that perform illegal activities (pirated movies/software/etc) and I receive a complaint email, i can use the originating port number to identify the offending party.
I made a rule that applies to my office subnet, but using the lookup tool at IPchicken.com, it still shows all sorts of random ports. Can a src-nat and masquerade rule not co-exist? I didn’t want to cause interruption to my customers while I experiment with this.
FWIW, the src-nat rule for my subnet comes before the masquerade rule in rule order.
Masquerade is nothing more than src-nat with automatic selection of the new address based on the outgoing interface.
It can co-exist, of course you need to have the proper selectors in each rule to select it.
No it is not OK because your second rule has not selector so it always matches.
A match with action src-nat or masquerade does NOT end rule processing like an accept or drop in the filter rule table does.
You can insert rules with action accept between the src-nat/masquerade rules to make sure only a single one is applied.