At times i encountered with a weird problem in ubuntu am connected to wifi still am not able to ping i checked dns etc everything seems fine and wifi is connected in network manager but still no net connection then i tried connecting to the wifi network through terminal that worked and i got connection here is how i did it.
$ sudo iwlist eth1 scan
This scan lists every available access point.
Now we got the ESSID from the command now issue the below command
sudo iwconfig eth1 essid "BSNL_AP"
Now run dhclient to get an ip address
sudo dhclient eth1
Now try pinging your luck
Happy Hacking 🙂