But when I start, iptables-save command shows that there are no rules, hence above file has not been loaded. I have to load them at every startup. How can I sort this problem? Thanks.
Your shebang is bad. Why would you change that? Why would you completely replace the original contents of the file, which include instructions on how to edit it?
The following are the original contents of the file:
#!/bin/sh
#
# /etc/rc.d/rc.local: Local system initialization script.
#
# Put any local startup commands in here. Also, if you have
# anything that needs to be run at shutdown time you can
# make an /etc/rc.d/rc.local_shutdown script and put those
# commands in there.
# ls -l /etc/rc.local
-rwxr-xr-x 1 root root 101 Nov 21 22:53 /etc/rc.local
root[i_user]#
But when I start, iptables-save command shows that there are no rules, hence above file has not been loaded. I have to load them at every startup. How can I sort this problem? Thanks.
This is so because file rc.local has no place in directory /etc. From Gapans file excerpt you can see that it must be right /etc/rc.d/rc.local. You probably want to add your iptables-restore command to the end of this file.
Both those "obvious" mistakes (the bad shebang, the location) could have been avoided by editing the file, with its informative instructions, in situ. (Well spotted, westms!)
I say that not to be pedantic but as a concrete example of why such a conservative approach is good practice. The more you change, the greater the chance of breaking something - whether by overlooking it, or just not knowing.