LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 11-01-2023, 04:28 AM   #1
Jason.nix
Member
 
Registered: Feb 2023
Posts: 561

Rep: Reputation: 10
Post A question about how to edit iptables rules


Hello,
Suppose you have written a lot of iptables rules and now you want to edit some lines or a specific value. If you save the rules in a file using the iptables-save command and then edit it and restore it again using the iptables-restore command. Is this method correct?


Thank you.
 
Old 11-01-2023, 04:33 AM   #2
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,313
Blog Entries: 3

Rep: Reputation: 3723Reputation: 3723Reputation: 3723Reputation: 3723Reputation: 3723Reputation: 3723Reputation: 3723Reputation: 3723Reputation: 3723Reputation: 3723Reputation: 3723
That method works.

However, if you are getting started, I'd highly encourage looking at NFTables instead because it is much easier to work with. In this case, you'd just edit the NFTables configuration file and then reload it. Also, IPTables is already a thing of the past and getting further out of date as time passes. It's going to go away and you'll move to NFTables at that point anyway. So the time and learning invested in IPTables is kind of a lost cause at this point.
 
1 members found this post helpful.
Old 11-01-2023, 04:49 AM   #3
Jason.nix
Member
 
Registered: Feb 2023
Posts: 561

Original Poster
Rep: Reputation: 10
Quote:
Originally Posted by Turbocapitalist View Post
That method works.

However, if you are getting started, I'd highly encourage looking at NFTables instead because it is much easier to work with. In this case, you'd just edit the NFTables configuration file and then reload it. Also, IPTables is already a thing of the past and getting further out of date as time passes. It's going to go away and you'll move to NFTables at that point anyway. So the time and learning invested in IPTables is kind of a lost cause at this point.
Hello,
Thank you so much for your reply and offer.
It is true that NFTables is a replacement for iptables, but do you think this will happen soon? There is also a command called iptables-nft to translate iptables commands to NFTables. I guess at the current stage, iptables is more mature than NFTables.
 
Old 11-01-2023, 06:05 AM   #4
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,313
Blog Entries: 3

Rep: Reputation: 3723Reputation: 3723Reputation: 3723Reputation: 3723Reputation: 3723Reputation: 3723Reputation: 3723Reputation: 3723Reputation: 3723Reputation: 3723Reputation: 3723
Quote:
Originally Posted by Jason.nix View Post
Hello,
Thank you so much for your reply and offer.
It is true that NFTables is a replacement for iptables, but do you think this will happen soon? There is also a command called iptables-nft to translate iptables commands to NFTables. I guess at the current stage, iptables is more mature than NFTables.
For me and many others, NFTables has already replaced IPTables. So I would say the replacement has already happened.

I made the switch some years ago already (perhaps five) because IPTables did not support some of the activities I needed in networking. Since most development on IPTables was abandoned long ago, I would say that NFTables is now the mature technology and that IPtables is legacy software to be decommissioned from old systems when feasible, upon system upgrade at the latest. At this point time spent on IPTables will not provide a good return on the effort.

Conversion programs were not so useful for me so I went to native NFTables as soon as I could.

These two links seem to be the best starting place:

https://wiki.nftables.org/
https://wiki.nftables.org/wiki-nftab..._in_10_minutes
 
1 members found this post helpful.
Old 11-14-2023, 11:37 PM   #5
Jason.nix
Member
 
Registered: Feb 2023
Posts: 561

Original Poster
Rep: Reputation: 10
Quote:
Originally Posted by Turbocapitalist View Post
For me and many others, NFTables has already replaced IPTables. So I would say the replacement has already happened.

I made the switch some years ago already (perhaps five) because IPTables did not support some of the activities I needed in networking. Since most development on IPTables was abandoned long ago, I would say that NFTables is now the mature technology and that IPtables is legacy software to be decommissioned from old systems when feasible, upon system upgrade at the latest. At this point time spent on IPTables will not provide a good return on the effort.

Conversion programs were not so useful for me so I went to native NFTables as soon as I could.

These two links seem to be the best starting place:

https://wiki.nftables.org/
https://wiki.nftables.org/wiki-nftab..._in_10_minutes
Hello,
Thanks again.
Can you tell me what problems the conversion programs gave you?
 
Old 11-15-2023, 12:14 AM   #6
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,313
Blog Entries: 3

Rep: Reputation: 3723Reputation: 3723Reputation: 3723Reputation: 3723Reputation: 3723Reputation: 3723Reputation: 3723Reputation: 3723Reputation: 3723Reputation: 3723Reputation: 3723
Quote:
Originally Posted by Jason.nix View Post
Can you tell me what problems the conversion programs gave you?
I found that they were not useful more often than not. Repairing their output took time and instead I invested that time in NFTables. It did not take long to learn NFTables. For me it turned out easier to learn than IPTables even though I have been dabbling with IPTables since its beginning.
 
1 members found this post helpful.
Old 11-15-2023, 12:20 PM   #7
jayjwa
Member
 
Registered: Jul 2003
Location: NY
Distribution: Slackware, Termux
Posts: 780

Rep: Reputation: 247Reputation: 247Reputation: 247
I wrote a firewall script that blocks a few known problem areas of the net and does some other things. I can ban a host with it, and I set options to save and restore the state of iptables as functions in the shell script. Since it's under RCS, I use that to update the script. When I want to make changes, I change the script.

As far as nftables, if you don't know either iptables nor nftables, then go with nftables as stated. Those of us that learned ipchains^h ebtables^h ip6tables^h iptables aren't happy about having to learn yet another packet filtering syntax, one that looks more like a Java or C++ program than filtering rules. As such, I think iptables will still be around a long time.
 
1 members found this post helpful.
Old 11-21-2023, 11:28 PM   #8
Jason.nix
Member
 
Registered: Feb 2023
Posts: 561

Original Poster
Rep: Reputation: 10
Quote:
Originally Posted by jayjwa View Post
I wrote a firewall script that blocks a few known problem areas of the net and does some other things. I can ban a host with it, and I set options to save and restore the state of iptables as functions in the shell script. Since it's under RCS, I use that to update the script. When I want to make changes, I change the script.

As far as nftables, if you don't know either iptables nor nftables, then go with nftables as stated. Those of us that learned ipchains^h ebtables^h ip6tables^h iptables aren't happy about having to learn yet another packet filtering syntax, one that looks more like a Java or C++ program than filtering rules. As such, I think iptables will still be around a long time.
Hello,
Thank you so much for your reply.
I agree with:
Quote:
I think iptables will still be around a long time.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] /etc/udev/rules.d/40-libsane.rules and /etc/udev/rules.d/S99-2000S1.rules missing LABEL=libsane_rules_end mumahendras3 Slackware 6 03-09-2020 02:27 AM
auditctl -l not showing any rules even though i have rules written in audit.rules alphaguy Linux - Security 1 02-07-2014 05:28 PM
[SOLVED] edit iptables rules niteen Linux - Networking 14 05-30-2013 12:22 AM
How to edit "/etc/udev/rules.d/40-basic-permissions.rules" file cygan Linux - Newbie 11 03-09-2009 05:22 AM
IPTABLES how to add/edit/delete rules in existing chain? debug019 Linux - Newbie 1 11-11-2004 02:48 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 12:39 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration