deploy iptables file from Satellite errors during iptables-restore

Latest response

I have a working iptables file, but when I try to iptables-restore, I get the following error:

iptables-restore v1.4.7: no command specified
Error occurred at line: 80
Try `iptables-restore -h' or 'iptables-restore --help' for more information.

For some reason I deploy the file and then do a iptables-restore < file, I get an error. Nothing wrong with the file, but the ONLY way I can get it to load is if I open it in vi, and save it. With out doing anything to the file...

Here is the kicker, all I have to do is open file in vi, then save right away with out doing anything to the file and it works!
Same permissions, same security everything.

RedHat ES 6. 2.6.32-504.16.2.el6.x86_64 #1 SMP Tue Mar 10 17:01:00 EDT 2015 x86_64 x86_64 x86_64 GNU/Linux

Responses

Laura,

What appears on line 80 of the file? is the file only 80 lines long?

Perhaps it needs a carriage return on the last line, or the line termination used in the deployed file isn't what iptables-restore is expecting.

One way to test this is to run 'dos2unix' on the file (rather than opening in vi), if that also fixes the problem (ie. iptables-restore works after running it) I would say the line termination is your issue.

I figured it out!
Geez. Seems that if you edit a file lets say in Notepad++ and upload the file, it does not have a EOL.
I noticed it when I opened it in vi. Small heading stating [noeol]

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.