Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

At home, I have Ubuntu server with the UFW firewall. What command do I type to turn on local intranet access to my web server, but keep the outside world out from my DSL modem?

share|improve this question
Is the DSL modem a NATing router? If so, and if you haven't forwarded any ports to the server, then leaving the firewall wide open is fine--nothing's getting past the router. – maco Aug 24 '10 at 23:51
This is a just-in-case kind of thing. You never know when some thief finds a router exploit and can play with MAC addresses to get through. – Volomike Aug 25 '10 at 13:40
up vote 3 down vote accepted
sudo ufw default deny
sudo ufw allow from to any port 80

Assuming the web server is on port 80 and 192.168.1.x is your home subnet. If you explicitly want exclude your router, then assuming it's, it would be:

sudo ufw deny from to any port 80
share|improve this answer

Your Answer


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.