Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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 192.168.1.203 on interface eth0 alow port 80

I have on local pc ip address 192.168.1.203 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 192.168.0.4 to any port 22 but i wont to add and on eth0 to work only something like this ufw allow from 192.168.1.203 to tcp port 80 on eth0 –  dena Jun 6 '13 at 10:51
add comment

2 Answers 2

this command works good:

ufw allow from 192.168.1.203 to 192.168.1.50 port 80 proto tcp

203 local machine, 50 apache

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

share|improve this answer
add comment

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

from http://manpages.ubuntu.com/manpages/raring/en/man8/ufw.8.html

So

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

You can specify a netmask if you wish, example

ufw allow from 192.168.1.0/16

share|improve this answer
add comment

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.