Skip to contentSkip to conversation

Firewall blocking Java applet?

DISCUSSION Jong Hian Zin 2 participants 4 messages Jun 23, 2005 – Jun 28, 2005

lore
Share & tools
lore
#0 lore raw

I have a Linksys WRT54G running OpenWRT, the WAN port is connecting to an ADSL modem (PPPoE) and there are 2 PCs connecting to the WRT54G's LAN ports. I can surf the web from any of the PCs except doing bandwidth test using this website:

http://202.188.95.52:8080/speedometer/

The bandwidth test Java applet can be loaded, but unable to start the test. The following is my script:

#!/bin/sh
. /etc/functions.sh
export WAN=$(nvram get wan_ifname)
export LAN=$(nvram get lan_ifname)

## CLEAR TABLES
for T in filter nat mangle; do
iptables -t $T -F
iptables -t $T -X

done

iptables -N input_rule
iptables -N output_rule
iptables -N forwarding_rule

iptables -t nat -N prerouting_rule
iptables -t nat -N postrouting_rule

### Port forwarding

# iptables -t nat -A prerouting_rule -p tcp --dport 22 -j DNAT --to 
192.168.1.2 <http://192.168.1.2>
# iptables        -A forwarding_rule -p tcp --dport 22 -d 192.168.1.2
<http://192.168.1.2> -j ACCEPT

### INPUT
### (connections with the router as destination)

  # base case
  iptables -P INPUT DROP
  iptables -A INPUT -m state --state INVALID -j DROP
  iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
  # allow
  iptables -A INPUT -i \! $WAN -j ACCEPT        # allow from lan/wifi interfaces

iptables -A INPUT -p icmp -j ACCEPT # allow ICMP
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -A INPUT -p 47 -j ACCEPT # allow GRE
#

  # insert accept rule or to jump to new accept-check table here

#
iptables -A INPUT -j input_rule

  # reject (what to do with anything not allowed earlier)
  iptables -A INPUT -p tcp --syn --tcp-option \! 2 -j  DROP
  iptables -A INPUT -p tcp -j REJECT --reject-with tcp-reset
  iptables -A INPUT -j REJECT --reject-with icmp-port-unreachable

### OUTPUT
### (connections with the router as source)

  # base case
  iptables -P OUTPUT DROP
  iptables -A OUTPUT -m state --state INVALID -j DROP
  iptables -A OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
  # allow
  iptables -A OUTPUT -j ACCEPT          #allow everything out
  #
  # insert accept rule or to jump to new accept-check table here

#
iptables -A OUTPUT -j output_rule

  # reject (what to do with anything not allowed earlier)
  iptables -A OUTPUT -p tcp -j REJECT --reject-with tcp-reset
  iptables -A OUTPUT -j REJECT --reject-with icmp-port-unreachable

### FORWARDING
### (connections routed through the router)

  # base case
  iptables -P FORWARD DROP
  iptables -A FORWARD -m state --state INVALID -j DROP
  iptables -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT

iptables -A FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS
--clamp-mss-to-pmtu

  # allow
  iptables -A FORWARD -i br0 -o br0 -j ACCEPT
  iptables -A FORWARD -i $LAN -o $WAN -j ACCEPT
  #
  # insert accept rule or to jump to new accept-check table here

#
iptables -A FORWARD -j forwarding_rule

  # reject (what to do with anything not allowed earlier)
  # uses the default -P DROP

### MASQ
iptables -t nat -A PREROUTING -j prerouting_rule

iptables -t nat -A POSTROUTING -j postrouting_rule iptables -t nat -A POSTROUTING -o $WAN -j MASQUERADE

Any idea what is blocking the bandwidth test Java applet?

Thanks,

Signature · 1 line
Jong Hian Zin
#1 lore raw
Quoted 3 lines · Jong Hian Zin

http://202.188.95.52:8080/speedometer/

The bandwidth test Java applet can be loaded, but unable to start the

