Thanks to anx feedback I found the solution.
The solution scheme
According to Postfix official docs about rewriting, the master process tree is like the following:
smtp --+--> cleanup --> rewrite --> [queue]
pickup --/
So I ended up creating a pipeline specific for localhost, like the following:
192.168.1.2:smtp --+--> cleanup --> rewrite ------------+--> [queue]
127.0.0.1:smtp --+--> cleanup_local --> rewrite_local --/
pickup -----------/
The configuration
This is the main.cf
configuration, which represent external IP configurations:
# configure the global desiderata
# Basic conf (for display purpose, use your own configuration)
# myhostname = hostname.example.test
# mydomain = example.test
# mydestination =
# mynetworks = 127.0.0.0/8,1.2.3.4/32
# Rewrite options
myorigin = $mydomain
append_at_myorigin = yes
local_header_rewrite_clients = permit_mynetworks
sender_canonical_classes = envelope_sender, header_sender
sender_canonical_maps = hash:/etc/postfix/sender_canonical
recipient_canonical_classes = envelope_recipient, header_recipient
recipient_canonical_maps = hash:/etc/postfix/recipient_canonical
# restrictions (redacted for readability)
smtpd_sender_restrictions = permit_mynetworks, reject_non_fqdn_sender, permit
This is the master.cf
configuration, with the customized pipeline:
# add this for local smtp service
127.0.0.1:smtp inet n - n - - smtpd
-o myorigin=$myhostname
-o cleanup_service_name=cleanup_local
-o inet_interfaces=loopback-only
-o local_header_rewrite_clients=permit_inet_interfaces
# edit pickup sevice with this two options
pickup unix n - n 60 1 pickup
-o myorigin=$myhostname
-o cleanup_service_name=cleanup_local
# add this for local email cleanup
cleanup_local unix n - n - 0 cleanup
-o myorigin=$myhostname
-o rewrite_service_name=rewrite_local
# add this for local email basic rewrite
rewrite_local unix - - n - - trivial-rewrite
-o myorigin=$myhostname
-o local_header_rewrite_clients=permit_inet_interfaces
# Then for each public IP assigned to the machine, add smtp service like this
192.168.3.85:smtp inet n - n - - smtpd
# and remove default service smtp inet [..cut..] smtpd