Hello,
How to block a port to one IP using iptables rules?
Thanks,
Minotauro.
Hello,
How to block a port to one IP using iptables rules?
Thanks,
Minotauro.
iptables -A INPUT -s xxx.xxx.xxx.xxx -p portocol --destination-port portname -j DROP
xxx.xxx.xxx.xxx : is the IP address
portocol : portocol (TCP/UDP/ICMP)
portname : telnet for example
Read Docs before playing with iptables, however.
The above should do the trick.
Anup
Here is another solution for you.
The apf firewall script from http://www.rfxnetworks.com/apf.php can handle mutliple IP addresses.(mutliple eth cards or virual eth cards) The other reason I suggest this script is for newbies, it has a cron reset function. So if you make a mistake, it will reset itself to no rules after five mins (default setting). This is real handy if the server is in a remote datacenter. Once you have everything setup, you just edit its main config file to disable the auto reset.
I would still suggest learning how to manually configuring your iptables, instead of using a script, but this is a nice little script that will protect your box while you learn.
apf+bfd-portsentry = ideal combination to start with
Anup
Please explain how you consider that a 'solution' to the question of blocking one port to one IP?Originally Posted by sfi-dd