LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   simple bind and redirect example, please (https://www.linuxquestions.org/questions/linux-networking-3/simple-bind-and-redirect-example-please-85594/)

benazonafunk 08-25-2003 02:59 PM

simple bind and redirect example, please
 
I have a win2k running exchange and iis, i need to redirect ports for smtp, pop3 and http to my win2k server. i have 1 public ip address, and so everyone including the 2k server is NATing through the RH9 box. I've never done this before, and a simple example would be useful. Thank you in advance.

Blindsight 08-25-2003 06:28 PM

assuming 2.4.x kernel: read this, http://www.tldp.org/HOWTO/IP-Masquer...4.X-PREROUTING

Robert0380 08-26-2003 03:30 AM

sparing u the security speech:

1. enable ip forwarding

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

2. make a NAT/MASQ rule

#iptables -A POSTROUTING -t nat -s $LAN -j MASQUERADE (for a dynamic ip)
OR
#iptables -A POSTROUTING -t nat -s $LAN -j SNAT --to $NET_IP (if u have a static ip to internet)

where:

LAN=192.168.0.0/24 (or similar)
NET_IP=1.2.3.4 (your real IP to masquerade as)


with no other firewall rules setup, that should get you started with NATing


for redirecting ports 25 and 80 (aka port forwarding):

#iptables -A PREROUTING -t nat -p tcp --dport 25 -j DNAT --to $WINBLOWS_SERVER

#iptables -A PREROUTING -t nat -p tcp --dport 80 -j DNAT --to $WINBLOWS_SERVER

and the same for the pop3 port

where:
WINBLOWS_SERVER=192.168.0.200 (or whatever the internal IP of it is).

Blindsight 08-26-2003 07:43 AM

I strongly suggest you read the article. It'll teach you how it works. If you just paste Robert's commands, you aren't learning anything. Linux is all about learning ;) Have fun.


All times are GMT -5. The time now is 04:24 PM.