-1

ive local server with squid to manage my lan , it got 2 NICs and my mail server its outside the lan what i need here when users ty to connect and send email through NIC-1 its should fwd request to NIC2 which is connected to internet ( port 25,110 ) any tips to fwd by iptables regards

user47556
  • 459
  • 1
  • 4
  • 11
  • please update your post with IP address information and a more detailed description of what you want to accomplish. In its current state it is too vague to be answered meaningfully. – the-wabbit Oct 26 '11 at 07:24

1 Answers1

1

Assuming that eth0 is the internal interface and eth1 is the external interface.

Enable IP forwarding:

echo 1 > /proc/sys/net/ipv4/ip_forward

and try something like this:

iptables -t nat -A PREROUTING -p tcp -i eth0 --dport 25 -j DNAT --to-destination <eth1_IP>:25
iptables -A FORWARD -i eth0 -p tcp --dport 25 -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT

Do the same for port 110.

quanta
  • 50,327
  • 19
  • 152
  • 213