Difference between revisions of "Firewall"
m (damn, how many f**** wikipedia references might still be left???) |
|||
Line 4: | Line 4: | ||
''iptables -A INPUT -p udp --dport XX+3 -j ACCEPT''<br> | ''iptables -A INPUT -p udp --dport XX+3 -j ACCEPT''<br> | ||
''iptables -A INPUT -p udp --dport YY -j ACCEPT''<br> | ''iptables -A INPUT -p udp --dport YY -j ACCEPT''<br> | ||
+ | |||
+ | |||
+ | If you want to setup [[aMule]] behing a NAT gateway, you should add these lines to your iptables configuration script, on the gateway : | ||
+ | |||
+ | ''EXTIF'' is your external interface | ||
+ | |||
+ | ''EMULEPORT=5595''<br> | ||
+ | ''EMULEUDP=5595''<br> | ||
+ | ''EMULEUDP2=`expr $EMULEPORT + 3`''<br> | ||
+ | ''EMULEHOST=10.0.0.2''<br> | ||
+ | ''iptables -t nat -A PREROUTING -i $EXTIF -p tcp --destination-port $EMULEPORT -j DNAT --to-destination $EMULEHOST:$EMULEPORT''<br> | ||
+ | ''iptables -t nat -A PREROUTING -i $EXTIF -p udp --destination-port $EMULEUDP -j DNAT --to-destination $EMULEHOST:$EMULEUDP''<br> | ||
+ | ''iptables -t nat -A PREROUTING -i $EXTIF -p udp --destination-port $EMULEUDP2 -j DNAT --to-destination $EMULEHOST:$EMULEUDP2''<br> |
Revision as of 06:48, 2 August 2004
If you set TCP port in aMule to XX and UDP port to YY then you have to set your firewall like this:
iptables -A INPUT -p tcp --dport XX -j ACCEPT
iptables -A INPUT -p udp --dport XX+3 -j ACCEPT
iptables -A INPUT -p udp --dport YY -j ACCEPT
If you want to setup aMule behing a NAT gateway, you should add these lines to your iptables configuration script, on the gateway :
EXTIF is your external interface
EMULEPORT=5595
EMULEUDP=5595
EMULEUDP2=`expr $EMULEPORT + 3`
EMULEHOST=10.0.0.2
iptables -t nat -A PREROUTING -i $EXTIF -p tcp --destination-port $EMULEPORT -j DNAT --to-destination $EMULEHOST:$EMULEPORT
iptables -t nat -A PREROUTING -i $EXTIF -p udp --destination-port $EMULEUDP -j DNAT --to-destination $EMULEHOST:$EMULEUDP
iptables -t nat -A PREROUTING -i $EXTIF -p udp --destination-port $EMULEUDP2 -j DNAT --to-destination $EMULEHOST:$EMULEUDP2