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

Hi guys i would like to setup a specific rule for my ufw but i have the problem.

How could i type this ?

from ip adress on interface eth0 alow port 80

I have on local pc ip address ubuntu have 2 nics 1 is eth0 lokal network, eth1 wan. Ubuntu have installed apache service

I would like only my pc to access ubuntu on interface eth0 i that i only have access to open web pages from apache on port 80

i hope you understand me guys :)

share|improve this question
Take a look at UFW. – Mitch Jun 6 '13 at 10:50
yes my friend i read that over and over but there is sudo ufw allow from to any port 22 but i wont to add and on eth0 to work only something like this ufw allow from to tcp port 80 on eth0 – dena Jun 6 '13 at 10:51

this command works good:

ufw allow from to port 80 proto tcp

203 local machine, 50 apache

but i am finding the way for command to replace with eth0 so when i change ip adress on that nic eth0 to rule stay....

share|improve this answer

By default, ufw will apply rules to all available interfaces. To limit this, specify DIRECTION on INTERFACE, where DIRECTION is one of in or out (interface aliases are not supported). For example, to allow all new incoming http connections on eth0, use:

ufw allow in on eth0 to any port 80 proto tcp



sudo ufw allow in on eth0 from to port 80 proto tcp

You can specify a netmask if you wish, example

ufw allow from

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.