Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Member
    Join Date
    Jan 2004
    Posts
    84

    Default iptables - how to block a port to one IP?

    Hello,

    How to block a port to one IP using iptables rules?

    Thanks,
    Minotauro.

  2. #2
    Member
    Join Date
    Mar 2004
    Location
    This Planet
    Posts
    984

    Default

    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

  3. #3
    Member
    Join Date
    Jul 2004
    Posts
    7

    Default

    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.

  4. #4
    Member
    Join Date
    Mar 2004
    Location
    This Planet
    Posts
    984

    Default

    apf+bfd-portsentry = ideal combination to start with

    Anup

  5. #5
    Member
    Join Date
    Oct 2003
    Posts
    1,020

    Default

    Quote Originally Posted by sfi-dd
    Here is another solution for you.
    Please explain how you consider that a 'solution' to the question of blocking one port to one IP?

Similar Threads & Tags
Similar threads

  1. Opening a port / iptables
    By darkangel in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 03-01-2009, 03:33 AM
  2. Iptables redirect internal port - remote mysql
    By grzeg in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 11-12-2008, 04:13 AM
  3. iptables updates block my traffic
    By ronniemiller in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 04-13-2008, 11:36 PM
  4. Replies: 3
    Last Post: 05-12-2007, 07:46 AM
  5. iptables - do they block IP's automatically?
    By noimad1 in forum cPanel and WHM Discussions
    Replies: 9
    Last Post: 03-17-2005, 02:30 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube