Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
    
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 7:24

1 Answer 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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.