kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: Aruna Hewapathirane <aruna.hewapathirane@gmail.com>
To: noloader@gmail.com
Cc: kernelnewbies <kernelnewbies@kernelnewbies.org>
Subject: Re: iptables and combining additional rule sources
Date: Sun, 26 Apr 2020 08:42:18 -0400	[thread overview]
Message-ID: <CAFSeFg9qQ+GYF2XoEDgmNUnYnOMNMbsXPGvk9SfJqEct9upu1w@mail.gmail.com> (raw)
In-Reply-To: <CAH8yC8kqc=HUGs=nUbe52anfT24CGyS0VypCpuqNZNPb6gcB6g@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 1211 bytes --]

<snip>
> The problem I am having is, adding the new information to the existing
> iptables rules in /etc/sysconfig/iptables. I want to write my rules to
> a separate file and then tell /etc/sysconfig/iptables to include it at
> the correct position.
>
> I read the iptables(8), iptables-save(8) and iptables-restore(8) man
> pages, but I don't see how to combine the different sources.
>
> How do I tell iptables to include a second external source at a
> specific location?
<snip>

1 - Get the iptables rules list with the line numbers enabled
     $ iptables -nL –line-numbers

2 - Look up the line number you want to use and insert your rule.
     ( I am inserting a rule at line number 10, the existing rule will
shift down)
     $ sudo /sbin/iptables -I INPUT 10 -s 202.54.1.1 -j DROP -m comment
--comment "DROP spam IP address - "

3 - Save the rules to a file in etc so you can reload them at the next
reboot
     $ sudo /sbin/iptables-save > /etc/iptables.local

4 - To make the rules persistent, add the following rule to your
/etc/rc.local file)
     sudo /sbin/iptables-restore < /etc/iptables.local

If your system reboots you will not loose the rules now.

Aruna

[-- Attachment #1.2: Type: text/html, Size: 2834 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

  parent reply	other threads:[~2020-04-26 12:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-24 22:28 iptables and combining additional rule sources Jeffrey Walton
2020-04-25  3:06 ` Valdis Klētnieks
2020-04-25  6:55   ` Jeffrey Walton
2020-04-25 16:53     ` Valdis Klētnieks
2020-04-25 17:16       ` Jeffrey Walton
2020-04-25  3:32 ` Keh-Ming Luoh
2020-04-25  7:01   ` Jeffrey Walton
2020-04-26 12:42 ` Aruna Hewapathirane [this message]
2020-04-29  9:30 ` Thorondir

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAFSeFg9qQ+GYF2XoEDgmNUnYnOMNMbsXPGvk9SfJqEct9upu1w@mail.gmail.com \
    --to=aruna.hewapathirane@gmail.com \
    --cc=kernelnewbies@kernelnewbies.org \
    --cc=noloader@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).