?
Solved

RHEL 6 Iptables-Save

Posted on 2011-10-03
2
Medium Priority
?
718 Views
Last Modified: 2012-06-21
Hello everyone. I am somewhat new to administering Red Hat so please bear with me.

Here are the kernels I'm running-
Old RHEL     2.6.9-5.EL
New RHEL   2.6.32-131.6.1.el6.x86_64

I am in the process of replacing an our old RHEL server, and I need to migrate the iptables to the new server (I want the same exact setup). I tried saving a copy of iptables on the old server-
cd/etc/sysconfig/cp iptables iptables.bak1

And then I tried using the iptables-restore command on the new server, only to get "iptables-restore line 5 failed".

Is this because I'm not using the iptables-save command and just making a copy of the file? Can I run iptables-save without it affecting or messing anything up as this is our main router? OR is there no difference between doing a cp iptables and iptables-restore and I'm looking at a bigger problem here?

I'm open to any suggestions if someone has a better way to migrate iptables to a new machine.


Thanks.
0
Comment
Question by:Albert_Winfrey
  • 2
2 Comments
 
LVL 21

Expert Comment

by:Papertrip
ID: 36905777
How are you invoking iptables-restore?
What is on line 5 of the iptables file?
0
 
LVL 21

Accepted Solution

by:
Papertrip earned 2000 total points
ID: 36905825
Can I run iptables-save without it affecting or messing anything up as this is our main router?
Yes, it just dumps the contents of iptables to STDOUT
is there no difference between doing a cp iptables and iptables-restore and I'm looking at a bigger problem here?
The output from iptables-save is the same format as /etc/sysconfig/iptables, so just copying that file should be fine, however you should run iptables-save first to dump any rules that may not be committed to disk.

On RHEL/CentOS, you can type 'service iptables save' and that will dump the contents and overwrite /etc/sysconfig/iptables.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
This article will show you step-by-step instructions to build your own NTP CentOS server.  The network diagram shows the best practice to setup the NTP server farm for redundancy.  This article also serves as your NTP server documentation.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Suggested Courses

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question