You can't get IP from DHCP Server.. probably you have wrong parameters in your
iwconfig command or its not complete!
Im going to make a comprehensive troubleshoot for you however some of them would be unrelated to your case!
First of all lets check if there's other services using your wireless card..
you can try unblocking radio frequencies with this command:
sudo rfkill unblock wifi
after that check block status :
sudo rfkill list
if there's any "yes" beyond Wireless LAN , it means something preventing rfkill to unblock your wifi; you should find that service and stop it. $ sudo service {service} stop
generally,they are other network tools.especially network managers.
stop them or uninstall.
after that set iwconfig parameters in a proper way..to see wifi access points and their specifications:
sudo iwlist scan
You can add | grep searchvalue
to search for a particular name
check those parameters and fill (use root privilege sudo or su root) :
note : the wifi interface name could be different in your machine (eth# or wlan#)
iwconfig wlan0 essid {name of access point}
iwconfig wlan0 ap {access point mac address}
or if you don't know the MAC Address of access point :
iwconfig wlan0 ap any
and :
iwconfig wlan0 enc {on/off/restricted}
iwconfig wlan0 key s:{password}
at last pull up connection :
sudo ifconfig wlan0 up
now request for an IP :
sudo dhclient wlan0
check if your connection succeed (there should be an IP4) :
sudo ifconfig wlan0
or ping your gateway (route)
..Good luck