Re: OT - IP Tables - forwarding to localhost

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Mon, Jun 18, 2007 at 11:46:42AM +0100, first last wrote:
> Hi,
> 
> I am trying to set up a firewall rule so calls to old_mailserver:25 get
> redirected to localhost:25. I have seen quite a few rules and none seem
> to work.
> 
> I have tried with the firewall enabled (configured to allow smtp) and
> disabled, but it doesn't seem to make a difference.
> 
> One of the commands I have been using is:
> /sbin/iptables -t nat -I PREROUTING -p tcp -d old_mailserver_ip/32
> --dport 25 -j REDIRECT --to 127.0.0.1:25

Try this:
iptables -t nat -I PREROUTING -p tcp -d old_mail_server_ip --dport 25 \
  -j REDIRECT
iptables -t nat -I OUTPUT -p tcp -d old_mail_server_ip --dport 25 \
  -j REDIRECT
 
> Am I missing anything?

Locally generated packets go through OUTPUT, but not PREROUTING, IIRC.

-- 
lfr
0/0

Attachment: pgpUj5czqOtC8.pgp
Description: PGP signature

_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux