# This is necessary for masquerading as far as i know
echo 1 > /proc/sys/net/ipv4/ip_forward

# Flush the default and nat table
iptables -F
iptables -t nat -F

# Now we accept everything
# Very weak but works for me
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT

# This is masquerading over the ppp0 device
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE

# icq forwarding
# This is the important line
# In the table nat in the chain PREROUTING we forward tcp packets incoming from ppp0 on port
# 24500 to 24505 to the ip desired (here: 192.168.0.10)
# These ports have to be the same as icq listens on
iptables -t nat -A PREROUTING -p tcp -i ppp0 --dport 24500:24505 -j DNAT --to-destination 192.168.0.10

Written by: Robert Kühne (aka Robbicool)
Some editing by: Johan Tuneld