|
Sujet : port forwarding comment ca marche ? |
| helvetik |
si ça interresse quelqu'un, j'ai trouvé une solution :
Code :
- EXTIF="eth0"
- INTIF="eth2"
- EXTIP="`$IFCONFIG $EXTIF | $AWK /$EXTIF/'{next}//{split($0,a,":" );split(a[2],a," " );print a[1];exit}'`"
- INTNET="192.168.128.0/24"
- INTIP="192.168.128.205"
- UNIVERSE="0.0.0.0/0"
- SRV06="192.168.128.206"
- SRV06TSE="20603"
- INTTSE="3389"
- [...]
- $IPTABLES -t nat --append PREROUTING --in-interface $EXTIF --proto tcp --dport $SRV06TSE --jump DNAT --to $SRV06:$INTTSE
- $IPTABLES --append FORWARD --in-interface $EXTIF --out-interface $INTIF --source $UNIVERSE --destination $SRV06 --proto tcp --dport $INTTSE -m state --state ! INVALID --jump ACCEPT
- $IPTABLES --append FORWARD --in-interface $EXTIF --out-interface $INTIF --source $SRV06 --destination $UNIVERSE --proto tcp --dport $INTTSE -m state --state RELATED,ESTABLISHED --jump ACCEPT
- $IPTABLES --append FORWARD --in-interface $EXTIF --out-interface $INTIF --source $UNIVERSE --destination $SRV06 --proto tcp --dport $SRV06TSE -m state --state ! INVALID --jump ACCEPT
- $IPTABLES --append FORWARD --in-interface $EXTIF --out-interface $INTIF --source $SRV06 --destination $UNIVERSE --proto tcp --dport $SRV06TSE -m state --state RELATED,ESTABLISHED --jump ACCEPT
|
En fait, utiliser les options "parlés" (--help) lieu de leurs abréviations (-h) a aidé ma petite cervelle d'oiseau...
J'en ai profiter pour rajouter le suivi de connection avec conntrack... Je ne sais pas si c'est bien utile, d'ailleur, qu'en pensez-vous ??
a+ Hel |