Seems like a known bug.
Upgrade from 22.04 LTS to 24.04 LTS and the connection to internet is broken
In my case, I upgraded to 24.04.1. The bug still is there. The fix I do is from this place. I have to do it almost every time I open the OS.
sudo rm /etc/resolv.conf
sudo dhcpcd
Now as mentioned in the post internet is back but the icon on the taskbar is still broken. To fix this UI, this is the command.
sudo apt install systemd-resolved
However, this last command is not always needed. The two commands does the job.