To setup links for your script in each rc?.d you don’t have to it manually one by one. You can use Ubuntu command update-rc.d.

Manual for update-rc.d in Ubuntu

update-rc.d updates the System V style init script links /etc/rcrun‐level.d/NNname whose target is the script /etc/init.d/name. These links are run by init when it changes runlevels; they are generally used to start and stop system services such as daemons. runlevel is one of the runlevels supported by init, namely, 0123456789S, and NN is the two-digit sequence number that determines where in the sequence init will run the scripts. the two-digit sequence number that determines where in the sequence

init will run the scripts.

EXAMPLES

Insert links using the defaults:

update-rc.d foobar defaults

Equivalent command using explicit argument sets:

update-rc.d foobar start 20 2 3 4 5 . stop 20 0 1 6 .

Insert links for a service that should be running during multi-user

mode, but that does not need to be explicitly stopped on shutdown:

update-rc.d foobar multiuser

Equivalent command using explicit argument sets:

update-rc.d foobar start 20 2 3 4 5 . stop 20 1 .

More typical command using explicit argument sets:

update-rc.d foobar start 30 2 3 4 5 . stop 70 0 1 6 .

Remove all links for a script (assuming foobar has been deleted

already):

update-rc.d foobar remove

Example of disabling a service:

update-rc.d -f foobar remove

update-rc.d foobar stop 20 2 3 4 5 .

Example of a command for installing a system initialization-and-shut‐

down script:

update-rc.d foobar start 45 S . start 31 0 6 .

Example of a command for disabling a system initialization-and-shutdown

script:

script:

update-rc.d -f foobar remove

update-rc.d foobar stop 45 S .

Setup links for myfirewall_scripts

taufanlubis@zyrex:~$ sudo update-rc.d myfirewall_scripts defaults

Adding system startup for /etc/init.d/myfirewall_scripts …

/etc/rc0.d/K20myfirewall_scripts -> ../init.d/myfirewall_scripts

/etc/rc1.d/K20myfirewall_scripts -> ../init.d/myfirewall_scripts

/etc/rc6.d/K20myfirewall_scripts -> ../init.d/myfirewall_scripts

/etc/rc2.d/S20myfirewall_scripts -> ../init.d/myfirewall_scripts

/etc/rc3.d/S20myfirewall_scripts -> ../init.d/myfirewall_scripts

/etc/rc4.d/S20myfirewall_scripts -> ../init.d/myfirewall_scripts

/etc/rc5.d/S20myfirewall_scripts -> ../init.d/myfirewall_scripts

taufanlubis@zyrex:~$

K20 in rc0.d, rc1.d and rc6.d = myfirewall_scripts will be executed when leaving runlevel N.

S20 in rc2.d, rc3.d, rc4.d and rc5.d = myfirewall_scripts will be executed when enter runlevel N.

Step 4. Reboot the system

Check the iptables status. If everything is running well then you will see your iptables chain rules.

Hello,
I would like to volunteer to edit your article. Not the technical stuff, but only typos. If you are interested, send an email to the address this post is associated with. Thanks for the article.