Find the answer to your Linux question:
Results 1 to 3 of 3
This isn't exactly of critical importance, but is there any way to block two entirely different addresses in the one rule, rather than writing individual rules for each of them? ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Apr 2010
    Posts
    3

    IPTABLES: two unrelated source IPs in a single rule?


    This isn't exactly of critical importance, but is there any way to block two entirely different addresses in the one rule, rather than writing individual rules for each of them? For example, if the addresses were 1.1.1.1 and 8.8.8.8, and I only wanted to block these two.

    Or alternatively, if I wanted to block two subnets, say 1.1.1.0/24 and 8.8.8.0/24? Can this be done in one rule?

    Thanks to anyone who can offer advice.

  2. #2
    Linux Engineer Kloschüssel's Avatar
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    773
    You may want to get familiar with chains of rules.

    Usually in the PREROUTING chain you would add a reference to your IPSTOBEBLOCKED chain, which examines the IP and decides to forward it to a general BLOCK chain that does all blocking.

  3. #3
    Linux Enthusiast Bemk's Avatar
    Join Date
    Sep 2008
    Location
    Oosterhout-NB, Netherlands
    Posts
    525
    As far as I know, not, but I'm not close to an expert yet.

    Maybe you may find the answer in here:
    Iptables Tutorial 1.2.2

  4. $spacer_open
    $spacer_close

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •