In article , wrote: :I'm pretty new to configuring the PIX, but I have a slight problem that :maybe someone knows the answer to. One of the sites I'm working on has :a mailserver behind a PIX, but a standard static (inside,outside) :command cannot fix the problem. The problem is that incoming mail :first goes to one server, and THAT server forwards the mail to the :mailserver. Thus, I need a way to make the mail go to the inside IP, :but then exit using the same IP it came in, even though it's a differen :inside machine. Anyone have any clues? I've been reading up and see :some possibilities, but I'd like to see if anyone's dealth with a :similar issue.
The key to this is to recognize that the incoming email is always going to inside port 25, but the outgoing email is going to -outside- port 25, with some random high numbered port as the inside port.
So, you configure something like,
static (inside,outside) tcp PUBLICIP smtp FILTERSERVERIP smtp netmask
255.255.255.255 nat (inside) 2 MAILSERVERIP global (outside) 2 PUBLICIP
The static PAT (port address translation) takes precidence over the nat, so the incoming smtp will go to the filter server. The outgoing smtp will not have source port 25, so the static will not apply, and the nat will take over.
Note that the following will NOT work:
static (inside,outside) tcp PUBLICIP smtp FILTERSERVERIP smtp netmask
255.255.255.255 static (inside,outside) PUBLICIP MAILSERVERIP netmask 255.255.255.255
You cannot use that because a plain static takes precidence over a static with ports.
In PIX 6.3(2) or later [I think it is] you have an additional option, which is to use policy static. That's a static with an access-list that controls the circumstances under which the static is used. policy statics are a bit wonky -- you have to know undocumented details about which part of the access list is being paid attention to.