Execute this command to find your default runlevel:
cat /etc/inittab | grep initdefault
You should see a line like this:
That means 2 is your default runlevel. This may also be 3, or rarely 4 or 5. Create your rc.local file like this (as root):
chmod 774 /etc/init.d/rc.local
Set it to be run at boot time by doing this:
ln -s /etc/init.d/rc.local /etc/rcX.d/S99local
Replace the X with your default runlevel from step one. For example, rc2.d. Edit your /etc/init.d/rc.local script.
This’ll cause your rc.local script to be run last during the bootup process (because of the 99). This is generally what you want to do, to make sure your network connection is up and all the basic services are started before your custom startup script runs.