Does it work if not going through the OpenWRT?

Quoted 2 lines
  iptables -A INPUT -m state --state INVALID -j DROP
  iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT

You could consolidate these INPUT rules with the ones in FORWARD and OUTPUT. I use a chain named "State" which I call from INPUT and FORWARD. (I don't do OUTPUT filtering, seems pointless to me.)

Quoted 1 line
  iptables -A INPUT -p tcp --dport 22 -j ACCEPT

You're DNAT'ing your 22/tcp, so that would hit the FORWARD chain.

Quoted 1 line

iptables -A INPUT -j input_rule

These "*_rule" chains do not appear to be used for anything.

Quoted 1 line

Any idea what is blocking the bandwidth test Java applet?

Not from what you posted. iptables-save(8) would be easier to follow. But you can probably troubleshoot this on your own by putting in -j LOG rules for -s/-d 202.188.95.52 traffic. Try it and see what you get. Is the openwrt capable of normal logging? Or maybe to a remote syslog server?

Signature · 2 lines
    mail to this address is discarded unless "/dev/rob0"
    or "not-spam" is in Subject: header
#2 lore raw
Quoted 7 lines · On 6/23/05, /dev/rob0 <[email protected]> wrote:
Quoted 3 lines · Jong Hian Zin

http://202.188.95.52:8080/speedometer/

The bandwidth test Java applet can be loaded, but unable to start the

Does it work if not going through the OpenWRT?

Yes, it works if I connect the PC directly to the ADSL modem, using PPPoE.

Not from what you posted. iptables-save(8) would be easier to follow.

Quoted 6 lines

But you can probably troubleshoot this on your own by putting in -j LOG rules for -s/-d 202.188.95.52 <http://202.188.95.52> traffic. Try it and see what you get. Is
the openwrt capable of normal logging? Or maybe to a remote syslog server?

I will try iptables-save and logging.

Signature · 1 line
Jong Hian Zin
#3 lore raw

I have managed to log the traffic right after I clicked on the Start button:

root@OpenWrt:~# iptables -I FORWARD 1 -s 0/0 -d 0/0 -j LOG
root@OpenWrt:~# logread -f
Jun 27 22:08:49 (none) kern.warn kernel: IN=br0 OUT=ppp0 PHYSIN=vlan0 SRC=
192.168.1.2 <http://192.168.1.2> DST=219.93.175.234
<http://219.93.175.234>LEN=78 TOS=0x00 PREC=0x00 TTL=127 ID=3703
PROTO=UDP SPT=137 DPT=137 LEN=58
Jun 27 22:08:51 (none) kern.warn kernel: IN=br0 OUT=ppp0 PHYSIN=vlan0 SRC=
192.168.1.2 <http://192.168.1.2> DST=219.93.175.234
<http://219.93.175.234>LEN=78 TOS=0x00 PREC=0x00 TTL=127 ID=3705
PROTO=UDP SPT=137 DPT=137 LEN=58
Jun 27 22:08:52 (none) kern.warn kernel: IN=br0 OUT=ppp0 PHYSIN=vlan0 SRC=
192.168.1.2 <http://192.168.1.2> DST=219.93.175.234
<http://219.93.175.234>LEN=78 TOS=0x00 PREC=0x00 TTL=127 ID=3707
PROTO=UDP SPT=137 DPT=137 LEN=58
Jun 27 22:08:54 (none) kern.warn kernel: IN=br0 OUT=ppp0 PHYSIN=vlan0 SRC=
192.168.1.2 <http://192.168.1.2> DST=219.93.175.234
<http://219.93.175.234>LEN=48 TOS=0x00 PREC=0x00 TTL=127 ID=3709 DF
PROTO=TCP SPT=4847 DPT=21
WINDOW=64240 RES=0x00 SYN URGP=0
Jun 27 22:08:54 (none) kern.warn kernel: IN=ppp0 OUT=br0 PHYSOUT=vlan0 SRC=
219.93.175.234 <http://219.93.175.234> DST=192.168.1.2
<http://192.168.1.2>LEN=48 TOS=0x00 PREC=0x00 TTL=122 ID=10970 DF
PROTO=TCP SPT=21 DPT=4847
WINDOW=65535 RES=0x00 ACK SYN URGP=0
Jun 27 22:08:54 (none) kern.warn kernel: IN=br0 OUT=ppp0 PHYSIN=vlan0 SRC=
192.168.1.2 <http://192.168.1.2> DST=219.93.175.234
<http://219.93.175.234>LEN=40 TOS=0x00 PREC=0x00 TTL=127 ID=3710 DF
PROTO=TCP SPT=4847 DPT=21
WINDOW=64240 RES=0x00 ACK URGP=0
Jun 27 22:08:54 (none) kern.warn kernel: IN=ppp0 OUT=br0 PHYSOUT=vlan0 SRC=
219.93.175.234 <http://219.93.175.234> DST=192.168.1.2
<http://192.168.1.2>LEN=94 TOS=0x00 PREC=0x00 TTL=122 ID=10973 DF
PROTO=TCP SPT=21 DPT=4847
WINDOW=65535 RES=0x00 ACK PSH URGP=0
Jun 27 22:08:54 (none) kern.warn kernel: IN=br0 OUT=ppp0 PHYSIN=vlan0 SRC=
192.168.1.2 <http://192.168.1.2> DST=219.93.175.234
<http://219.93.175.234>LEN=51 TOS=0x00 PREC=0x00 TTL=127 ID=3711 DF
PROTO=TCP SPT=4847 DPT=21
WINDOW=64186 RES=0x00 ACK PSH URGP=0
Jun 27 22:08:54 (none) kern.warn kernel: IN=ppp0 OUT=br0 PHYSOUT=vlan0 SRC=
219.93.175.234 <http://219.93.175.234> DST=192.168.1.2
<http://192.168.1.2>LEN=73 TOS=0x00 PREC=0x00 TTL=122 ID=10977 DF
PROTO=TCP SPT=21 DPT=4847
WINDOW=65524 RES=0x00 ACK PSH URGP=0
Jun 27 22:08:54 (none) kern.warn kernel: IN=br0 OUT=ppp0 PHYSIN=vlan0 SRC=
192.168.1.2 <http://192.168.1.2> DST=219.93.175.234
<http://219.93.175.234>LEN=54 TOS=0x00 PREC=0x00 TTL=127 ID=3714 DF
PROTO=TCP SPT=4847 DPT=21
WINDOW=64153 RES=0x00 ACK PSH URGP=0
Jun 27 22:08:54 (none) kern.warn kernel: IN=ppp0 OUT=br0 PHYSOUT=vlan0 SRC=
219.93.175.234 <http://219.93.175.234> DST=192.168.1.2
<http://192.168.1.2>LEN=68 TOS=0x00 PREC=0x00 TTL=122 ID=10985 DF
PROTO=TCP SPT=21 DPT=4847
WINDOW=65510 RES=0x00 ACK PSH URGP=0
Jun 27 22:08:54 (none) kern.warn kernel: IN=br0 OUT=ppp0 PHYSIN=vlan0 SRC=
192.168.1.2 <http://192.168.1.2> DST=219.93.175.234
<http://219.93.175.234>LEN=40 TOS=0x00 PREC=0x00 TTL=127 ID=3716 DF
PROTO=TCP SPT=4847 DPT=21
WINDOW=64125 RES=0x00 ACK URGP=0
Jun 27 22:08:54 (none) kern.warn kernel: IN=ppp0 OUT=br0 PHYSOUT=vlan0 SRC=
219.93.175.234 <http://219.93.175.234> DST=192.168.1.2
<http://192.168.1.2>LEN=66 TOS=0x00 PREC=0x00 TTL=122 ID=11013 DF
PROTO=TCP SPT=21 DPT=4847
WINDOW=65510 RES=0x00 ACK PSH URGP=0
Jun 27 22:08:54 (none) kern.warn kernel: IN=br0 OUT=ppp0 PHYSIN=vlan0 SRC=
192.168.1.2 <http://192.168.1.2> DST=219.93.175.234
<http://219.93.175.234>LEN=48 TOS=0x00 PREC=0x00 TTL=127 ID=3717 DF
PROTO=TCP SPT=4847 DPT=21
WINDOW=64099 RES=0x00 ACK PSH URGP=0
Jun 27 22:08:54 (none) kern.warn kernel: IN=ppp0 OUT=br0 PHYSOUT=vlan0 SRC=
219.93.175.234 <http://219.93.175.234> DST=192.168.1.2
<http://192.168.1.2>LEN=60 TOS=0x00 PREC=0x00 TTL=122 ID=11022 DF
PROTO=TCP SPT=21 DPT=4847
WINDOW=65502 RES=0x00 ACK PSH URGP=0
Jun 27 22:08:54 (none) kern.warn kernel: IN=br0 OUT=ppp0 PHYSIN=vlan0 SRC=
192.168.1.2 <http://192.168.1.2> DST=219.93.175.234
<http://219.93.175.234>LEN=46 TOS=0x00 PREC=0x00 TTL=127 ID=3718 DF
PROTO=TCP SPT=4847 DPT=21
WINDOW=64079 RES=0x00 ACK PSH URGP=0
Jun 27 22:08:54 (none) kern.warn kernel: IN=ppp0 OUT=br0 PHYSOUT=vlan0 SRC=
219.93.175.234 <http://219.93.175.234> DST=192.168.1.2
<http://192.168.1.2>LEN=92 TOS=0x00 PREC=0x00 TTL=122 ID=11029 DF
PROTO=TCP SPT=21 DPT=4847
WINDOW=65496 RES=0x00 ACK PSH URGP=0
Jun 27 22:08:54 (none) kern.warn kernel: IN=br0 OUT=ppp0 PHYSIN=vlan0 SRC=
192.168.1.2 <http://192.168.1.2> DST=219.93.175.234
<http://219.93.175.234>LEN=78 TOS=0x00 PREC=0x00 TTL=127 ID=3719
PROTO=UDP SPT=137 DPT=137 LEN=58
Jun 27 22:08:54 (none) kern.warn kernel: IN=ppp0 OUT=br0 PHYSOUT=vlan0 SRC=
210.187.132.33 <http://210.187.132.33> DST=192.168.1.2
<http://192.168.1.2>LEN=56 TOS=0x00 PREC=0x00 TTL=252 ID=0 PROTO=ICMP
TYPE=3 CODE=13 [SRC=
192.168.1.2 <http://192.168.1.2> DST=219.93.175.234
<http://219.93.175.234>LEN=78 TOS=0x00 PREC=0x00 TTL=125 ID=3719
PROTO=UDP SPT=137 DPT=137 LEN=58 ]
Jun 27 22:08:54 (none) kern.warn kernel: IN=br0 OUT=ppp0 PHYSIN=vlan0 SRC=
192.168.1.2 <http://192.168.1.2> DST=219.93.175.234
<http://219.93.175.234>LEN=40 TOS=0x00 PREC=0x00 TTL=127 ID=3720 DF
PROTO=TCP SPT=4847 DPT=21
WINDOW=64027 RES=0x00 ACK URGP=0
Jun 27 22:08:56 (none) kern.warn kernel: IN=br0 OUT=ppp0 PHYSIN=vlan0 SRC=
192.168.1.2 <http://192.168.1.2> DST=219.93.175.234
<http://219.93.175.234>LEN=78 TOS=0x00 PREC=0x00 TTL=127 ID=3723
PROTO=UDP SPT=137 DPT=137 LEN=58
Jun 27 22:08:57 (none) kern.warn kernel: IN=br0 OUT=ppp0 PHYSIN=vlan0 SRC=
192.168.1.2 <http://192.168.1.2> DST=219.93.175.234
<http://219.93.175.234>LEN=78 TOS=0x00 PREC=0x00 TTL=127 ID=3725
PROTO=UDP SPT=137 DPT=137 LEN=58
Jun 27 22:08:59 (none) kern.warn kernel: IN=br0 OUT=ppp0 PHYSIN=vlan0 SRC=
192.168.1.2 <http://192.168.1.2> DST=219.93.175.234
<http://219.93.175.234>LEN=48 TOS=0x00 PREC=0x00 TTL=127 ID=3727 DF
PROTO=TCP SPT=4848 DPT=3265
WINDOW=64240 RES=0x00 SYN URGP=0
Jun 27 22:08:59 (none) kern.warn kernel: IN=ppp0 OUT=br0 PHYSOUT=vlan0 SRC=
219.93.175.234 <http://219.93.175.234> DST=192.168.1.2
<http://192.168.1.2>LEN=48 TOS=0x00 PREC=0x00 TTL=122 ID=11818 DF
PROTO=TCP SPT=3265 DPT=4848
WINDOW=65535 RES=0x00 ACK SYN URGP=0
Jun 27 22:08:59 (none) kern.warn kernel: IN=br0 OUT=ppp0 PHYSIN=vlan0 SRC=
192.168.1.2 <http://192.168.1.2> DST=219.93.175.234
<http://219.93.175.234>LEN=40 TOS=0x00 PREC=0x00 TTL=127 ID=3728 DF
PROTO=TCP SPT=4848 DPT=3265
WINDOW=64240 RES=0x00 ACK URGP=0
Jun 27 22:08:59 (none) kern.warn kernel: IN=br0 OUT=ppp0 PHYSIN=vlan0 SRC=
192.168.1.2 <http://192.168.1.2> DST=219.93.175.234
<http://219.93.175.234>LEN=52 TOS=0x00 PREC=0x00 TTL=127 ID=3729 DF
PROTO=TCP SPT=4847 DPT=21
WINDOW=64027 RES=0x00 ACK PSH URGP=0
Jun 27 22:08:59 (none) kern.warn kernel: IN=ppp0 OUT=br0 PHYSOUT=vlan0 SRC=
219.93.175.234 <http://219.93.175.234> DST=192.168.1.2
<http://192.168.1.2>LEN=94 TOS=0x00 PREC=0x00 TTL=122 ID=11828 DF
PROTO=TCP SPT=21 DPT=4847
WINDOW=65484 RES=0x00 ACK PSH URGP=0
Jun 27 22:08:59 (none) kern.warn kernel: IN=br0 OUT=ppp0 PHYSIN=vlan0 SRC=
192.168.1.2 <http://192.168.1.2> DST=219.93.175.234
<http://219.93.175.234>LEN=40 TOS=0x00 PREC=0x00 TTL=127 ID=3731 DF
PROTO=TCP SPT=4847 DPT=21
WINDOW=63973 RES=0x00 ACK URGP=0

Does these tell anything?

Quoted 25 lines · Jong Hian Zin
Quoted 7 lines · On 6/23/05, /dev/rob0 <[email protected]> wrote:
Quoted 3 lines · Jong Hian Zin

http://202.188.95.52:8080/speedometer/

The bandwidth test Java applet can be loaded, but unable to start the

Does it work if not going through the OpenWRT?

Yes, it works if I connect the PC directly to the ADSL modem, using PPPoE.

Not from what you posted. iptables-save(8) would be easier to follow.

Quoted 6 lines

But you can probably troubleshoot this on your own by putting in -j LOG rules for -s/-d 202.188.95.52 <http://202.188.95.52> traffic. Try it and see what you get. Is
the openwrt capable of normal logging? Or maybe to a remote syslog server?

I will try iptables-save and logging.

Signature · 1 line
Jong Hian Zin 
Signature · 1 line
Jong Hian Zin