{
    $OUT = "\n";

    # Create new chain to manage SMTPProxy stuff
    # Note: We send all traffic destined to port 25, regardless of
    # where it's from, since the filter table will worry about source.

    $OUT .= "    /sbin/iptables --table nat --new-chain SMTPProxy\n";
    $OUT .= "    /sbin/iptables --table nat --append PREROUTING\\\n";
    $OUT .= "\t-p tcp --dport 25 -j SMTPProxy\n";

    # Accept any accesses to the local IPs directly

    $OUT .= "    /sbin/iptables --table nat --append SMTPProxy \\\n";
    $OUT .= "\t--destination 127.0.0.1 --jump ACCEPT\n";
    $OUT .= "    /sbin/iptables --table nat --append SMTPProxy \\\n";
    $OUT .= "\t--destination $LocalIP --jump ACCEPT\n";

    if (defined $ExternalIP)
    {
        # Accept any accesses to the ExternalIP directly
        $OUT .= "    /sbin/iptables --table nat --append SMTPProxy \\\n";
        $OUT .= "\t--destination \$OUTERNET --jump ACCEPT\n";
    }

    $OUT .= "    /sbin/iptables --table nat --append SMTPProxy\\\n";
    $OUT .= "\t-p TCP -j DNAT --to $LocalIP:25\n";
}
