Jo tinc algo aixi EXIF=eth0
# flush iptables -F || fail=1 iptables -X || fail=1 iptables -Z || fail=1 iptables -t nat -F || fail=1 ## default policy iptables -P INPUT ACCEPT || fail=1 iptables -P OUTPUT ACCEPT || fail=1 iptables -P FORWARD ACCEPT || fail=1 iptables -t nat -P PREROUTING ACCEPT || fail=1 iptables -t nat -P POSTROUTING ACCEPT || fail=1 # NAT iptables -t nat -A POSTROUTING -o $EXIF -j MASQUERADE || fail=1 # forward echo 1 > /proc/sys/net/ipv4/ip_forward || fail=1 # Redirections iptables -t nat -A PREROUTING -i $EXIF -p tcp --dport 1004 -j DNAT --to 10.0.0.70:5900 || fail=1 On Sat, Mar 20, 2010 at 7:29 PM, Utopic <uto...@ono.com> wrote: > > Jo tampoc entenc les iptables. La pregunta es la mateixa: com redirigir > ports > amb iptables? no me n'en surto. > > Tinc una màquina amb dues tarjes de xarxa, una connectada al cablemodem que > dona acces a internet, i l'altre connectada al switch intern. El NAT > funciona > sense problemes, però sóc incapaç de redirigir els ports, l'script és: > > -------------------- > #!/bin/sh > > echo 1 > /proc/sys/net/ipv4/ip_forward > > EXTIF=eth1 > INTIF=eth0 > IPTABLES=/sbin/iptables > > $IPTABLES -P INPUT ACCEPT > $IPTABLES -F INPUT > $IPTABLES -P OUTPUT ACCEPT > $IPTABLES -F OUTPUT > $IPTABLES -P FORWARD DROP > $IPTABLES -F FORWARD > $IPTABLES -t nat -F > $IPTABLES -X > $IPTABLES -Z > > $IPTABLES -A FORWARD -i $EXTIF -o $INTIF -m state --state > RELATED,ESTABLISHED > -j ACCEPT > $IPTABLES -A FORWARD -i $INTIF -o $EXTIF -j ACCEPT > > $IPTABLES -t nat -A POSTROUTING -o $EXTIF -j MASQUERADE > > exit 0 > -------------------- > > Després de buscar per internet i llegir varis tutorials, les regles per > redirig un port haurien de ser algo com: > > $IPTABLES -A PREROUTING -t nat -i $EXTIF -p tcp --dport 8080 -j DNAT --to > 192.168.1.10:80 > $IPTABLES -A FORWARD -p tcp -m state --state NEW --dport 80 -i $EXTIF -j > ACCEPT > > Pero no em funcionen... n'he provat d'altres sense sort. Com haurien de > ser? > > Gràcies, > > > -- > Utopic > "You have been in Afghanistan, I perceive." > -- Sir Arthur Conan Doyle, "A Study in Scarlet" > > > -- > To UNSUBSCRIBE, email to debian-user-catalan-requ...@lists.debian.org > with a subject of "unsubscribe". Trouble? Contact > listmas...@lists.debian.org > Archive: http://lists.debian.org/201003201929.17178.uto...@ono.com > > -- Marc