Tuesday, January 11, 2011

How to open ports for outside traffic?

I recently installed Ubuntu Server on an old machine, to set up a website with family photos etc. It is connected to the Internet via my home router (WRT160Nv2). I set the connection up with a static IP address (192.168.1.200), set forwarding rules on the router (for port 80). Apache2 is set up to listen on port 80 (and it does).

I can view the website from within the local network (just typing in 192.168.1.200 in the browser on any computer behind the router), but it's invisible from the outside. Ports are forwarded correctly, when I forwarded them to another machine within the network, it's visible from the outside. It has to be some problem with this server, it blocks all connections from external addresses. Why? This is not just a problem with port 80, all ports seem closed from the outside. The built-in firewall (UFW) is active, but set to allow all connections (I tried disabling it, no change). No help from netstat either.

root@czarny:~# netstat -an | grep "LISTEN "
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:139             0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:110             0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:143             0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:445             0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:993             0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:995             0.0.0.0:*               LISTEN
tcp6       0      0 :::8080                 :::*                    LISTEN
tcp6       0      0 :::22                   :::*                    LISTEN
tcp6       0      0 127.0.0.1:8005          :::*                    LISTEN
root@czarny:~# ufw status
Status: active

To                         Action      From
--                         ------      ----
Apache                     ALLOW       Anywhere
Postfix                    ALLOW       Anywhere
Dovecot POP3               ALLOW       Anywhere
Dovecot IMAP               ALLOW       Anywhere
Dovecot Secure IMAP        ALLOW       Anywhere
Dovecot Secure POP3        ALLOW       Anywhere
Postfix Submission         ALLOW       Anywhere
OpenSSH                    ALLOW       Anywhere
Apache Full                ALLOW       Anywhere
From ubuntu Jan K
  • Oh, I feel stupid now. It was a typo in network configuration (/etc/network/interfaces), wrong default gateway.

    marenostrum : You may accept your own answer if the question is solved.
    From Jan K

0 comments:

Post a Comment