Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

UPDATE 1:

I am using Apache 2 as the webserver. Can I block access to all IP addresses except 3 from Apache?

ORIGINAL QUESTION:

I have a Linksys BEFSR41 router and have opened port 80 for development purposes. Is it possible to block access to port 80 to everyone except certain IP addresses? So port 80 should only be accessable to about 3 ip addresses from outside the internal network.

I have tried looking at the manaul for the BEFSR41, but can't seem to find what I am looking for. Or maybe, I don't understand what this type of filtering is called.

share|improve this question

4 Answers 4

If your router can't handle it, you could take advantage of Apache's 'Allow from' directive, either globally or at a site-specific level. Or, if you're running Apache on Linux, open up port 80 on IPTables with something like:

-A INPUT -i eth0 -p tcp -m tcp -s [your.first.ip] --dport 80 -j ACCEPT

-A INPUT -i eth0 -p udp -m udp -s [your.first.ip] --dport 80 -j ACCEPT

-A INPUT -i eth0 -p tcp -m tcp -s [your.second.ip] --dport 80 -j ACCEPT

-A INPUT -i eth0 -p udp -m udp -s [your.second.ip] --dport 80 -j ACCEPT

etc.

share|improve this answer

From everything I can tell about that router it does not offer source port routing. One option if you have an old PC and a pair of network cards would be a setup of IPCOP. Free firewall with lots of great features.

share|improve this answer
    
Please see update 1 in the original question. –  oshirowanen Apr 28 '11 at 23:04

No. The BEFSR41 is a consumer grade router, and will not have the functionality you are looking for out of the box.

It may be able to install DD-WRT or tomato on it to get more functionality.

share|improve this answer
    
Please see update 1 in the original question. –  oshirowanen Apr 28 '11 at 23:04

Have you looked at your web server to see if it has that granularity? Most "decent" web servers will support that exact functionality.

share|improve this answer
    
Please see update 1 in the original question. –  oshirowanen Apr 28 '11 at 23:04
    

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.