Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have a Palm Pre, and I've installed my webserver on it, it listens on port 8080. It works, when I open 192.168.1.104:8080 on the Pre's browser (that's the IP address of the device, I've failed with localhost or 127.0.0.1), it shows images, everything is OK.

But I can't access the webserver from outside, e.g. from my desktop machine, it shows timeout. Is there a firewall on the Pre, or what's wrong? I can change server's port number, if necessary. I didn't configured the Pre, just installed SSH. Also, I can SSH to Pre, and from Pre to my desktop.

UPDATE:

ifconfig says:

eth0      Link encap:Ethernet  HWaddr 00:1D:FE:B5:99:51  
          inet addr:192.168.1.104  Bcast:192.168.255.255  Mask:255.255.0.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:486 errors:0 dropped:0 overruns:0 frame:0
          TX packets:284 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:69398 (67.7 KiB)  TX bytes:40051 (39.1 KiB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:1248 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1248 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:128070 (125.0 KiB)  TX bytes:128070 (125.0 KiB)

iptables -nvL says:

Chain INPUT (policy DROP 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
  370 29404 ACCEPT     tcp  --  eth0   *       0.0.0.0/0            0.0.0.0/0           tcp dpt:22 
 1248  128K ALLOWED_PACKETS  all  --  lo     *       0.0.0.0/0            0.0.0.0/0           
    0     0 INVALID_PACKETS  all  --  !lo    *       127.0.0.0/8          0.0.0.0/0           
    0     0 REJECT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:113 flags:0x17/0x02 state NEW reject-with tcp-reset 
    0     0 DROP       tcp  --  bridge0 *       0.0.0.0/0            0.0.0.0/0           tcp dpts:4444:4445 
   47 28580 ALLOWED_PACKETS  all  --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED 
    0     0 ALLOWED_PACKETS  all  --  bridge0 *       0.0.0.0/0            0.0.0.0/0           
    0     0 ALLOWED_PACKETS  all  --  usb0   *       0.0.0.0/0            0.0.0.0/0           
    0     0 ALLOWED_PACKETS  icmp --  *      *       0.0.0.0/0            0.0.0.0/0           icmp type 0 state NEW 
    0     0 ALLOWED_PACKETS  icmp --  *      *       0.0.0.0/0            0.0.0.0/0           limit: avg 1/sec burst 5 icmp type 0 
    0     0 ALLOWED_PACKETS  icmp --  *      *       0.0.0.0/0            0.0.0.0/0           icmp type 3 state NEW 
    0     0 ALLOWED_PACKETS  icmp --  *      *       0.0.0.0/0            0.0.0.0/0           limit: avg 1/sec burst 5 icmp type 3 
    0     0 ALLOWED_PACKETS  icmp --  *      *       0.0.0.0/0            0.0.0.0/0           icmp type 4 state NEW 
    0     0 ALLOWED_PACKETS  icmp --  *      *       0.0.0.0/0            0.0.0.0/0           limit: avg 1/sec burst 5 icmp type 4 
    0     0 ALLOWED_PACKETS  icmp --  *      *       0.0.0.0/0            0.0.0.0/0           icmp type 5 state NEW 
    0     0 ALLOWED_PACKETS  icmp --  *      *       0.0.0.0/0            0.0.0.0/0           limit: avg 1/sec burst 5 icmp type 5 
    3   252 ICMPFLOOD  icmp --  *      *       0.0.0.0/0            0.0.0.0/0           icmp type 8 state NEW 
    0     0 ALLOWED_PACKETS  icmp --  *      *       0.0.0.0/0            0.0.0.0/0           icmp type 11 state NEW 
    0     0 ALLOWED_PACKETS  icmp --  *      *       0.0.0.0/0            0.0.0.0/0           limit: avg 1/sec burst 5 icmp type 11 
    0     0 ALLOWED_PACKETS  tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:5353 
    0     0 ALLOWED_PACKETS  udp  --  *      *       0.0.0.0/0            0.0.0.0/0           udp dpt:5353 
    0     0 ALLOWED_PACKETS  tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:3689 
    0     0 ALLOWED_PACKETS  udp  --  *      *       0.0.0.0/0            0.0.0.0/0           udp dpt:3689 
    0     0 ALLOWED_PACKETS  tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp flags:0x04/0x04 
   36  4604 LOG        all  --  *      *       0.0.0.0/0            0.0.0.0/0           limit: avg 3/sec burst 5 LOG flags 0 level 7 prefix `IPT_PACKET_DROPPED_NO_MATCH: ' 
   36  4604 QUEUE      all  --  *      *       0.0.0.0/0            0.0.0.0/0           

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 INVALID_PACKETS  all  --  *      *       0.0.0.0/0            0.0.0.0/0           state INVALID 

Chain OUTPUT (policy ACCEPT 1541 packets, 166K bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain ALLOWED_PACKETS (20 references)
 pkts bytes target     prot opt in     out     source               destination         
 1298  157K ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           

Chain ICMPFLOOD (1 references)
 pkts bytes target     prot opt in     out     source               destination         
    3   252            all  --  *      *       0.0.0.0/0            0.0.0.0/0           recent: SET name: ICMP side: source 
    0     0 LOG        all  --  *      *       0.0.0.0/0            0.0.0.0/0           recent: UPDATE seconds: 1 hit_count: 6 TTL-Match name: ICMP side: source limit: avg 1/sec burst 1 LOG flags 0 level 4 prefix `IPT_ICMPFLOOD: ' 
    0     0 DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0           recent: UPDATE seconds: 1 hit_count: 6 TTL-Match name: ICMP side: source 
    3   252 ALLOWED_PACKETS  all  --  *      *       0.0.0.0/0            0.0.0.0/0           

Chain INVALID_PACKETS (2 references)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 LOG        all  --  *      *       0.0.0.0/0            0.0.0.0/0           limit: avg 1/sec burst 100 LOG flags 0 level 4 prefix `IPT_INVALID_PACKETS_DROPPED: ' 
    0     0 DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0           

I assume, TCP should be accepted for port 8080 or whatever I want, just as for 22 (SSH).

share|improve this question
    
You can run Linux commands as root on the Palm Pre, right? What do ifconfig and iptables -nvL show? –  Gilles Feb 27 '11 at 0:51
    
I've added the cmd results. I feel a little dumb now, I have very few knowledge about iptables. –  ern0 Feb 27 '11 at 15:39

1 Answer 1

up vote 1 down vote accepted

At the moment, incoming traffic is blocked unless explicitly allowed (that's what policy DROP means). There are rules to allow “legitimate” traffic, for example the very first rule allows incoming ssh connections (tcp dpt:22 means TCP traffic to port 22, and that's the ssh port).

The manual way to enable a web server is add an iptables rule that allows incoming traffic to that port. Let's say you want to open port 80. You can to it with the following command:

iptables -I INPUT 24 -p tcp --dport 80 -j ALLOWED_PACKETS

(Note that I'm following the model of ports 3689 and 5353, which allow for things like rate control. Ssh is handled specially, I guess to reduce the risk that a misconfiguration will make it inaccessible.)

There's probably a canonical way to have your settings applied at boot time. Googling suggests that once you have a satisfactory setting, you can make it permanent with

iptables-save >/etc/pmnetconfig/iptables-common.config

I don't know WebOS, so I can't confirm the location of this file.

During your experimentations, if you mess up, you can delete a specific rule (e.g. the 42nd) with iptables -D INPUT 42. Assuming the location above is correct, you can restore the boot-time settings with

iptables-restore </etc/pmnetconfig/iptables-common.config
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.