Hello,
This my script.
Introduction:
-------------
My Groupwise Server is 10.1.1.5
My Linux server (Knoppix) have 2 cards:
- local: 10.1.1.7
- Wan: 192.168.0.2
Install:
--------
with a root SSH session
- Create this script in /etc/init.d/nat.sh
- do a "chmod +x /etc/init.d/nat.sh"
- Create link with "ln -s /etc/init.d/nat.sh /etc/init.d/rcS.d/S90nat.sh"
- Start it "/etc/init.d/nat.sh"
My Script:
#################################
# Translation d'adresse
# ---------------------
# Load the NAT module (this pulls in all the others).
modprobe iptable_nat
# Turn on IP forwarding
echo 1 > /proc/sys/net/ipv4/ip_forward
echo 1 > /proc/sys/net/ipv4/conf/all/rp_filter
# In the NAT table (-t nat), Append a rule (-A) after routing (POSTROUTING)
# which says to MASQUERADE the connection (-j MASQUERADE).
# Nettoyage des chains existants
iptables -F
# Allows forwarding specifically to our LAN
iptables -t nat -A POSTROUTING -s 10.0.0.0/8 -j MASQUERADE
iptables -A FORWARD -s 10.0.0.0/8 -j ACCEPT
#Affichage des informations pour vérification
iptables -L
# Translation de Port
# -------------------
# Translation pour la messagerie
iptables -t nat -A PREROUTING -p tcp -d 192.168.0.2 --dport 25 -j DNAT --to-destination 10.1.1.5:25
iptables -t nat -A PREROUTING -p tcp -d 192.168.0.2 --dport 110 -j DNAT --to-destination 10.1.1.5:110
iptables -t nat -A PREROUTING -p udp -d 192.168.0.2 --dport 25 -j DNAT --to-destination 10.1.1.5:25
iptables -t nat -A PREROUTING -p udp -d 192.168.0.2 --dport 110 -j DNAT --to-destination 10.1.1.5:110
#########################
Custom it with your network adresses
Good luck.
Salokine - FRANCE.