By default, Linux will try to get an IP address for up to 5 minutes. During this time it's not possible to do anything, you just have to wait. This happens a lot if you forget to attach the Ethernet cable to your computer or when you work with Virtual Machines.

Most Debian based Linux'es (like Ubuntu) use "dhclient" to obtain an IP address via DHCP. The configuration file for dhclient is: /etc/dhcp/dhclient.conf. The timeout parameter is set to 60 seconds by default, Linux retries 5 times until giving up, which is a total of 300 seconds (5 minutes). You can change this setting to something lower, say 5 seconds, this reduces the wait to 25 seconds.

Just change /etc/dhcp/dhclient.conf from

timeout 60;

to

timeout 5;