Is it possible to use Ifconfig to switch an interface to DHCP and if not, what is the best way?

Change from static to dynamic

ifconfig eth0 0.0.0.0 0.0.0.0 && dhclient  

Change back

killall dhclient && ifconfig eth0 10.0.1.22 netmask 255.255.255.0