Koozali.org: home of the SME Server

opening multiple ports

wouterhoek

opening multiple ports
« on: January 31, 2005, 03:35:40 PM »
I'm trying to open multiple ports for torrentflux 2.0 beta 1.
I found a bash script:

#!/bin/bash
#bittracker portforwarding
BTFORWARDADDR=81.206.134.192
BTPORTS="6890 6891 6892 6893 6894 6895 6896 6897 6898 6899"
for pt in $BTPORTS; do
  /sbin/iptables -t nat -A PREROUTING -i ppp0 -p tcp --dport $pt -j DNAT --to-destination $BTFORWARDADDR:$pt
  /sbin/iptables -A FORWARD -s $BTFORWARDADDR -p tcp --dport $pt -j ACCEPT
done

And I opened a portrange 49160-49300 but in my logfile there is still:

Jan 31 15:58:27 server kernel: denylog:IN=eth1 OUT= MAC=00:11:11:65:00:8f:00:90:d0:c3:2a:03:08:00 SRC=65.93.53.210 DST=81.206.134.192 LEN=48 TOS=0x00 PREC=0x00 TTL=114 ID=12027 DF PROTO=TCP SPT=4687 DPT=49190 WINDOW=16384 RES=0x00 SYN URGP=0
Jan 31 15:58:28 server kernel: denylog:IN=eth1 OUT= MAC=00:11:11:65:00:8f:00:90:d0:c3:2a:03:08:00 SRC=62.194.25.213 DST=81.206.134.192 LEN=48 TOS=0x00 PREC=0x00 TTL=115 ID=51574 DF PROTO=TCP SPT=3479 DPT=49298 WINDOW=65535 RES=0x00 SYN URGP=0
Jan 31 15:58:29 server kernel: denylog:IN=eth1 OUT= MAC=00:11:11:65:00:8f:00:90:d0:c3:2a:03:08:00 SRC=81.6.227.164 DST=81.206.134.192 LEN=48 TOS=0x00 PREC=0x00 TTL=119 ID=34952 DF PROTO=TCP SPT=2693 DPT=49194 WINDOW=64240 RES=0x00 SYN URGP=0
Jan 31 15:58:29 server kernel: denylog:IN=eth1 OUT= MAC=00:11:11:65:00:8f:00:90:d0:c3:2a:03:08:00 SRC=220.137.196.57 DST=81.206.134.192 LEN=64 TOS=0x00 PREC=0x00 TTL=109 ID=2121 DF PROTO=TCP SPT=1369 DPT=49172 WINDOW=65535 RES=0x00 SYN URGP=0
Jan 31 15:58:34 server kernel: denylog:IN=eth1 OUT= MAC=00:11:11:65:00:8f:00:90:d0:c3:2a:03:08:00 SRC=62.194.25.213 DST=81.206.134.192 LEN=48 TOS=0x00 PREC=0x00 TTL=115 ID=51938 DF PROTO=TCP SPT=3479 DPT=49298 WINDOW=65535 RES=0x00 SYN URGP=0
Jan 31 15:58:35 server kernel: denylog:IN=eth1 OUT= MAC=00:11:11:65:00:8f:00:90:d0:c3:2a:03:08:00 SRC=81.6.227.164 DST=81.206.134.192 LEN=48 TOS=0x00 PREC=0x00 TTL=119 ID=35267 DF PROTO=TCP SPT=2693 DPT=49194 WINDOW=64240 RES=0x00 SYN URGP=0
Jan 31 15:58:35 server kernel: denylog:IN=eth1 OUT= MAC=00:11:11:65:00:8f:00:90:d0:c3:2a:03:08:00 SRC=220.137.196.57 DST=81.206.134.192 LEN=64 TOS=0x00 PREC=0x00 TTL=109 ID=2357 DF PROTO=TCP SPT=1369 DPT=49172 WINDOW=65535 RES=0x00 SYN URGP=0
Jan 31 15:58:35 server kernel: denylog:IN=eth1 OUT= MAC=00:11:11:65:00:8f:00:90:d0:c3:2a:03:08:00 SRC=81.227.17.172 DST=81.206.134.192 LEN=48 TOS=0x00 PREC=0x00 TTL=112 ID=39539 PROTO=TCP SPT=3318 DPT=49194 WINDOW=64240 RES=0x00 SYN URGP=0
Jan 31 15:58:36 server kernel: denylog:IN=eth1 OUT= MAC=00:11:11:65:00:8f:00:90:d0:c3:2a:03:08:00 SRC=83.135.72.194 DST=81.206.134.192 LEN=48 TOS=0x00 PREC=0x00 TTL=117 ID=56374 DF PROTO=TCP SPT=3731 DPT=49172 WINDOW=65535 RES=0x00 SYN URGP=0
Jan 31 15:58:36 server kernel: denylog:IN=eth1 OUT= MAC=00:11:11:65:00:8f:00:90:d0:c3:2a:03:08:00 SRC=64.184.50.144 DST=81.206.134.192 LEN=48 TOS=0x00 PREC=0x00 TTL=109 ID=61017 PROTO=TCP SPT=4798 DPT=49194 WINDOW=8192 RES=0x00 SYN URGP=0
Jan 31 15:58:38 server kernel: denylog:IN=eth1 OUT= MAC=00:11:11:65:00:8f:00:90:d0:c3:2a:03:08:00 SRC=81.227.17.172 DST=81.206.134.192 LEN=48 TOS=0x00 PREC=0x00 TTL=112 ID=39627 PROTO=TCP SPT=3318 DPT=49194 WINDOW=64240 RES=0x00 SYN URGP=0
Jan 31 15:58:39 server kernel: denylog:IN=eth1 OUT= MAC=00:11:11:65:00:8f:00:90:d0:c3:2a:03:08:00 SRC=83.135.72.194 DST=81.206.134.192 LEN=48 TOS=0x00 PREC=0x00 TTL=117 ID=56552 DF PROTO=TCP SPT=3731 DPT=49172 WINDOW=65535 RES=0x00 SYN URGP=0
Jan 31 15:58:39 server kernel: denylog:IN=eth1 OUT= MAC=00:11:11:65:00:8f:00:90:d0:c3:2a:03:08:00 SRC=64.184.50.144 DST=81.206.134.192 LEN=48 TOS=0x00 PREC=0x00 TTL=109 ID=61115 PROTO=TCP SPT=4798 DPT=49194 WINDOW=8192 RES=0x00 SYN URGP=0
 Refresh this logfile



