LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (http://www.linuxquestions.org/questions/linux-networking-3/)
-   -   iptables - howto block by a port and IP address -HELP! (http://www.linuxquestions.org/questions/linux-networking-3/iptables-howto-block-by-a-port-and-ip-address-help-47244/)

macnanc 02-26-2003 12:30 PM

iptables - howto block by a port and IP address -HELP!
 
I have RH7.1 and I'm trying to setup a rule using "iptables" to only accept connections from a specific IP address and a specific port?

does anyone know the command to do this?

Thanks

Pcghost 02-26-2003 01:41 PM

iptables -A INPUT -p tcp -s !192.168.0.1 -sport 80 -j DROP

What this does is to drop all packets from sources that are not 192.168.0.1:80

I think that is close. I know using the "!" in front of a normal rule means everything except what ever follows it. Run a search here for example scripts. I am sure someone has an anti rule in one of them..

macnanc 03-07-2003 05:45 AM

Worked great - Thanks!


All times are GMT -5. The time now is 08:05 PM.