wpa_supplicant -i eth0 -Dwired -c /etc/wpa_supplicant/wpa_supplicant.conf
wpa_supplicant -i eth0 -Dwired -c /etc/wpa_supplicant/wpa_supplicant_fail.conf
dhclient -d eth0
Assuming that your DHCP Server correctly returns the gateway informations:
ping $(route -n | awk NR==3 | awk '{ print $2 }')