P.S. SME 6.5 beta 1 (upgraded from 6.0) schirmms fetchmail is broken (it does work but the server-manager panel is broken. Also, spam assassin 3.02 isn't checking for spam anymore on the popped accounts of fetchmail.

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: opening multiple ports
« Reply #1 on: February 02, 2005, 07:32:06 PM »
Quote from: "wouterhoek"
I'm trying to open multiple ports for torrentflux 2.0 beta 1.


No, you're trying to *forward* multiple ports.

Quote

I found a bash script:

#!/bin/bash
#bittracker portforwarding
BTFORWARDADDR=81.206.134.192
BTPORTS="6890 6891 6892 6893 6894 6895 6896 6897 6898 6899"
for pt in $BTPORTS; do
  /sbin/iptables -t nat -A PREROUTING -i ppp0 -p tcp --dport $pt -j DNAT --to-destination $BTFORWARDADDR:$pt
  /sbin/iptables -A FORWARD -s $BTFORWARDADDR -p tcp --dport $pt -j ACCEPT
done

And I opened a portrange 49160-49300 but in my logfile there is still:

Jan 31 15:58:27 server kernel: denylog:IN=eth1 OUT= MAC=00:11:11:65:00:8f:00:90:d0:c3:2a:03:08:00 SRC=65.93.53.210 DST=81.206.134.192 LEN=48 TOS=0x00 PREC=0x00 TTL=114 ID=12027 DF PROTO=TCP SPT=4687 DPT=49190 WINDOW=16384 RES=0x00 SYN URGP=0


Your problem is that your external interface is eth1, but the script is designed for a DSP connection (interface ppp0).

Just use the port forwarding panel - it will choose the connect interface name.

wouterhoek

opening multiple ports
« Reply #2 on: February 04, 2005, 01:54:21 AM »
:-o You are right I see it now too ppp0

All others, Charlie's suggestion works fine and easy.