@rslaqui Greetings, rslaqui.
Klaus2008 has given you several good answers already.
Perhaps an example will help.
Here's an excerpt of what I use, only my wifi is eth1.
This assumes you have /etc/rc.local owned by root, and executable.

#!/bin/bash
#
# rc.local
#
WIFI="wlan0"; MODE="Managed"
dhclient -r $WIFI; ifconfig $WIFI up
iwconfig $WIFI essid XXXXX key XXXXXXXXXX mode $MODE
dhclient $WIFI
#
exit 0