LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 03-06-2014, 06:11 AM   #1
archi2092
LQ Newbie
 
Registered: Mar 2014
Posts: 4

Rep: Reputation: Disabled
Unhappy After rebooting CentOS /etc/sysconfig/iptables changed


Hi,

I am using CentOS 5.9 and I have added port to make it accessible in a LAN but when I reboot the file /etc/sysconfig/iptables always changed to original one .

Kindly let me know how may I save my changes to these file so that it could not change by system reboot.

Thanks!
 
Old 03-06-2014, 06:22 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
generally you wouldn't edit it, you'd add it in the live iptables config, and then use iptables-save to write it back to file.
 
Old 03-06-2014, 08:02 AM   #3
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
on my CentOS 5.10 hosts, I run
Code:
/sbin/iptables-save > /root/safe.rules
and in /etc/rc.local I use
Code:
iptables-restore /root/safe.rules
How to get that to occur on restart|reboot, I don't know...
 
Old 03-06-2014, 08:16 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
oh, yes.... "/etc/init.d/iptables save" wraps the iptables-save command with the sysconfig file. that's what I'd forgotten.
 
Old 03-06-2014, 10:37 AM   #5
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
https://www.centos.org/docs/4/html/r...es-saving.html
 
Old 03-07-2014, 04:34 AM   #6
archi2092
LQ Newbie
 
Registered: Mar 2014
Posts: 4

Original Poster
Rep: Reputation: Disabled
Thanks to all for replying. Now I am able to save my iptables policy.

Regards,
archi2092
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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] during system startup, iptables rules not loaded from /etc/sysconfig/iptables danyim Linux - Security 3 04-13-2013 02:09 AM
[ASK] centos 5, ip address not changed, even the /etc/sysconfig/network-scrip..... vaporizel Linux - Networking 3 02-18-2011 01:48 AM
iptables -P vs :OUTPUT in /etc/sysconfig/iptables TomF Linux - Security 2 04-14-2005 10:50 PM
IPTABLES - rules in /etc/sysconfig/iptables The_JinJ Linux - Newbie 6 11-20-2004 01:40 AM
My iptables script is /etc/sysconfig/iptables. How do i make this baby execute on boo ForumKid Linux - General 3 01-22-2002 07:36 AM

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

All times are GMT -5. The time now is 06:41 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