How can I "copy" IPTables rules from an old RH 7.2 Firewall to a new Fedora Firewall

I've basically just joined a new company as head of IT - needless to say, I've been left with some rather screwed up software [and hardware] due to an incompetent predecessor. One of our major problems is a 7 year old desktop running a 4 year old version of Linux as a firewall. Now the original installation I'm told, was pretty tight - as such, I want to transcribe the old IPTables rules onto the new machine.

Is there a way of doing this - seeing as I'm not particularly au fait [yet] with Linux 7.2 or Fedora? If not, how can I see what the original rules were?
nrjordanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

blklineCommented:
You can view the current rules via (as root):

iptables -L

There are a couple of places to look for the current configuration.  If your predecessor did it the Red Hat way, then look for a file called /etc/sysconfig/iptables.  Otherwise, check out /etc/rc.d/rc.local or /etc/rc.d/rc.firewall
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
nrjordanAuthor Commented:
Thanks - now that I've pulled all the data off the old fileserver, how do I configure the new one - is it just a case of editing the iptables file in vi to be identical to the old one or is it, as I expect, rather more complex than that...
0
wesly_chenCommented:
Hi,

As root, do
# /sbin/iptables-save    (on RH7.2)
and copy the /etc/sysconfig/iptables from RH7.2 to Fedora /etc/sysconfig/iptables.

Then restart the iptables on Fedora
# service iptables restart

Regards,

Wesly
0
ON-DEMAND: 10 Easy Ways to Lose a Password

Learn about the methods that hackers use to lift real, working credentials from even the most security-savvy employees in this on-demand webinar. We cover the importance of multi-factor authentication and how these solutions can better protect your business!

blklineCommented:
No, it really is as simple as Wesley makes it out to be.   You may want to take some time to review it to ensure that it is doing what you expect.  The only problem with Red Hat's method of doing it is that there will be no comments embedded within so you'll have to evaluate what your predecessor was doing.

And thank you, Wesly, for helping out.
0
ahoffmannCommented:
AFAIK the most reliable method would be to copy the /etc/sysconfig/iptables
then compare results of following command on old and new installation:

(iptables -L -n -v&&iptables -L -n -v -t nat&&iptables -L -n -v -t mangle)|grep -v packets|cut -b 13-|sort

# probably you need to adjust 13 in the cut command above
0
nrjordanAuthor Commented:
Thanks guys - you've been a great help
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux Security

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.